PDA

View Full Version : Need help scripting apt-get remove



MaldiGola
07-09-2008, 03:26 PM
I have started the remastering process working off the 5.3.1 DVD release. I know the packages I want to remove and have compiled them into a text file.
I thought I would just make a simple bash script to remove them, but it always aborts after a few minutes with no real info as to why.

Here is what I have:
#!/bin/bash
apt-get --force-yes --purge remove packagename


If I run each command it works, but not in the script
I have also tried:
cat filewithnames.txt | xargs apt-get --force-yes --purge remove
This ends with the following: "Do you want to continue? Y/n Abort"


Same issue.


For the record, there are approx. 2500 packages that I want to remove. Is there a hard limit?

rusty
07-09-2008, 09:09 PM
Since apt is a front end for dpkg, I wonder if using dpkg itself might work better.

MaldiGola
07-09-2008, 09:57 PM
If I script like so:

#!/bin/bash
dpkg -r packname
and so on

It just throws bad interpeter errors

turbine
08-18-2008, 01:48 PM
When you run the script

#!/bin/bash
apt-get --force-yes --purge remove packagename

What exactly is the message that you get? I don't remember whether apt-get requires confirmation in this syntax. If it does you may have to redirect standard input to the script itself for each invocation and provide the yes/no response there.

cmd << text

The contents of the shell script up to a line identical to text become the standard input for cmd.