Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=openjava.git;a=commitdiff;h=7972e150257177b05e26b4408cc8855570e31835
commit 7972e150257177b05e26b4408cc8855570e31835 Author: James Buren <r...@frugalware.org> Date: Wed Jun 6 05:03:04 2012 -0500 sabnzbd-0.6.15-2-x86_64 * convert to use systemd schema diff --git a/source/network-extra/sabnzbd/FrugalBuild b/source/network-extra/sabnzbd/FrugalBuild index fc5894a..3bf4919 100644 --- a/source/network-extra/sabnzbd/FrugalBuild +++ b/source/network-extra/sabnzbd/FrugalBuild @@ -3,7 +3,7 @@ pkgname=sabnzbd pkgver=0.6.15 -pkgrel=1 +pkgrel=2 pkgdesc="A web-interface based binary newsgrabber with NZB file support" url="http://mookooh.org/coverfinder/" depends=('par2cmdline' 'python-cheetah' 'feedparser' 'python-yenc' 'pyopenssl' \ @@ -25,6 +25,10 @@ sha1sums=('e6d64ec35e837fe634d6e45234ec64c49cbb7e3b' \ '82b87a3e662940e83f797ce824082fffd94771f6') replaces=('hellanzb') +_F_systemd_scriptlet="$pkgname.install" +_F_systemd_units=(sabnzbd=) +Finclude systemd + _F_desktop_name="SABnzbd+" _F_desktop_desc="Binary Newsreader" _F_desktop_icon="sab2_64.png" @@ -48,4 +52,5 @@ build() { Ficon sab2_64.png Fexe addnzb.sh usr/share/$pkgname/addnzb.sh Finstall 770 x-nzb.xml usr/share/$pkgname/x-nzb.xml + Fgenscriptlet } diff --git a/source/network-extra/sabnzbd/sabnzbd.install b/source/network-extra/sabnzbd/sabnzbd.install index 8fcad77..701bbcc 100644 --- a/source/network-extra/sabnzbd/sabnzbd.install +++ b/source/network-extra/sabnzbd/sabnzbd.install @@ -1,8 +1,11 @@ -## arg 1: the new package version -post_install() { +sysvinit_units=(@_F_sysvinit_units@) +systemd_units=(@_F_systemd_units@) + +post_install() +{ # add x-nzb mimetype xdg-mime install --mode system /usr/share/sabnzbd/x-nzb.xml - xdg-icon-resource install --context mimetypes --size 64 /usr/share/sabnzbd/nzb-2.png application-x-nzb + xdg-icon-resource install --context mimetypes --size 64 /usr/share/pixmaps/nzb-2.png application-x-nzb groupadd sabnzbd &> /dev/null useradd -g sabnzbd -d /usr/share/sabnzbd -s /bin/false sabnzbd &> /dev/null @@ -12,14 +15,61 @@ post_install() { echo " >> " echo " >> If you want to associate .nzb-files with SABnzbd, run 'xdg-mime default sabnzbd.desktop applications/x-nzb'" + local unit + local op + + for i in ${sysvinit_units[@]}; do + chkconfig --del rc.$i >/dev/null 2>&1 + done + + for i in ${systemd_units[@]}; do + unit=$(echo $i | cut -f 1 -d '=') + op=$(echo $i | cut -f 2 -d '=') + if echo $op | grep -q 'e'; then + systemctl enable $unit.service >/dev/null 2>&1 + fi + if echo $op | grep -q 's'; then + systemctl start $unit.service >/dev/null 2>&1 + fi + done } -## arg 1: the new package version -## arg 2: the old package version -post_upgrade() { + +post_upgrade() +{ chown -R sabnzbd:sabnzbd /usr/share/sabnzbd + + for i in ${sysvinit_units[@]}; do + chkconfig --del rc.$i >/dev/null 2>&1 + done + + systemctl daemon-reload >/dev/null 2>&1 } -## arg 1: the old package version -pre_remove() { +pre_remove() +{ + xdg-mime uninstall --mode system /usr/share/sabnzbd/x-nzb.xml + xdg-icon-resource uninstall --context mimetypes --size 64 /usr/share/pixmaps/nzb-2.png application-x-nzb + userdel sabnzbd &> /dev/null -} + + local unit + + for i in ${sysvinit_units[@]}; do + chkconfig --del rc.$i >/dev/null 2>&1 + done + + for i in ${systemd_units[@]}; do + unit=$(echo $i | cut -f 1 -d '=') + systemctl --no-reload disable $unit.service >/dev/null 2>&1 + systemctl stop $unit.service >/dev/null 2>&1 + done +} + +post_remove() +{ + systemctl daemon-reload >/dev/null 2>&1 +} + +op=$1 +shift +$op $* _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git