Fran's site and blog



Posted by lapaginadefran on December 8, 2010 at 12:30 AM

If you are a typical Ubuntu user or, in general, a gnome enviroment user under any Debian flavour and you 'just want to try out' kde look and feel, or how do you feel when using it (if you like it or not, like it more than gnome or whatever), you may be asking yourself (perhaps):

'How could I safely install the kde desktop enviroment knowing exactly all the packets that were installed and so need to be uninstalled after I write something stupid like I love you

sudo apt-get install kubuntu-desktop language-pack-kde-es-base language-pack-kde-es #'Cos I'm using the spanish translation?'

(but I'm not really sure whether I need to add the 'es-base' packet explicitly since apt-cache depends language-pack-kde-es tells me that the other depens on this one.

Well, from the sight that I'm a newbee in bash scripting, but trying to improve and do my best, I've written this short-wise script that, not only installs the Kubuntu enviroment, but 'take note' of all the packets that, as a question of dependences were also installed and posibbly won't be uninstall when you type the command above but with the remove --purge option instead of doing the install action, as before.

It creates a new script after the installation process that sould remove all the packets already installed with the kubuntu desktop enviroment. Because there are lots of typical kde utilities and tools that come with de kde installation but won't go away by their own or by your apt-get remove --purge magic action under a virtual (o non-) console.

Well, here it is (copy, paste, give a name and change permissions to executable):

num_version=$(lsb_release -rs)
sudo dpkg --get-selections | grep -v deinstall | cut -f1 > before_install
sudo apt-get update
sudo apt-get install kubuntu-desktop language-pack-kde-es
echo "#!/bin/bash\
" > uninstall_kubuntu-$
sudo dpkg --get-selections | grep -v deinstall | cut -f1 > after_install
diff before_install after_install | grep '>' | awk '{print $2}' | sed -e :a -e N -e 's/\n/ /g' -e ta \
| sed 'i\sudo apt-get remove --purge\' | sed -e :a -e N -e 's/\n/ /g' -e ta >> uninstall_kubuntu-$
echo "sudo apt-get autoremove -y
sudo apt-get autoclean
sudo apt-get clean" >> uninstall_kubuntu-$
chown $USER uninstall_kubuntu-$
chmod u+x uninstall_kubuntu-$
rm before_install after_install

#Creo una carpeta específica para guardar todos los scripts desinstaladores (caso de que no exista):

#I create an specific folder at my home directory to keep all the uninstaller scripts (in case it doesn't exists yet):
mkdir ~/uninstallers 2>/dev/null
#I move there my new uninstaller script:
mv uninstall_kubuntu-$ ~/uninstallers

Which I happended to name (in an excess of imagination),

You can do something similar to undo ubuntu-desktop from an original kubuntu (I suppose).

I know the script can and even should be improved (I don't like creating temporary files and I know I can avoid them, but not how to, at the moment).

I still haven't tried out the second part, which is, obviously, the uninstallation duty, and the main one (I know, hehe), but If it doesn't work, I will edit/delete this post if so, (lol)

Good luck!

Categories: Inform├?┬ítica, Linux/Darwin, Mi Ubuntu Linux personalizado

Post a Comment


Oops, you forgot something.


The words you entered did not match the given text. Please try again.

Already a member? Sign In