Article 5NETR Script for frequent upgraders of multilib

Script for frequent upgraders of multilib

by
wirelessmc
from LinuxQuestions.org on (#5NETR)
With all the recent upgrades to current I found it easier to have scripts to help facilitate the upgrade process. Admittiedly most of these were born from Eric's (Alien) current update script. I found this entirely too convenient. In any event some of you slacker's might find the below script useful for updating/upgrading your multilib assuming it is a must-have in your slackware tool kit and you don't already mirror it with slackpkg+. It is written with the assumption that your local multilib repository has user permissions. The script of course must be run with root privileges as it does the actual upgrading as well as the downloading. Hope you find it useful. Tailor it to your needs - For example be sure to use your actual username and group below for permission setting. Also change $MIRRORPARENT to where you normally download multilib to in your user account. Also you may not care about keeping a copy of the ChangeLog. Note: Hopefully it shouldn't be much longer we'll be changing "current" to "15.0".

#!/bin/bash

REMOTEMIRROR=${REMOTEMIRROR:-"http://slackware.uk/people/alien/multilib/"}
# alternate Remote Mirror
# http://bear.alienbase.nl/mirrors/people/alien/multilib/

SLACKVER=${SLACKVER:-"current"}
MIRRORPARENT=${MIRRORPARENT:-"/g/wget_slk/multilib"}
MIRROR=${MIRROR:-"$MIRRORPARENT/$SLACKVER"}
USER=${USER:-"myusername"}
GROUP=${GROUP:-"mygroupname"}

cd $MIRRORPARENT
echo "Checking to make sure local mirror $MIRROR doesn't already exist and renaming if it does..."
if [ -d $SLACKVER ]; then
echo "folder $SLACKVER already exists. Appending .tmp to existing folder name..."
mv $SLACKVER "$SLACKVER.tmp"
fi

echo "Checking to see if ChangeLog already exists before downloading..."
if [ -f ChangeLog.txt ]; then
echo "ChangeLog.txt already exists so will rename downloaded version once download completes..."
echo "Downloading ChangeLog.txt.1 into $MIRRORPARENT ..."
/usr/bin/wget "$REMOTEMIRROR/ChangeLog.txt"
echo "Renaming ChangeLog.txt.1 to ChangeLog.txt"
/usr/bin/mv ChangeLog.txt.1 ChangeLog.txt
else
echo "Downloading ChangeLog.txt into $MIRRORPARENT ..."
/usr/bin/wget "$REMOTEMIRROR/ChangeLog.txt"
fi

/usr/bin/lftp -c "open $REMOTEMIRROR ; mirror -c -e $SLACKVER"

echo "Mirror has completed downloading..."
echo "Changing working directory to $MIRROR"
cd $MIRROR
echo "Upgrading glibc and compiler packages to multilib versions..."

/sbin/upgradepkg --reinstall --install-new *.t?z

echo ""
echo ""
echo ""
echo "now upgrading all the compat32 packages..."

/sbin/upgradepkg --install-new slackware64-compat32/*-compat32/*.t?z

echo ""
echo ""
echo ""
echo "done with all upgrades..."
DATESTAMP=`/usr/bin/date +"%m-%d-%y"`
SLKVERDS="$SLACKVER-$DATESTAMP"
echo "Changing the folder name of $SLACKVER to append the date stamp before next upgrade..."
cd $MIRRORPARENT
/usr/bin/mv $SLACKVER $SLKVERDS
echo "Changing ownership and group of local mirror and ChangeLog back to $USER..."

/usr/bin/chown -R $USER $SLKVERDS "ChangeLog.txt"
/usr/bin/chgrp -R $GROUP $SLKVERDS "ChangeLog.txt"
echo "All operations complete."
latest?d=yIl2AUoC8zA latest?i=xrvEtLGpD84:jKmwuzkZmEk:F7zBnMy latest?i=xrvEtLGpD84:jKmwuzkZmEk:V_sGLiP latest?d=qj6IDK7rITs latest?i=xrvEtLGpD84:jKmwuzkZmEk:gIN9vFwxrvEtLGpD84
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments