summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAinola2018-09-06 23:55:03 -0600
committerAinola2018-09-06 23:55:03 -0600
commitf33e459f9ac4b282adc7179c1300c626a7cdc785 (patch)
treefb1f358bf828d4d14e46f689fdf89f5aaf6025e2
parentaa3daf8d5051a22f3cbd7f5d985c23d6e5469378 (diff)
downloadaur-f33e459f9ac4b282adc7179c1300c626a7cdc785.tar.gz
PKGBUILD cleanups
-rw-r--r--PKGBUILD79
-rw-r--r--scanbd.install10
2 files changed, 43 insertions, 46 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 3bc04e78ca0c..5b916e7afe9b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,59 +1,62 @@
-# Maintainer: Ainola
-# Contributor: Milan Knizek <knizek@volny.cz>
+# Contributor: Ainola
+# Contributor: Milan Knizek
pkgname=scanbd
pkgver=1.5.1
-pkgrel=1
+pkgrel=2
pkgdesc="Scanner button daemon looking for scanner button pressed"
-arch=('i686' 'x86_64')
+arch=('x86_64')
url="http://scanbd.sourceforge.net/"
license=('GPL2')
depends=('sane' 'confuse')
-source=("http://downloads.sourceforge.net/scanbd/scanbd-${pkgver}.tgz")
+source=("http://downloads.sourceforge.net/scanbd/scanbd-$pkgver.tgz")
sha256sums=('b69ca5a474b81516d19c38082d949363c243df9ab9742315aaae499723267e5f')
install=scanbd.install
backup=('etc/scanbd/scanbd.conf')
-## Note that original scanbd documentation is based on --prefix=/usr/local
-## This package uses standard hierarchy (/usr, /etc)
+prepare() {
+ cd "$pkgver"
+ # Since scanbd and saned are running on the same machine as the scanner is
+ # connected to, we need to have two sets of saned configurations - one in
+ # the default location (/etc/sane.d/), which would redirect local
+ # applications to a network socket, that systemd is listening on, and
+ # another one (e.g. /etc/scanbd/sane.d/), which will be actually used by
+ # sane backend to access the attached scanner.
+ sed -i 's@\(Environment=SANE_CONFIG_DIR=/etc/scanbd\)$@\1/sane.d@' \
+ integration/systemd/scanbd.service
+
+ sed -i 's@\(Environment=SANE_CONFIG_DIR=/etc/scanbd\)$@\1/sane.d@' \
+ integration/systemd/scanbm@.service
+
+
+ # Arch uses the 'daemon' user and 'scanner' group.
+ sed -i 's/"saned">.*/"daemon">/' integration/scanbd_dbus.conf
+
+ sed -i 's@\(user = \)saned$@\1daemon@' conf/scanbd.conf
+ sed -i 's@\(group = \)lp$@\1scanner@' conf/scanbd.conf
+ sed -i 's@/var\(/run/scanbd.pid\)@\1@' conf/scanbd.conf
+ sed -i 's@\(debug-level =\)7$@\1 2@' conf/scanbd.conf
+ sed -i 's@\(SANE_CONFIG_DIR=\)\(/etc/scanbd\)@\1\2/sane.d@' conf/scanbd.conf
+}
build() {
- cd "${srcdir}/${pkgver}"
- ./configure --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin
- make
+ cd "$pkgver"
+ ./configure --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin
+ make
}
package() {
- cd "${srcdir}/${pkgver}"
- make DESTDIR="$pkgdir" install
-
- install -d "${pkgdir}/etc/dbus-1/system.d"
- install -m644 integration/scanbd_dbus.conf "${pkgdir}/etc/dbus-1/system.d"
- sed -i 's@<policy user="saned">@<policy user="nobody">@' "${pkgdir}/etc/dbus-1/system.d/scanbd_dbus.conf"
-
- install -d "${pkgdir}/usr/lib/systemd/system"
- install -m644 integration/systemd/scanbd.service "${pkgdir}/usr/lib/systemd/system"
- sed -i 's@\(Environment=SANE_CONFIG_DIR=/etc/scanbd\)$@\1/sane.d@' "${pkgdir}/usr/lib/systemd/system/scanbd.service"
-
- install -m644 integration/systemd/scanbm@.service "${pkgdir}/usr/lib/systemd/system"
- sed -i 's@\(User=\)saned@\1nobody@' "${pkgdir}/usr/lib/systemd/system/scanbm@.service"
- sed -i 's@\(Group=\)saned@\1scanner@' "${pkgdir}/usr/lib/systemd/system/scanbm@.service"
- sed -i 's@\(Environment=SANE_CONFIG_DIR=/etc/scanbd\)$@\1/sane.d@' "${pkgdir}/usr/lib/systemd/system/scanbm@.service"
-
- install -m644 integration/systemd/scanbm.socket "${pkgdir}/usr/lib/systemd/system"
-
- install -d "${pkgdir}/usr/share/dbus-1/system-services"
- install -m644 integration/systemd/de.kmux.scanbd.server.service "${pkgdir}/usr/share/dbus-1/system-services"
+ cd "$pkgver"
+ make DESTDIR="$pkgdir" install
- install -d "${pkgdir}/usr/share/doc/${pkgname}"
- install -m644 doc/README.txt AUTHORS "${pkgdir}/usr/share/doc/${pkgname}"
+ install -Dm644 integration/scanbd_dbus.conf -t "$pkgdir/etc/dbus-1/system.d/"
+ install -Dm644 integration/systemd/{scanbd,scanbm@}.service -t "$pkgdir/usr/lib/systemd/system/"
+ install -Dm644 integration/systemd/scanbm.socket -t "$pkgdir/usr/lib/systemd/system/"
- install -d "${pkgdir}/etc/scanbd/sane.d"
+ install -Dm644 integration/systemd/de.kmux.scanbd.server.service \
+ -t "$pkgdir/usr/share/dbus-1/system-services/"
- sed -i 's@\( user = \)saned$@\1nobody@' "${pkgdir}/etc/scanbd/scanbd.conf"
- sed -i 's@\( group = \)lp$@\1scanner@' "${pkgdir}/etc/scanbd/scanbd.conf"
- sed -i 's@/var\(/run/scanbd.pid\)@\1@' "${pkgdir}/etc/scanbd/scanbd.conf"
- sed -i 's@\(debug-level =\)7$@\1 2@' "${pkgdir}/etc/scanbd/scanbd.conf"
- sed -i 's@\(SANE_CONFIG_DIR=\)\(/etc/scanbd\)@\1\2/sane.d@' "${pkgdir}/etc/scanbd/scanbd.conf"
+ install -Dm644 {doc/README.txt,AUTHORS} -t "$pkgdir/usr/share/doc/$pkgname/"
+ install -dm755 "$pkgdir/etc/scanbd/sane.d"
}
diff --git a/scanbd.install b/scanbd.install
index 0d0a391ea8ed..03ef3271bb7f 100644
--- a/scanbd.install
+++ b/scanbd.install
@@ -1,10 +1,4 @@
post_install() {
- echo "Read the Arch Linux Wiki on how to set up and run scanbd:"
- echo "https://wiki.archlinux.org/index.php/Scanner_Button_Daemon"
-}
-
-pre_remove() {
- systemctl stop scanbd.service 2>&1 > /dev/null
- systemctl stop scanbm.socket 2>&1 > /dev/null
- systemctl disable scanbd.service 2>&1 > /dev/null
+ echo "Read the Arch Linux Wiki on how to set up and run scanbd:"
+ echo "https://wiki.archlinux.org/index.php/Scanner_Button_Daemon"
}