Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I read up on the process here and came up with this script:

for i in `ls -1 /var/cache/apt/archives` ; do sudo cp /var/cache/apt/archives/$i /home/jj/Documents/Repository ; done

and to re-install:

sudo dpkg -i /home/jj/Documents/Repository/*.deb

Question: how can I remove these (and their dependencies?) via a script before the re-install?

aisleriot
evolution
evolution-common
evolution-data-server
evolution-exchange
evolution-indicator
evolution-plugins
gbrainy
gnome-mahjongg
gnome-sudoku
gnomine
gwibber
gwibber-service
libevolution
openoffice.org-draw
openoffice.org-impress
quadrapassel

Thank you for your time.

I now see this link of which I chose this method: sudo apt-get remove -y $package and probably cleandeb afterwords. Advice? Suggestions?

Thank you!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

There is a bash script for removing the dependencies after removing the packages.

#!/bin/bash

OLDCONF=$(dpkg -l|grep "^rc"|awk '{print $2}')
CURKERNEL=$(uname -r|sed 's/-*[a-z]//g'|sed 's/-386//g')
LINUXPKG="linux-(image|headers|ubuntu-modules|restricted-modules)"
METALINUXPKG="linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)"
OLDKERNELS=$(dpkg -l|awk '{print $2}'|grep -E $LINUXPKG |grep -vE $METALINUXPKG|grep -v $CURKERNEL)
YELLOW="\033[1;33m"
RED="\033[0;31m"
ENDCOLOR="\033[0m"

if [ $USER != root ]; then
  echo -e $RED"Error: must be root"
  echo -e $YELLOW"Exiting..."$ENDCOLOR
  exit 0
fi

echo -e $YELLOW"Cleaning apt cache..."$ENDCOLOR
aptitude clean

echo -e $YELLOW"Removing old config files..."$ENDCOLOR
sudo aptitude purge $OLDCONF

echo -e $YELLOW"Removing old kernels..."$ENDCOLOR
sudo aptitude purge $OLDKERNELS

echo -e $YELLOW"Emptying every trashes..."$ENDCOLOR
rm -rf /home/*/.local/share/Trash/*/** &> /dev/null
rm -rf /root/.local/share/Trash/*/** &> /dev/null

echo -e $YELLOW"Script Finished!"$ENDCOLOR

Copy the script and paste it in your text editor.And save the file with .sh extension(ie cleaner.sh)Right click the file choose properties>>permissions and check execute..

To run this script,type the following in terminal.

sudo bash /path/to/the/script
share|improve this answer
    
Thank you for your time! –  Habitual Nov 30 '10 at 20:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.