La Vita è Bella

Friday, January 05, 2007

Selective unlink script (to uninstall TeXLive)

In fact, to uninstall TeXLive should be very easy: "rm -Rf /usr/local/texlive", that's all.

But things are sometimes not so easy. If you've chosen to make symbolic links to your system path (/usr/bin) during the installation, like I had, then you have to unlink all the links TeXLive created.

It's hard to do that manually, so I wrote the following script. You just need to run it under your /usr/bin directory and it will unlink all links that pointed to /usr/local/texlive.

 1 #!/bin/sh
 2
 3 tlprefix="^/usr/local/texlive/"
 4
 5 for file in *; do
 6         if [ -L ${file} ]; then
 7                 link=`readlink ${file}`
 8                 tllink=`echo "${link}" | grep "${tlprefix}"`
 9                 if [ -n "${tllink}" ]; then
10                         echo "going to unlink \"${file}\" that links to \"${link}\"..."
11                         unlink ${file}
12                 fi
13         fi
14 done

It unlinked 240 symbolic links from my /usr/bin directory, horrible! I'll never choose the "make symbolic links to your system path" option again during the installation of TeXLive.



tags: , ,

23:59:57 by fishy - latex - Permanent Link

Revision: 1.2/1.2, last modified on 2007-01-10 @ 21:47.

Karma: 33 (60.78% out of 153 were positive) [+/-]

You can subscribe to RSS 2.0 feed for comments and trackbacks

Trackbacks:
There are currently no trackbacks for this item.
Use this TrackBack url to ping this item (right-click, copy link target). If your blog does not support Trackbacks you can manually add your trackback by using this form.

No comments yet

Add Comment

 

May the Force be with you. RAmen