User:Picobyte
Jump to navigation
Jump to search
script to update slackware patches during boot. Save this script as root as /etc/rc.d/rc.updateslack
#!/bin/bash # copyright GPL v2.0 by Roel Kluin 2007 #specify the user authorized for downloading and storage of packages PKGUSR="<your username here>" #specify your favorite mirror RSYNCHOST="<your favorite rsync host>" #is equal to VERSION="12.0" VERSION="`cat /etc/slackware-version | cut -b 11-14`" # where you want to install these packages DESTDIR="/home/$PKGUSR/dnld/slackware/slackware-$VERSION" RSYNC="$RSYNCHOST::slackware/slackware-$VERSION/patches" BEFORE=`date +%Y%m%d%M%S` echo checking for updated slackware-$VERSION patches... su - $PKGUSR -c "mkdir -p $DESTDIR" su - $PKGUSR -c "rsync -q --exclude=patches/source -v --progress \ -az --delete --log-file=$DESTDIR/rsync.log $RSYNC $DESTDIR/" cd $DESTDIR/patches cat CHECKSUMS.md5 | grep -e ".tgz$" | while read sum file; do # only updated files should are checked and installed if [ `date -r $file +%Y%m%d%M%S` -ge $BEFORE ]; then if [ "`openssl md5 $file | cut -d" " -f 2-`" = "$sum" ]; then if [ "`gpg --verify $file.asc 2>&1 | grep Slackware | cut -d" " -f2`" = "Good" ]; then upgradepkg --install-new $file else echo ERROR: SIGN of $file is not OK! fi else echo ERROR: MD5 sum of $file is not OK! fi fi done
dont forget to chmod a+x /etc/rc.d/rc.updateslack
add these lines to your /etc/rc.d/rc.local file
if [ -x /etc/rc.d/rc.updateslack ]; then /etc/rc.d/rc.updateslack fi