Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=0d42d160a296a3d7c3b8896732f92b21b709ea4d

commit 0d42d160a296a3d7c3b8896732f92b21b709ea4d
Author: James Buren <[email protected]>
Date:   Fri Jul 27 04:06:39 2012 -0500

prosody-0.8.2-3-x86_64
* convert to systemd schema

diff --git a/source/network-extra/prosody/FrugalBuild 
b/source/network-extra/prosody/FrugalBuild
index 5a2191e..6bb8d9d 100644
--- a/source/network-extra/prosody/FrugalBuild
+++ b/source/network-extra/prosody/FrugalBuild
@@ -3,7 +3,7 @@

pkgname=prosody
pkgver=0.8.2
-pkgrel=2
+pkgrel=3
pkgdesc="Prosody is a light and fast XMPP server."
url="http://prosody.im/";
depends=('luafilesystem' 'luaexpat' 'luasec>=0.4.1' 'luaevent-prosody')
@@ -11,19 +11,34 @@ groups=('network-extra')
archs=('i686' 'x86_64')
up2date="Flasttar $url/downloads/source/"
source=($url/downloads/source/$pkgname-$pkgver.tar.gz \
-        'prosody.cfg.lua' \
-        'rc.prosody' \
-        'README.Frugalware')
+       'prosody.cfg.lua' \
+       'rc.prosody' \
+       'prosody.service' \
+       'README.Frugalware')

sha1sums=('a029c4e69f6daaf3320061e69c9f86390d7e845a' \
-          'a37af7c6c5cedf140e75bbb2ffd9a050680b1aba' \
+          'e9cd2936c4fdc48e5b49a2636ae3fd94cdf7f059' \
'4f4d16fa1e5d8132a373fdf1c85a2bcdba343ddf' \
+          'e0da7512435a682720d49f6662bd58e95eb7b997' \
'1000770125e04b0eb8daab83fed9ad136ae16fed')

+_F_systemd_scriptlet="prosody2.install"
+_F_sysvinit_units=(prosody)
+_F_systemd_units=(prosody=)
+Finclude systemd
+
backup=(etc/prosody.cfg.lua)

build()
{
-    Fbuild
-    Fcp prosody.cfg.lua etc/
+       Fbuild
+       Ffile /etc/prosody.cfg.lua
+       Fdirschown /var/lib/prosody 54 54
+       Fdirschmod /var/lib/prosody 0770
+       Fmkdir /etc/tmpfiles.d
+        cat > $Fdestdir/etc/tmpfiles.d/prosody.conf << EOF
+d /var/run/prosody 0770 prosody prosody -
+EOF
+       Ffile /lib/systemd/system/prosody.service
+       Fgenscriptlet
}
diff --git a/source/network-extra/prosody/prosody.cfg.lua 
b/source/network-extra/prosody/prosody.cfg.lua
index 577e327..dff419a 100644
--- a/source/network-extra/prosody/prosody.cfg.lua
+++ b/source/network-extra/prosody/prosody.cfg.lua
@@ -54,7 +54,7 @@ modules_enabled = {
"register"; -- Allow users to register on this server using a client and change 
passwords

-- Other specific functionality
-               --"posix"; -- POSIX functionality, sends server to background, 
enables syslog, etc.
+               "posix"; -- POSIX functionality, sends server to background, 
enables syslog, etc.
--"console"; -- Opens admin telnet interface on localhost port 5582
--"bosh"; -- Enable BOSH clients, aka "Jabber over HTTP"
--"httpserver"; -- Serve static files from a directory over HTTP
@@ -74,7 +74,7 @@ modules_disabled = {
};

-- Do not change these five lines, they are used by the prosody's startup 
script {
-pidfile = "/var/run/prosody.pid"
+pidfile = "/var/run/prosody/prosody.pid"
setuid = 54
setgid = 54
umask = "007"
diff --git a/source/network-extra/prosody/prosody.install 
b/source/network-extra/prosody/prosody.install
deleted file mode 100644
index 6cbaa68..0000000
--- a/source/network-extra/prosody/prosody.install
+++ /dev/null
@@ -1,32 +0,0 @@
-post_install()
-{
-        if ! grep -q 'prosody' /etc/group; then
-            #create group
-            /usr/sbin/groupadd -g 54 prosody 2>/dev/null
-        fi
-
-        if ! grep -q 'prosody' /etc/shadow; then
-            #create user
-            /usr/sbin/useradd -s /bin/false -c "daemon system user prosody" -d 
/var/lib/prosody -u 54 -g prosody prosody 2>/dev/null
-        fi
-
-        # Fix permissions
-        chown -R prosody:prosody /var/lib/prosody
-        chmod -R 770 /var/lib/prosody
-        rm -f /var/run/prosody.pid
-}
-
-post_upgrade()
-{
-    post_install
-}
-
-pre_remove()
-{
-    service prosody stop
-    service prosody del
-}
-
-op=$1
-shift
-$op $*
diff --git a/source/network-extra/prosody/prosody.service 
b/source/network-extra/prosody/prosody.service
new file mode 100644
index 0000000..5e576a7
--- /dev/null
+++ b/source/network-extra/prosody/prosody.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Prosody XMPP Server
+After=network.target
+
+[Service]
+PIDFile=/var/run/prosody/prosody.pid
+ExecStart=/usr/bin/prosodyctl start
+ExecStop=/usr/bin/prosodyctl stop
+Type=forking
+
+[Install]
+WantedBy=multi-user.target
diff --git a/source/network-extra/prosody/prosody2.install 
b/source/network-extra/prosody/prosody2.install
new file mode 100644
index 0000000..41db5ad
--- /dev/null
+++ b/source/network-extra/prosody/prosody2.install
@@ -0,0 +1,79 @@
+sysvinit_units=(@_F_sysvinit_units@)
+systemd_units=(@_F_systemd_units@)
+
+post_install()
+{
+        if ! grep -q 'prosody' /etc/group; then
+            #create group
+            /usr/sbin/groupadd -g 54 prosody 2>/dev/null
+        fi
+
+        if ! grep -q 'prosody' /etc/shadow; then
+            #create user
+            /usr/sbin/useradd -s /bin/false -c "daemon system user prosody" -d 
/var/lib/prosody -u 54 -g prosody prosody 2>/dev/null
+        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()
+{
+        if ! grep -q 'prosody' /etc/group; then
+            #create group
+            /usr/sbin/groupadd -g 54 prosody 2>/dev/null
+        fi
+
+        if ! grep -q 'prosody' /etc/shadow; then
+            #create user
+            /usr/sbin/useradd -s /bin/false -c "daemon system user prosody" -d 
/var/lib/prosody -u 54 -g prosody prosody 2>/dev/null
+        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()
+{
+       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()
+{
+       /usr/sbin/userdel prosody
+       /usr/sbin/groupdel prosody
+
+       systemctl daemon-reload >/dev/null 2>&1
+}
+
+op=$1
+shift
+$op $*
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to