mirror of
https://github.com/rworkman/slackpkg
synced 2024-12-25 21:58:42 +01:00
13c79b1eb2
To make easier to do an unattended slackpkg update/upgrade process, this commit provides different exit codes to many situations: 0 Successful slackpkg execution. 1 Something wrong happened. 20 No package found to be downloaded, installed, reinstalled, upgraded, or removed. 50 Slackpkg itself was upgraded and you need to re-run it. 100 There are pending updates. Code and the main manpage are updated accordingly. In addition, this commit also: - removes the ChangeLog.txt in doinst.sh, so the needed 'slackpkg update' after Slackpkg upgrade won't says it's all OK and don't need to redo the package lists - removes AUTHORS from manpage. Nowadays there are code from many people in Slackpkg and shows a bit unfair to have only my and Evaldo's name listed there. Signed-off-by: Robby Workman <rworkman@slackware.com>
44 lines
1 KiB
Bash
44 lines
1 KiB
Bash
config() {
|
|
NEW="$1"
|
|
OLD="$(dirname $NEW)/$(basename $NEW .new)"
|
|
# If there's no config file by that name, mv it over:
|
|
if [ ! -r $OLD ]; then
|
|
mv $NEW $OLD
|
|
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
|
|
rm $NEW
|
|
fi
|
|
# Otherwise, we leave the .new copy for the admin to consider...
|
|
}
|
|
|
|
copy_mirror_file() {
|
|
ARCH=$(uname -m)
|
|
case $ARCH in
|
|
i386|i486|i586|i686)
|
|
SRCMIRROR=mirrors-x86.sample
|
|
;;
|
|
x86-64|x86_64|X86-64|X86_64)
|
|
SRCMIRROR=mirrors-x86_64.sample
|
|
;;
|
|
s390)
|
|
SRCMIRROR=mirrors-s390.sample
|
|
;;
|
|
arm*)
|
|
SRCMIRROR=mirrors-arm.sample
|
|
;;
|
|
aarch64)
|
|
SRCMIRROR=mirrors-aarch64.sample
|
|
;;
|
|
*)
|
|
SRCMIRROR=mirrors-x86.sample
|
|
;;
|
|
esac
|
|
cp usr/doc/slackpkg-@VERSION@/$SRCMIRROR etc/slackpkg/mirrors.new
|
|
}
|
|
|
|
copy_mirror_file
|
|
config etc/slackpkg/mirrors.new
|
|
config etc/slackpkg/slackpkg.conf.new
|
|
config etc/slackpkg/blacklist.new
|
|
rm -f var/lib/slackpkg/ChangeLog.txt
|
|
rm -f var/lib/slackpkg/pkglist
|
|
rm -f var/lib/slackpkg/CHECKSUMS.md5*
|