#!/bin/bash # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # phrag@phra.gs # Modified by Straterra (straterra@gmail.com) # 02/06/2005 # stratdate VERSION="BETA2.2" if [ -e /etc/stratdate.conf ]; then . /etc/stratdate.conf else echo 'MIRROR="inferno.bioinformatics.vt.edu" LPATH="/slackware" RPATH="slackware/slackware-current" CDROM="/mnt/cdrom" EXCLUDE="kdei source" PTYKDE="NO" UPGRADE="YES" LILO="NO"' | tr ' ' '\n' > /etc/stratdate.conf . /etc/stratdate.conf fi echo 'stratdate-'$VERSION' by Straterra' echo 'Please Select An Option Number:' # Menu if [ "$UPGRADE" = "YES" ]; then OPTIONS="check view rsync upgrade installnew help quit" else OPTIONS="check view rsync help quit" fi select opt in $OPTIONS; do # Check slackware-current changelog for changes if [ "$opt" = "check" ]; then echo 'Checks for changes to the slackware-current changelog.' echo 'Downloading ChangeLog.txt from '$MIRROR'...' if [ -e /tmp/ChangeLog.txt ]; then cp /tmp/ChangeLog.txt /tmp/ChangeLog.txt.old rsync -aPvz --delete $MIRROR::$RPATH/ChangeLog.txt /tmp/ChangeLog.txt && echo Download Complete || echo Download from "$MIRROR" Failed diff /tmp/ChangeLog.txt /tmp/ChangeLog.txt.old else rsync -aPvz --delete $MIRROR::$RPATH/ChangeLog.txt /tmp/ChangeLog.txt && echo Download Complete && less /tmp/ChangeLog.txt || echo Download from "$MIRROR" Failed fi # View slackware-current changelog elif [ "$opt" = "view" ]; then less /tmp/ChangeLog.txt # Rsync slackware-current elif [ "$opt" = "rsync" ]; then echo This will create a local slackware-current mirror in $LPATH using your slackware 10.1 disk 1 as a base, should you have one... echo $EXCLUDE | tr ' ' '\n' > /tmp/current-rsync.exclude if [ -e /cdrom/slackware/ ];then mkdir -p "$LPATH/slackware-current" && mount -t iso9660 /dev/cdrom && cd "$LPATH/slackware-current" && cp -R "$CDROM/*" "/slackware/slackware-current/" && echo Copied OK; cd "$LPATH"/slackware-current rsync -aPvz --delete --exclude-from=/tmp/current-rsync.exclude "$MIRROR"::"$RPATH" "$LPATH" && echo Got slackware-current OK || echo Download from "$MIRROR" Failed else mkdir -p "$LPATH/slackware-current" cd "$LPATH"/slackware-current rsync -aPvz --delete --exclude-from=/tmp/current-rsync.exclude "$MIRROR"::"$RPATH" "$LPATH" && echo Got slackware-current OK || echo Download from "$MIRROR" Failed fi # Help elif [ "$opt" = "help" ]; then echo echo 'stratdate-'$VERSION' by Straterra' echo echo Configuration file :: /etc/stratdate.conf :: echo Slackware-current mirror :: $MIRROR :: echo Slackware-current local rsync path :: $LPATH :: echo Slackware-current remote rsync path :: $RPATH :: echo Slackware-current disk 1 path :: $CDROM :: echo Exclude from rsync :: $EXCLUDE :: echo echo echo check - Checks for changes to the slackware-current changelog echo view - Views slackware-current changelog echo upgrade - Upgrades all packages on the system, but does not install new packages echo installnew - Upgrades all package and installs all new packages echo rsync - Creates a local slackware-current mirror in $LPATH using your slackware 10.1 disk1 as a base to save time echo help - Displays this dialog echo # Quit elif [ "$opt" = "quit" ]; then echo 'stratdate-'$VERSION' by Straterra' exit #Upgrade the package elif [ "$opt" = "upgrade" ]; then if [ $UID == 0 ]; then RL=`runlevel | awk -F" " '{print $2}'` if [ "$RL" != 1 ]; then cd /var/log/packages STR1=`ls | grep glibc-solibs` STR2=.tgz GBC1=$STR1$STR2 cd $LPATH/slackware-current/slackware/a mkdir ../../backup && echo Backup completed || echo Backup failed. Please make sure you have perms to write to $LPATH/slackware-current/slackware mv glibc-solibs*.tgz.asc ../../backup GBC2=`ls | grep glibc-solibs | grep tgz` mv ../../backup/glibc-solibs*.tgz.asc ./ rm -r $LPATH/slackware-current/backup if [ "$GBC1" != "$GBC2" ]; then echo "You are in Runlevel $RL and your glibcs need upgrading. Please switch to runlevel 1 and try again." exit fi fi cd $LPATH/slackware-current/slackware mkdir ../backup && echo Backup completed || echo Backup failed. Please make sure you have perms to write to $LPATH/slackware-current/slackware mv ./kdei ../backup && echo Copy completed || echo Copy failed. Please make sure you have perms to write to $LPATH/slackware-current/backup if [ "$PTYKDE" = "YES" ]; then mv ./kde ../backup/kde && echo Copy complete || echo Copy failed. Please make sure you have perms to write to $LPATH/slackware-current/backup mv ./l/arts* ../backup && echo Copy complete || echo Copy failed. Please make sure you have perms to write to $LPATH/slackware-current/backup fi upgradepkg ./a/glibc-solibs-*.tgz upgradepkg ./a/pkgtools-*.tgz upgradepkg */*.tgz && echo Upgrade complete || echo Upgrade failed. Make sure you are root and you are in run level 1! mv ../backup/kdei ./ && echo Copy complete || echo Copy failed. Please make sure you have perms to write to $LPATH/slackware-current/kdei if [ "$PTYKDE" = "YES" ]; then mv ../backup/kde/ ./ && echo Copy complete || echo Copy failed. Please make sure you have perms to write to $LPATH/slackware-current/kde mv ../backup/arts* ./l && echo Copy complete || echo Copy failed. Please make sure you have perms to write to $LPATH/slackware-current/l fi rm -r ../backup if [ "$LILO" = "YES" ]; then echo Please check /etc/lilo.conf and run lilo as root to ensure you have a running kernel, especially if you use the stock Slackware kernel. echo I am going to try to run lilo for you. Please wait.. lilo && echo Lilo was run successfully! || echo Lilo failed. Please check /etc/lilo.conf and try again else echo "Auto LILO running has been disabled via stratdate.conf" fi SLCKVSN1="Slackware Current " SLCKVSN3=`date +%D` echo $SLCKVSN1$SLCKVSN3 > /etc/slackware-version else echo Only available to root! fi #Upgrade and install new packages elif [ "$opt" = "installnew" ]; then if [ $UID == 0 ]; then RL=`runlevel | awk -F" " '{print $2}'` if [ "$RL" != 1 ]; then cd /var/log/packages STR1=`ls | grep glibc-solibs` STR2=.tgz GBC1=$STR1$STR2 cd $LPATH/slackware-current/slackware/a mkdir ../../backup && echo Backup completed || echo Backup failed. Please make sure you have perms to write to $LPATH/slackware-current/slackware mv glibc-solibs*.tgz.asc ../../backup GBC2=`ls | grep glibc-solibs | grep tgz` mv ../../backup/glibc-solibs*.tgz.asc ./ rm -r $LPATH/slackware-current/backup if [ "$GBC1" != "$GBC2" ]; then echo "You are in Runlevel $RL and your glibcs need upgrading. Please switch to runlevel 1 and try again." exit fi fi cd $LPATH/slackware-current/slackware mkdir ../backup && echo Backup completed || echo Backup failed. Please make sure you have perms to write to $LPATH/slackware-current/slackware mv ./kdei ../backup && echo Copy completed || echo Copy failed. Please make sure you have perms to write to $LPATH/slackware-current/backup if [ "$PTYKDE" = "YES" ]; then mv ./kde ../backup/kde && echo Copy complete || echo Copy failed. Please make sure you have perms to write to $LPATH/slackware-current/backup mv ./l/arts* ../backup && echo Copy complete || echo Copy failed. Please make sure you have perms to write to $LPATH/slackware-current/backup fi upgradepkg ./a/glibc-solibs-*.tgz upgradepkg ./a/pkgtools-*.tgz upgradepkg --install-new */*.tgz && echo Upgrade complete || echo Upgrade failed. Make sure you are root and you are in run level 1! mv ../backup/kdei ./ && echo Copy complete || echo Copy failed. Please make sure you have perms to write to $LPATH/slackware-current/kdei if [ "$PTYKDE" = "YES" ]; then mv ../backup/kde/ ./ && echo Copy complete || echo Copy failed. Please make sure you have perms to write to $LPATH/slackware-current/kde mv ../backup/arts* ./l && echo Copy complete || echo Copy failed. Please make sure you have perms to write to $LPATH/slackware-current/l fi rm -r ../backup echo Please check /etc/lilo.conf and run lilo as root to ensure you have a running kernel, especially if you use the stock Slackware kernel. echo I am going to try to run lilo for you. Please wait.. lilo && echo Lilo was run successfully! || echo Lilo failed. Please check /etc/lilo.conf and try again SLCKVSN1="Slackware Current " SLCKVSN3=`date +%D` echo $SLCKVSN1$SLCKVSN3 > /etc/slackware-version else echo Only available to root! fi else echo Invalid Option. Please select an option number from the menu. Hit enter to display the menu again. fi done