summaryrefslogtreecommitdiffstats
path: root/doinst.sh
diff options
context:
space:
mode:
authorRobby Workman <rworkman@slackware.com>2017-10-19 13:49:43 -0500
committerRobby Workman <rworkman@slackware.com>2017-10-22 01:59:41 -0500
commit406e0e84f5321652fa1a539d80be6ca5df1ffb1b (patch)
tree0225a21dca44efe55180ee2e83027d5eaca2ddec /doinst.sh
downloadslackpkg-406e0e84f5321652fa1a539d80be6ca5df1ffb1b.tar.xz
*: Initial commit of slackpkg (as of 2.82.2 release)2.82.2
Diffstat (limited to 'doinst.sh')
-rw-r--r--doinst.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/doinst.sh b/doinst.sh
new file mode 100644
index 0000000..e04d744
--- /dev/null
+++ b/doinst.sh
@@ -0,0 +1,40 @@
+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
+ ;;
+ *)
+ 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