blob: b247384952be330026a9ab8eb160fbe99c003548 (
plain)
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
|
post_install() {
local pkgver=${1%-*}
getent group brscan-skey &> /dev/null || groupadd -g 289 brscan-skey
getent passwd brscan-skey &> /dev/null || useradd -c "Brother scan-key-tool user" -u 289 -g brscan-skey -d /srv/brscan-skey -s /bin/false brscan-skey
echo "Start automatically by running one of the following:"
echo " # systemctl enable brscan-skey.service # System-wide"
echo " $ systemctl --user enable brscan-skey.service # Per-user"
}
pre_upgrade() {
local oldpkgverrel=$2
local oldpkgver=${2%-*}
if (( $(vercmp $oldpkgver 0.2.3) < 0 )); then
# Pre 0.2.3
/usr/local/Brother/sane/brscan-skey-${oldpkgver//_/-}.sh R
elif (( $(vercmp $oldpkgverrel 0.2.4_1-7) <= 0 )); then
# 0.2.4_1-7 and earlier
pre_remove $oldpkgverrel # Deletes brscan-skey user and group which had wrong UID and GID
fi
if (( $(vercmp $oldpkgverrel 0.3.0) < 0 )); then
# before 0.3.0 there were version specific install/uninstall scripts
/opt/brother/scanner/brscan-skey/brscan-skey-${oldpkgver//_/-}.sh R
fi
}
post_upgrade() {
local newpkgverrel=$1
post_install $newpkgverrel
}
pre_remove() {
local pkgver=${1%-*}
systemctl daemon-reload
systemctl --quiet is-active brscan-skey.service && systemctl stop brscan-skey.service
getent passwd brscan-skey &> /dev/null && userdel brscan-skey
getent group brscan-skey &> /dev/null && groupdel brscan-skey || true
}
|