summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Cornish2015-07-08 17:46:01 +1000
committerRob Cornish2015-07-08 17:46:01 +1000
commit2f8cfe0623dfd6ec32fcb0f3c2c05eefc09dbc2a (patch)
tree6b5aa20300f17abe192958cbf0b7c4055d2183d8
parent34406ec7ead43613bcbfd51b5ed849c3d6306278 (diff)
downloadaur-2f8cfe0623dfd6ec32fcb0f3c2c05eefc09dbc2a.tar.gz
Fixed UID and GID upgrade issues with brscan-skey user/group
-rw-r--r--PKGBUILD10
-rw-r--r--brscan-skey.install29
2 files changed, 19 insertions, 20 deletions
diff --git a/PKGBUILD b/PKGBUILD
index e5cd6a309d3..4e980d92d92 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Rob Cornish <jrmcornish AT gmail DOT com>
pkgname=brscan-skey
pkgver=0.2.4_1
-pkgrel=9
+pkgrel=10
pkgdesc='Brother scan-key-tool'
arch=('i686' 'x86_64')
url='http://support.brother.com/g/s/id/linux/en'
@@ -13,13 +13,15 @@ optdepends=('sane: for all default scanning scripts'
install=brscan-skey.install
source_i686=("http://www.brother.com/pub/bsc/linux/dlf/${pkgname}-${pkgver/_/-}.i386.rpm")
-md5sums_i686=('c6bc7a501f424541130a1b9a38b76493')
+sha256sums_i686=('30e236f1256d88431eb6fd8f052165ed976b0616e89cdb18196bf894d06c401a')
source_x86_64=("http://www.brother.com/pub/bsc/linux/dlf/${pkgname}-${pkgver/_/-}.x86_64.rpm")
-md5sums_x86_64=('9ad29a0ef9f8f4d6f742fb4293ee08a6')
+sha256sums_x86_64=('2e034b37e282e44a6f94315d932eb8f34693007e4abd10ca10fb4ec468c9bb3d')
source=('brscan-skey.service' 'brscan-skey-user.service' 'LICENSE.html')
-md5sums=('82ba4e7cf73306b17f144731f6484ad0' 'da65d820642f760115428769d2639db9' 'bd06a5d28abb3b3a3a6a263567cbb78b')
+sha256sums=('80d1d92f71381c160a93ddac1bfcde1e7922dc84332f1f7561c6d328af7e7219'
+ '511e49ac6618f2c11e5ed3a4ce4c235bd5d46faa584974f318447b117759651a'
+ '7529071ca3e1a5a1a8558a4d2fc5dd47a4f104f1eb3e9be093de8a2a7c3a216a')
package() {
cp -r "$srcdir"/opt "$pkgdir"
diff --git a/brscan-skey.install b/brscan-skey.install
index 8c9cf939d3f..d2c54524d1e 100644
--- a/brscan-skey.install
+++ b/brscan-skey.install
@@ -4,9 +4,6 @@ post_install() {
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
- # Earlier relases had / as home
- [ $(eval echo ~brscan-skey) = /srv/brscan-skey ] || usermod -d /srv/brscan-skey brscan-skey
-
# Brother's install script
/opt/brother/scanner/brscan-skey/brscan-skey-${pkgver//_/-}.sh 0
@@ -16,31 +13,31 @@ post_install() {
}
pre_upgrade() {
+ local oldpkgverrel=$2
local oldpkgver=${2%-*}
- local brbase=brscan-skey-${oldpkgver//_/-}.sh
- # Older Brother install scripts stored differently
- local oldbr=/usr/local/Brother/sane/$brbase
- local newbr=/opt/brother/scanner/brscan-skey/$brbase
-
- if [ -x $newbr ]; then
- $newbr R
- elif [ -x $oldbr ]; then
- $oldbr R
+ 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
+ else
+ /opt/brother/scanner/brscan-skey/brscan-skey-${oldpkgver//_/-}.sh R
fi
}
post_upgrade() {
- local newpkgver=${1%-*}
+ local newpkgverrel=$1
- post_install "$newpkgver"
+ post_install $newpkgverrel
}
pre_remove() {
local pkgver=${1%-*}
- # Allow to fail since earlier releases did not have a brscan-skey.service file
- systemctl stop brscan-skey.service || true
+ 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