mikshaw
Group: Members
Posts: 4856
Joined: July 2004 |
|
Posted: Nov. 10 2006,18:11 |
|
This is a preliminary, pre-beta, not-for-serious-use script! I haven't tested it at all, except to check the command syntax.
This script will be used for traditional harddrive installs and for remastering, to remove unwanted applications.
Code Sample | #!/bin/sh
[ -d "$1" ] && cd "$1"
applist=`whiptail --separate-output --checklist select\ applications\ you\ want\ to\ remove 20 72 12 \ aterm terminal\ emulator\ and\ xterm\/rxvt\ symlinks 0 \ beaver gui\ text\ editor 0 \ dillo dillo\ web\ browser 0 \ emelfm gui\ file\ manager 0 \ firefox firefox\ web\ browser 0 \ fluxbox window\ manager 0 \ games card\ games\ and\ tetris 0 \ gphone internet\ phone 0 \ grun application\ launcher 0 \ gtkfind find\ files\ gui 0 \ jwm window\ manager 0 \ mc midnight\ commander\ text-based\ file\ manager 0 \ nano text-based\ text\ editor 0 \ netrik text-based\ web\ browser 0 \ perl perl\ script\ interpreter 0 \ rdesktop remote\ NT\ desktop 0 \ siag spreadsheet\ application 0 \ smbclient connect\ to\ SMB\ shares 0 \ sqlite database 0 \ sylpheed email\ client 0 \ ted word\ processor 0 \ telnet telnet 0 \ torsmo desktop\ system\ monitor 0 \ vnc VNC\ client 0 \ xmms X\ multimedia\ system 0 \ xpaint image\ editor 0 \ xpdf pdf\ viewer 0 \ xtdesk desktop\ icons 0 \ xzgv image\ viewer 0 \ 3>&1 1>&2 2>&3`
if [ $? -eq 1 ]; then exit; fi
cat << EOF You are about to remove the selected applications and their related files. The script may leave a few stray files behind, since I ain't perfect. No guarantee is made about the condition of your system after you complete the following process. The removal of some applications may cause failure in other applications. Proceed at your own risk. Type YES (all caps) to continue. EOF read anykey if [ "$anykey" != "YES" ]; then exit; fi
for i in $applist; do echo "removing $i" case $i in aterm) echo rm -rf usr/bin/{aterm,rxvt,xterm} usr/include/rxvtlib.h usr/lib/librxvt*;; beaver) echo rm -rf usr/bin/beaver;; dillo) echo rm -rf etc/dillorc usr/local/{bin,lib}/dillo* usr/local/bin/dpid* usr/local/etc/{dillorc,dpidrc};; emelfm) echo rm -rf usr/X11R6/bin/emelfm* usr/lib/emelfm;; firefox) echo rm -rf usr/local{,/bin}/firefox;; fluxbox) echo rm -rf usr/bin/flux* usr/share/fluxbox;; games) echo rm -rf usr/games;; gphone) echo rm -rf usr/bin/gphone;; grun) echo rm -rf usr/bin/grun;; gtkfind) echo rm -rf usr/bin/gtkfind;; jwm) echo rm -rf usr/bin/jwm;; mc) echo rm -rf usr/local/bin/{mc,mc.bin};; nano) echo rm -rf bin/nano*;; netrik) echo rm -rf usr/local/bin/netrik;; perl) echo rm -rf usr/{bin,lib}/perl* usr/lib/libperl* usr/share/perl*;; rdesktop) echo rm -rf usr/{bin,share}/rdesktop usr/local/bin/rdesktop.lua;; siag) echo rm -rf usr/lib/libMowitz* usr/local/{lib,share}/{siag,libMowitz*} usr/local/bin/{mowitz-config,siag*};; smbclient) echo rm -rf usr/bin/smb* usr/local/bin/smbclient.lua;; sqlite) echo rm -rf usr/bin/sqlite usr/lib/libsqlite*;; sylpheed) echo rm -rf usr/bin/sylpheed;; ted) echo rm -rf usr/local{,/bin}/Ted usr/local/bin/ted;; telnet) echo rm -rf usr/bin/telnet;; torsmo) echo rm -rf usr/local/bin/torsmo;; vnc) echo rm -rf usr/bin/vnc*;; xmms) echo rm -rf usr/{bin,lib}/xmms usr/lib/libxmms.* usr/share/xmms;; xpaint) echo rm -rf usr/X11R6/bin/xpaint;; xpdf) echo rm -rf etc/xpdf usr/bin/xpdf usr/share/xpdf;; xtdesk) echo rm -rf usr/bin/xtdesk usr/local/bin/xtdesk.sh;; xzgv) echo rm -rf usr/bin/xzgv;; esac done
|
It will not do any actual removal in its current state, since all commands are just echo commands. Using this command will remove the echos:
Code Sample | sed 's/echo\ rm/rm/' /path/to/script > /path/to/new/script |
I have a notion that Mowitz is used in DSL only for Siag, which is why they are removed together. However, I'm not sure about this, so that fact along with the fact that this is a test may result in unwanted behavior.
The script runs on the current directory unless a directory is specified as a command parameter. If you want to remove programs from an existing harddrive install (not frugal or embedded), it should be run from /, as root.
Basically I'm looking for feedback on how useful this is, whether it should have added features, ways to make it smaller and more efficient, etc.
-------------- http://www.tldp.org/LDP/intro-linux/html/index.html
|