Diskset package removal
Please test the following script and post back any comments improvements.
Not the world's best googler so I wrote this script to remove ALL packages for a selected diskset (is subdirectory: gnome,kde...). Copy to /var/log/setup/setup.rmseries setting ownship root/root and permissions. Then run pkgtool.
Begin script copy***************************
#!/bin/sh
#BLURB="Remove ALL pkgs in a selected 'diskset'"
#
TMP=/var/log/setup/tmp
if [ ! -d $TMP ]; then
mkdir -p $TMP
fi
cat << EOF > $TMP/tempmsg
First, you should have already mounted your source files.
Best results are achieved by using the source you used to build
this host with. \n
RmSeries uses the tagfile in a selected series to determine which
files to remove. Removepkg just throws an error message
if you tell it to remove a non-installed package. Thus, its not worth
the code to figure out which packages in tagfile are actually installed.
So be prepared to see "No such package.."\n
Next screen will ask for your mount point. The script expects to be at the
directory ABOVE /Slackware/[a ap d ...] . Maybe /mnt/cdrom , note there
is no trailing '/' .
Lastly, just the short name is used ie 'apache'. No version #, no build#,
THUS if your special package has a short name similiar to a Slackware package
keep your .tgz handy.\n
Continue ?
EOF
dialog --title "Welcome to RmSeries" --yesno "`cat $TMP/tempmsg`" 0 0
if [ ! $? = 0 ]; then
exit
fi
rm -f $TMP/SeThost $TMP/tempmsg
cat << EOF > $TMP/tempmsg
This script needs your source mount point.
Enter mount point:
EOF
#Uncomment next two lines , modifing directory info on second line
#Don't count this line! Then comment out lines 3&4 below
# dialog --title "ENTER Source Mount Point" --inputbox "`cat $TMP/tempmsg`" 11 65 \
# /home/ftp/pub/Slackware-10.0 $HOSTNM 2> $TMP/SeThost
dialog --title "ENTER Source Mount Point" --inputbox "`cat $TMP/tempmsg`" 8 65 \
2> $TMP/SeThost
if [ ! $? = 0 ]; then
exit
fi
HOSTNM=`cat $TMP/SeThost`
rm -f $TMP/SeThost $TMP/tempmsg
if ! cd $HOSTNM/slackware 1> /dev/null 2> /dev/null; then
dialog --title "Slackware directory NOT found!" --msgbox "Sorry, but '$HOSTNM' \
does not have the subdirectory 'Slackware'. You must mount your Slackware \
files (cd or nfs) prior to running this script. REMEMBER the script looks for the \
directory ABOVE /Slackware/[a ap d ...] . \
You'll have to try to again after properly mounting your source." 9 70
exit
fi
rm -f $TMP/SeTSERIES $TMP/tmpscript
cat << EOF > $TMP/tmpscript
dialog --title "PACKAGE SERIES DELETION" --item-help --radiolist \\
"Select which general category of software to DELETE from your system. \\
Use the spacebar to select the software group you wish to DELETE. \\
You can only delete ONE Package series at a time. \\
You can use the up and down arrows to see all the possible choices. \\
You can also goto a package by typing the first letter. \\
NOTE: You can not use this for the A - Base series. There you must \\
remove individual packages with removepkg. \\
Press the ENTER key when you are finished." \\
20 75 9 \\
"AP" "Various Applications that do not need X" off "The AP series is a collection of useful applications." \\
"D" "Program Development (C, C++, Lisp, Perl, etc.)" off "The D series contains compilers, debuggers, and other programming tools." \\
"E" "GNU Emacs" off "The E series contains the GNU Emacs advanced real-time display editor." \\
"F" "FAQ lists, HOWTO documentation" off "The F series contains essential documentation for Linux system administrators." \\
"GNOME" "The GNOME desktop for X" off "The GNOME series contains the GNOME desktop environment and related libraries." \\
"K" "Linux kernel source" off "The K series contains the source code for the Linux kernel." \\
"KDE" "Qt and the K Desktop Environment for X" off "The KDE series contains the K Desktop Environment and related libraries." \\
"KDEI" "International language support for KDE" off "The KDEI series provides support for languages other than US English in KDE." \\
"L" "System Libraries (some needed by both KDE and GNOME)" off "The L series contains libraries needed by GNOME, KDE, and other programs." \\
"N" "Networking (TCP/IP, UUCP, Mail, News)" off "The N series contains network related clients and servers." \\
"T" "TeX typesetting software" off "TeX is a typesetting system often used for mathematics and technical papers." \\
"TCL" "Tcl/Tk script languages" off "The TCL series contains the Tcl/Tk/TclX languages and programs that use them." \\
"X" "XFree86 X Window System" off "The X series contains XFree86, the window system used by Linux." \\
"XAP" "X Applications" off "The XAP series is a collection of applications for X." \\
"Y" "Games" on "The Y series contains a collection of classic text-based games." \\
2> $TMP/series
EOF
. $TMP/tmpscript
if [ ! $? = 0 ]; then
rm -f $TMP/SeThost $TMP/tempmsg
exit
fi
SERIES="`cat $TMP/series | tr A-Z a-z`"
rm -f $TMP/tmpscript $TMP/series
if [ ! -r $HOSTNM/slackware/$SERIES/tagfile ] 1> /dev/null 2> /dev/null; then
dialog --title "$SERIES tagfile NOT found!" --msgbox "Sorry, but\
'$HOSTNM/slackware/$SERIES' does not contain a tagfile \n
You'll have to try to again after checking your source files." 7 70
exit
fi
cat $HOSTNM/slackware/$SERIES/tagfile | sed -e '/^#/d' | cut -f 1 -d ':' > $TMP/PKGtoRM
for i in `cat $TMP/PKGtoRM`; do
/sbin/removepkg $i
done
rm -f $TMP/PKGtoRM
******************End script copy***********************
|