[Frugalware-git] frugalware-current: scratchbox-1.0.17-1-x86_64 * initial systemd draft (unable to test it right now)
James Buren
ryuo at frugalware.org
Tue Jun 12 11:27:29 CEST 2012
Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=e0be3060cd305e466d5d0571723e484539f2bde4
commit e0be3060cd305e466d5d0571723e484539f2bde4
Author: James Buren <ryuo at frugalware.org>
Date: Thu Jun 7 03:39:17 2012 -0500
scratchbox-1.0.17-1-x86_64
* initial systemd draft (unable to test it right now)
diff --git a/source/devel-extra/scratchbox/FrugalBuild b/source/devel-extra/scratchbox/FrugalBuild
index bc1ad1a..fb3e2c3 100644
--- a/source/devel-extra/scratchbox/FrugalBuild
+++ b/source/devel-extra/scratchbox/FrugalBuild
@@ -12,12 +12,18 @@ archs=('i686' '!x86_64')
up2date="lynx -dump http://scratchbox.org/download/files/sbox-releases/apophis/src/|Flasttar"
source=(http://scratchbox.org/download/files/sbox-releases/apophis/tarball/scratchbox-core-$pkgver-i386.tar.gz \
http://scratchbox.org/download/files/sbox-releases/apophis/tarball/scratchbox-libs-$pkgver-i386.tar.gz \
- README.Frugalware rc.scratchbox)
+ README.Frugalware rc.$pkgname $pkgname.service)
sha1sums=('4adbf025a29ee3d467e36a9801e1ae548bd1782b' \
'53c4eff97cdcca9a2c591f023796c59d3673b8ab' \
- 'c08ba6dc88526fe55cf0958f0b81b4dc3270c55e' \
- '7f17d4a73c673e58d736f3363ae732c63870d301')
+ 'a0086f8313df94ea766d86c9e983d05b02f023b7' \
+ '7f17d4a73c673e58d736f3363ae732c63870d301' \
+ '8fbdc00f075f1a6b9fe513a54c6fb6355757bd7c')
+_F_cd_path='.'
options=('nostrip') # why wasting our time with this if it's already done?
+_F_systemd_scriptlet="$pkgname.install"
+_F_sysvinit_units=($pkgname)
+_F_systemd_units=($pkgname=)
+Finclude systemd
build()
{
@@ -29,4 +35,6 @@ build()
# no Frcd2 here as no i18n
Fexe /etc/rc.d/rc.scratchbox
Fdoc README.Frugalware
+ Ffile /lib/systemd/system/$pkgname.service
+ Fgenscriptlet
}
diff --git a/source/devel-extra/scratchbox/README.Frugalware b/source/devel-extra/scratchbox/README.Frugalware
index 18b63ee..f0f07c0 100644
--- a/source/devel-extra/scratchbox/README.Frugalware
+++ b/source/devel-extra/scratchbox/README.Frugalware
@@ -17,13 +17,13 @@ http://www.scratchbox.org/documentation/user[scratchbox documentation].
Also note that when you reboot and before trying to run scratchbox, you should run:
--------------------------
-# service scratchbox start
+# systemctl start scratchbox.service
--------------------------
You can also add it to the default runlevel:
------------------------
-# service scratchbox add
+# systemctl enable scratchbox.service
------------------------
Then to start scratchbox, run:
diff --git a/source/devel-extra/scratchbox/scratchbox.install b/source/devel-extra/scratchbox/scratchbox.install
index ee89f04..20cb6f1 100644
--- a/source/devel-extra/scratchbox/scratchbox.install
+++ b/source/devel-extra/scratchbox/scratchbox.install
@@ -1,21 +1,66 @@
+sysvinit_units=(@_F_sysvinit_units@)
+systemd_units=(@_F_systemd_units@)
+
post_install()
{
if ! grep -q '^sbox:' /etc/group ; then
groupadd -g 35 sbox
fi
+
+ 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
}
post_upgrade()
{
- post_install
+ if ! grep -q '^sbox:' /etc/group ; then
+ groupadd -g 35 sbox
+ fi
+
+ for i in ${sysvinit_units[@]}; do
+ chkconfig --del rc.$i >/dev/null 2>&1
+ done
+
+ systemctl daemon-reload >/dev/null 2>&1
}
pre_remove()
{
groupdel sbox
+
+ 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 $*
diff --git a/source/devel-extra/scratchbox/scratchbox.service b/source/devel-extra/scratchbox/scratchbox.service
new file mode 100644
index 0000000..253e1b0
--- /dev/null
+++ b/source/devel-extra/scratchbox/scratchbox.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Scratchbox
+After=syslog.target
+
+[Service]
+ExecStart=/usr/lib/scratchbox/sbin/sbox_ctl start
+ExecStop=/usr/lib/scratchbox/sbin/sbox_ctl stop
+Type=oneshot
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
More information about the Frugalware-git
mailing list