diff options
author | Manoel Vilela | 2017-08-08 06:08:42 -0300 |
---|---|---|
committer | Manoel Vilela | 2018-01-25 15:55:09 -0300 |
commit | b0e7bb6ae6ed7df645dae8a20ec1c2e3a588bd8d (patch) | |
tree | 984b254749bdcb7d95820f298ee051b83707d550 | |
parent | b88454db918cb2d2bfbfdbf2262bbefdef4ff661 (diff) | |
download | aur-b0e7bb6ae6ed7df645dae8a20ec1c2e3a588bd8d.tar.gz |
Add openrc-script alternative when user has OpenRC installed
This avoid the whole problem to remove the systemd service
installed by default and write by yourself a OpenRC script.
Beyond that, I remove the trailing spaces of the PKGBUILD file,
fix the formatting and add triggers on post_install and pre_remove
about OpenRC.
I tested on my own machine and this seems works fine.
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 60 | ||||
-rw-r--r-- | warsaw.install | 9 | ||||
-rwxr-xr-x | warsaw.openrc | 54 |
4 files changed, 100 insertions, 27 deletions
@@ -1,7 +1,7 @@ pkgbase = warsaw pkgdesc = Banking security tool developed by GAS Tecnologia pkgver = 1.12.3.11 - pkgrel = 2 + pkgrel = 3 url = https://seg.bb.com.br arch = i686 arch = x86_64 @@ -11,7 +11,9 @@ pkgbase = warsaw depends = nss options = !strip source = warsaw.service + source = warsaw.openrc sha256sums = dde06741817b8b77d9b1150bd10110d8b22330f8e2900fcae06dcedeee10a09e + sha256sums = cfc3c52a08baca16d083cc3b416571c3bea64a7e72819ae75e10746ee7c6d00d source_i686 = https://cloud.gastecnologia.com.br/bb/downloads/ws/warsaw_32_installer.run sha256sums_i686 = 00c14f1695e39029f75288517128861715be7fac8d8ff742854331c18ce9125c source_x86_64 = https://cloud.gastecnologia.com.br/bb/downloads/ws/warsaw_64_installer.run @@ -1,8 +1,9 @@ # Maintainer: Rafael Fontenlle <rafaelff@gnome.org> +# Collaborator: Manoel Vilela <manoel_vilela@engineer.com> pkgname=warsaw pkgver=1.12.3.11 -pkgrel=2 +pkgrel=3 pkgdesc="Banking security tool developed by GAS Tecnologia" arch=(i686 x86_64) url="https://seg.bb.com.br" @@ -10,10 +11,11 @@ license=('custom') depends=('openssl' 'nss') makedepends=('chrpath') options=(!strip) -source=(warsaw.service) +source=(warsaw.service warsaw.openrc) source_i686=(https://cloud.gastecnologia.com.br/bb/downloads/ws/warsaw_32_installer.run) source_x86_64=(https://cloud.gastecnologia.com.br/bb/downloads/ws/warsaw_64_installer.run) -sha256sums=('dde06741817b8b77d9b1150bd10110d8b22330f8e2900fcae06dcedeee10a09e') +sha256sums=('dde06741817b8b77d9b1150bd10110d8b22330f8e2900fcae06dcedeee10a09e' + 'cfc3c52a08baca16d083cc3b416571c3bea64a7e72819ae75e10746ee7c6d00d') sha256sums_i686=('00c14f1695e39029f75288517128861715be7fac8d8ff742854331c18ce9125c') sha256sums_x86_64=('d8d637a2910aed6ab5e9baa9d2bd85c00259ee133e4aa6219bbf7d1dd3b04f40') @@ -27,13 +29,13 @@ fi prepare() { cd $srcdir - - # Make sure to have a cleaned up warsaw directory + + # Make sure to have a cleaned up warsaw directory [ ! -d $pkgname-$pkgver ] && mkdir $pkgname-$pkgver [ -d $_warsawdir ] && rm -rf $_warsawdir - - # Extracts the binary content starting from the line number "L" - # (L was informed within the installer) + + # Extracts the binary content starting from the line number "L" + # (L was informed within the installer) L=363 tail -n +$L $_installer | tar -zxvf - -C $pkgname-$pkgver } @@ -46,25 +48,28 @@ build() { package() { cd $pkgname-$pkgver/$_warsawdir make DESTDIR="$pkgdir" install - - # Enable executable permission for binaries + + # Enable executable permission for binaries chmod +x "$pkgdir/usr/bin/warsaw/core" chmod +x "$pkgdir/usr/bin/warsaw/migratecache" chmod +x "$pkgdir/usr/bin/warsaw/wsatspi" chmod +x "$pkgdir/usr/bin/warsaw/wscertmgr" - - # Set paths in comply with Arch Packaging Standards - # i.e. Use /usr/bin, /etc, and /tmp + + # Set paths in comply with Arch Packaging Standards + # i.e. Use /usr/bin, /etc, and /tmp sed -i 's|/usr/local/etc|/etc|g;s|/var/tmp|/tmp|' \ "$pkgdir/usr/bin/warsaw/wscertmgr" sed -i 's|/usr/local/bin|/usr/bin|' \ "$pkgdir/etc/xdg/autostart/warsaw.desktop" - - # Install copyright and license in proper directory + + # this should be replaced to the systemd/openrc daemon + rm -rf "$pkgdir/etc/xdg/" + + # Install copyright and license in proper directory install -Dm644 "$pkgdir"/usr/share/{doc,licenses}/warsaw/copyright rm -rf "$pkgdir/usr/share/doc" - - # Fix insecure RPATH to /usr/local/ directories + + # Fix insecure RPATH to /usr/local/ directories chrpath -d "$pkgdir/usr/bin/warsaw/migratecache" chrpath -d "$pkgdir/usr/lib/warsaw/wsftuan.so" chrpath -d "$pkgdir/usr/lib/warsaw/wslbmid.so" @@ -74,13 +79,20 @@ package() { chrpath -d "$pkgdir/usr/lib/warsaw/wsftbid.so" chrpath -d "$pkgdir/usr/lib/warsaw/wsftdl.so" chrpath -d "$pkgdir/usr/lib/warsaw/wsbrmu.so" - - # Use systemd service instead of SysVinit script - install -Dm644 "$srcdir/warsaw.service" \ - "$pkgdir/usr/lib/systemd/system/warsaw.service" - rm -rf "$pkgdir/etc/init.d" - - # Symlink to /usr/local, as the binaries still expect them to be valid + + # :: Use systemd or openrc service instead of SysVinit script + # if user use openrc, so then install warsaw.openrc + if (pacman -Qi openrc &> /dev/null); then + # override sysinit to OpenRC script + install -Dm755 "$srcdir/warsaw.openrc" "$pkgdir/etc/init.d/warsaw" + else + install -Dm644 "$srcdir/warsaw.service" \ + "$pkgdir/usr/lib/systemd/system/warsaw.service" + rm -rf "$pkgdir/etc/init.d" + fi + + + # Symlink to /usr/local, as the binaries still expect them to be valid install -dm755 "$pkgdir/usr/local/"{etc,bin,lib} ln -s /etc/warsaw/ "$pkgdir/usr/local/etc/warsaw" ln -s /usr/bin/warsaw/ "$pkgdir/usr/local/bin/warsaw" diff --git a/warsaw.install b/warsaw.install index cd6d81c53829..a6a5229ad495 100644 --- a/warsaw.install +++ b/warsaw.install @@ -1,8 +1,13 @@ post_install() { echo "To use Warsaw, start its service using:" - echo "# systemctl start warsaw" + echo "systemd: # systemctl start warsaw" + echo "openrc: # rc-service warsaw stop" } pre_remove() { - systemctl stop warsaw + if (pacman -Q openrc &> /dev/null); then + rc-service warsaw stop + else + systemctl stop warsaw + fi } diff --git a/warsaw.openrc b/warsaw.openrc new file mode 100755 index 000000000000..d950d3ad0494 --- /dev/null +++ b/warsaw.openrc @@ -0,0 +1,54 @@ +#!/usr/bin/openrc-run +### BEGIN INIT INFO +# Provides: warsaw +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Handles Warsaw - core +# Description: Warsaw Technology - core +# Developed by GAS Tecnologia<info@gastecnologia.com.br> +# Copyright 2015 GAS Tecnologia +# +# Adapted to be a OpenRC script by: Manoel Vilela <manoel_vilela@engineer.com> +### END INIT INFO + +PACKAGE=warsaw +NAME=core +DAEMON=/usr/local/bin/warsaw/$NAME +TIMEOUT=5 + +description="This service start the warsaw core daemon for Banking Security." + +depend() { + need localmount syslog-ng + after bootmisc dbus +} + +checkconfig() { + if [ ! -f ${DAEMON} ]; then + eerror "The ${DAEMON} doesn't exists. Ensure {PACKAGE} is installed correctly." + return 1 + fi +} + +start() { + checkconfig || return 1 + + ebegin "Starting ${NAME} daemon from ${PACKAGE}" + /usr/local/bin/warsaw/wscertmgr + start-stop-daemon --start \ + --exec $DAEMON -- $DAEMON_OPTS + + eend $? +} + +stop() { + ebegin "Stopping ${NAME} daemon from ${PACKAGE}" + + start-stop-daemon --stop \ + --retry "TERM/${TIMEOUT}/KILL/5" \ + --exec ${DAEMON} -- ${DAEMON_OPTS} + + eend $? +} |