diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-09-12 15:25:44 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-09-12 15:25:44 +0200 |
commit | 8fc1149868d39ca2e3fb67d1d00ee0b7b4be7acf (patch) | |
tree | 8c83544ec256fcc26c53e9f900de730d6a1f4ae7 | |
parent | f9bc962437f90c0a59071d5188558f309a9cce0e (diff) | |
download | slackupgrade-8fc1149868d39ca2e3fb67d1d00ee0b7b4be7acf.tar.gz slackupgrade-8fc1149868d39ca2e3fb67d1d00ee0b7b4be7acf.tar.bz2 |
Add usage summary and additional info at the end of the run
-rw-r--r-- | slackware-upgrade-system | 76 |
1 files changed, 72 insertions, 4 deletions
diff --git a/slackware-upgrade-system b/slackware-upgrade-system index 0ff2444..dde22f0 100644 --- a/slackware-upgrade-system +++ b/slackware-upgrade-system @@ -11,6 +11,26 @@ quiet_mode= install_all= install_series= +function usage() { + cat <<EOF +usage: $0 [-anqy] [-d DIRECTORY] [-s SERIES] +Upgrade Slackware installation + +Options are: + + -a install all series except kde* + -d DIRECTORY look for slackware distribution in DIRECTORY; + default is $ROOTDIR + -h display this help list and exit + -n dry-run mode: do nothing, print what would have been done + -q quiet mode: suppress messages about individual packages + -s SERIES additionally install all packages from SERIES; + incompatible with -a + -y assume "yes" to all queries + +EOF +} + function getyn() { if [ "$assume_y" = y ]; then /bin/true @@ -42,20 +62,34 @@ function upgrade_package() { fi } -while getopts "ad:ns:qy" OPTION +while getopts "ad:hns:qy" OPTION do case $OPTION in a) install_all=y;; d) PKGDIR=$OPTARG;; + h) usage + exit 0;; n) dry_run=y;; s) install_series="$install_series $OPTARG";; q) quiet_mode=y;; y) assume_y=y;; - *) echo >&2 "usage: $0 [-anqy] [-d DIRECTORY] [-s SERIES]" + *) usage >&2 exit 1 esac done +shift $(($OPTIND - 1)) +if [ $# -gt 0 ]; then + echo >&2 "$0: unexpected arguments" + usage >&2 + exit 1 +fi + +if [ $(id -u) != "0" ]; then + echo >&2 "$0: must be root" + exit 1 +fi + # Sanity check if [ ! -s /etc/os-release ]; then echo >&2 "$0: /etc/os-release doesn't exist" @@ -138,8 +172,8 @@ if [ -n "$missing" ]; then fi # Prepare a list of packages that should be removed after install -installed_list=/tmp/installed.list -avail_list=/tmp/avail.list +installed_list=/tmp/installed.list.$$ +avail_list=/tmp/avail.list.$$ candidates= remove_list=/tmp/remove.list @@ -164,6 +198,9 @@ if [ -z "$install_all" ]; then fi rm -f $installed_list $avail_list +# Disable interrupts during critical section +trap '' HUP INT QUIT ABRT + if [ -s $remove_list -a -z "$quiet_mode" ]; then (cat <<EOF INFO: The following packages will be removed. You will have to manually @@ -243,3 +280,34 @@ if [ -s $remove_list ]; then fi echo "$0: upgrade finished; see $logfile for details" + +conffiles=/var/log/slackware-upgrade-system-$VERSION-$newversion.conffiles +find /etc /usr/lib*/ /usr/share/vim -name "*.new" 2>/dev/null | \ + sort > $conffiles +if [ ! -s "$conffiles" ]; then + rm $conffiles +fi + +if [ -z "$quiet_mode" ]; then + echo "IMPORTANT!" + if [ -s "$conffiles" ]; then + cat <<EOF +Some of your config files may need fixing. Please check the files from this +list and compare them with their counterparts without the ".new" suffix. +Remove the "*.new" files when finished. The list of files follows: + +EOF + cat $conffiles + cat <<EOF + +For your convenience, this list is preserved in the file $conffiles. + +EOF + fi + cat <<EOF +*Before* attempting to reboot your system, please make sure that the +bootloader has been updated for the new kernel! + +Good luck! +EOF +fi |