All pastes #268605 Raw Edit

Something

public text v1 · immutable
·published 2006-12-05 21:16 UTC
rendered paste body
# This script is to perform several steps for keeping the Slackware hosts up to date.
# Presumably this script was originally created by Henry Pfeil, modified/enhanced by Sean Galyen on 12/5/06.

# Script purpose:  The script will download a local copy of the Slackware packages, compare them against currently installed package and report which packages should be upgraded but will NOT automatically upgrade.

# Notes:
# The script will generate a working file called /root/sync_slack/sync_slack.txt to hold the email attachment to be generated.
# The script will generate a temporary file called /root/sync_slack/sync_slack.wip to hold the upgradepkg results.


# Verify we have a good copy of the most recent packages, hosted from thales.ltc.arizona.edu public rsync repository.
# The > here is to ensure the file is fresh even though we delete it at the end of the script.
# All >> after this one to append, except for the wip file.
rsync -az --delete --delete-after --delete-excluded --progress --stats rsync://thales.ltc.arizona.edu/slackware/ /usr/local/src/slackware  --exclude-from=/usr/local/src/rsync_exclude > /root/sync_slack/sync_slack.txt

# Generate the temporary file with all the text we plan to manipulate.
# *** It is critical to have the --dry-run switch or upgradepkg will UPGRADE your packages.
# The > here is to ensure the file is fresh even though we delete it at the end of the script.
cd /usr/local/src/slackware
upgradepkg --dry-run */*.tgz > /root/sync_slack/sync_slack.wip

# List which packages need to be upgraded by filtering out all "no installed" and "already installed".
echo "" >> /root/sync_slack/sync_slack.txt
echo "Packages that can be upgraded:" >> /root/sync_slack/sync_slack.txt
echo "" >> /root/sync_slack/sync_slack.txt
cat /root/sync_slack/sync_slack.wip | grep -v "no installed package named" | grep -v "already installed" >> /root/sync_slack/sync_slack.txt

# List which packages are installed but do not need to be upgraded.
echo "" >> /root/sync_slack/sync_slack.txt
echo "Packages that are installed but do not need to be upgraded:" >> /root/sync_slack/sync_slack.txt
echo "" >> /root/sync_slack/sync_slack.txt
cat /root/sync_slack/sync_slack.wip | grep -v "no installed package named" >> /root/sync_slack/sync_slack.txt

# List which packages are not installed.
echo "" >> /root/sync_slack/sync_slack.txt
echo "Packages that are not installed:" >> /root/sync_slack/sync_slack.txt
echo "" >> /root/sync_slack/sync_slack.txt
cat /root/sync_slack/sync_slack.wip | grep "no installed package named" >> /root/sync_slack/sync_slack.txt

# Email results as a txt file attachment to admin.
echo "See attached" | mail -s "Anaximenes SynSlack output" -a /root/sync_slack/sync_slack.txt sgalyen@arizona.edu

# Clean up temporary and working file.
rm /root/sync_slack/sync_slack.txt
rm /root/sync_slack/sync_slack.wip