-
Notifications
You must be signed in to change notification settings - Fork 1
/
slackware-upgrade.sh
executable file
·63 lines (47 loc) · 1.81 KB
/
slackware-upgrade.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# Mod by MDrights from Slackware's official script.
# Change Log
# 2017.12.05 set custom directories to be upgraded; make logs.
# 2018.03.26 add unwant-upgrade package options.
# 2018.07.29 1. sync remote repo; 2. can prevent selected apps to be installed; 3. delete packages if installation succeeded.
# Fill in the apps you do not want to install/upgrade in APP_EXC.
# Upgrade the series in the `for ... in ...` statement.
REPO_DIR=${REPO_DIR:-/home/user/slackware-repo/slackware64-current}
APP_EXC=(bluez-firmware getty-ps lha unarj amp slackpkg font-bh-ttf font-bh-type1 ipw2100-fw ipw2200-fw hplip joe lxc mariadb blackbox fvwm gnuchess rdesktop trn zd1211-firmware windowmaker x3270 xfractint xgames xv xaos mozilla-thunderbird seamonkey seamonkey-solibs)
# rsync first
# rsync -avz --delete --exclude 'source' [email protected]:/mnt/usb1/slackware64-current/ ${REPO_DIR}/
OPT="$1"
if [[ $OPT == "-i" ]];then
upgrade_opt="--install-new"
echo "You enabled: install new packages during upgrading."
else
upgrade_opt=""
fi
cd ${REPO_DIR}/slackware64
ret=0
for dir in a ap d f k l n x xap tcl;
do
for PKG in $(ls ${dir}/*.txz); do
num=$(awk -F'-' '{ print NF }' <<< ${PKG##*/})
if [[ $num -eq 4 ]]; then
pkg=$(cut -d"-" -f1 <<< ${PKG##*/})
else
pkg=$(cut -d"-" -f1,2 <<< ${PKG##*/})
fi
if [[ "${APP_EXC[@]}" =~ "$pkg" ]]; then
echo "WARN Do not upgrade package: $pkg" | tee -a /tmp/upgrade.log
continue
fi
#echo "upgrading $pkg"
upgradepkg $upgrade_opt $PKG
#[[ $? -eq 0 ]] && rm $PKG
done
done
# Show the apps which were not installed/deleted. (disabled)
#APP_FAIL=$(find ${REPO_DIR}/slackware64/{a,ap,d,f,k,l,n,x,xap,tcl} -name "*.txz")
#if [ ! -z "$APP_FAIL" ]; then
# echo "Finished. You may have one or more packages not installed:"
# echo "$APP_FAIL"
# ret=1
#fi
exit $ret