posaune
authorMichael Wagner <michael@wagnertech.de>
Mon, 17 Dec 2018 17:27:57 +0000 (18:27 +0100)
committerMichael Wagner <michael@wagnertech.de>
Mon, 17 Dec 2018 17:27:57 +0000 (18:27 +0100)
debian/sysd2sysv.cp
debian/sysd2sysv.postinst [new file with mode: 0755]
doc/sysd2sysv.8
etc/.dummy [new file with mode: 0644]
sh/sysd2sysv

index 314375c..4632c02 100755 (executable)
@@ -4,6 +4,9 @@ set -e
 mkdir -p $1/usr/bin/
 cp sh/sysd2sysv $1/usr/bin/
 
+mkdir -p $1/var/sysd2sysv
+cp etc/sysd2sysv.tpl $1/var/sysd2sysv/
+
 # copy man page
 mkdir -p $1/usr/share/man/man8
 gzip -c doc/sysd2sysv.8 >$1/usr/share/man/man8/sysd2sysv.8.gz
diff --git a/debian/sysd2sysv.postinst b/debian/sysd2sysv.postinst
new file mode 100755 (executable)
index 0000000..442c70f
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+set -e
+
+# delete init files created from template
+pushd /etc/init.d >/dev/null
+for file in $(ls)
+do
+       if grep "# sysd2sysv-template #" $file
+       then
+               rm $file
+       fi
+       # for downward compatibility
+       if [ -f mlistd ]
+       then
+               rm mlistd
+       fi
+done
+
index ab1a271..d7bb403 100644 (file)
@@ -9,7 +9,7 @@ COMMAND SERVICE
 .SH DESCRIPTION
 .PP
 sysd2sysv checks, if the service is present in /etc/init.d. If not
-it is expected to be in /etc/sysd2sysv and copied to /etc/init.d.
+it builds one from /etc/init.d/sysd2sysv.tpl.
 .PP
 Do not install in a Systemd environment!
 .SH AUTHOR
diff --git a/etc/.dummy b/etc/.dummy
new file mode 100644 (file)
index 0000000..e69de29
index 061b462..5fd8335 100755 (executable)
@@ -9,7 +9,8 @@ fi
 
 if [ ! -f /etc/init.d/$2 ]
 then
-       cp /etc/sysd2sysv/$2 /etc/init.d/
+       sed "s/%PROG%/$2/" /var/sysd2sysv/sysd2sysv.tpl > /etc/init.d/$2
+       chmod 755 /etc/init.d/$2
 fi
 
 if [ $1 = "enable" ]