From 6f9143b4dc635b60ed8040828bfa96edf31bd288 Mon Sep 17 00:00:00 2001 From: Michael Wagner Date: Mon, 17 Dec 2018 18:27:57 +0100 Subject: [PATCH] posaune --- debian/sysd2sysv.cp | 3 +++ debian/sysd2sysv.postinst | 18 ++++++++++++++++++ doc/sysd2sysv.8 | 2 +- etc/.dummy | 0 sh/sysd2sysv | 3 ++- 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100755 debian/sysd2sysv.postinst create mode 100644 etc/.dummy diff --git a/debian/sysd2sysv.cp b/debian/sysd2sysv.cp index 314375c..4632c02 100755 --- a/debian/sysd2sysv.cp +++ b/debian/sysd2sysv.cp @@ -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 index 0000000..442c70f --- /dev/null +++ b/debian/sysd2sysv.postinst @@ -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 + diff --git a/doc/sysd2sysv.8 b/doc/sysd2sysv.8 index ab1a271..d7bb403 100644 --- a/doc/sysd2sysv.8 +++ b/doc/sysd2sysv.8 @@ -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 index 0000000..e69de29 diff --git a/sh/sysd2sysv b/sh/sysd2sysv index 061b462..5fd8335 100755 --- a/sh/sysd2sysv +++ b/sh/sysd2sysv @@ -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" ] -- 2.20.1