summaryrefslogtreecommitdiffstats
path: root/samhain-install.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'samhain-install.sh.in')
-rw-r--r--samhain-install.sh.in87
1 files changed, 83 insertions, 4 deletions
diff --git a/samhain-install.sh.in b/samhain-install.sh.in
index 195dfe1..fa7b1a9 100644
--- a/samhain-install.sh.in
+++ b/samhain-install.sh.in
@@ -892,7 +892,7 @@ then
rc_main=/etc/init.d
rc_dirz=
rc_inst="/usr/lib/lsb/install_initd /etc/init.d/@install_name@"
- rc_uinst="/usr/lib/lsb/remove_initd /etc/init.d/@install_name@"
+ rc_uinst="test -f /etc/init.d/@install_name@ && /usr/lib/lsb/remove_initd /etc/init.d/@install_name@"
else
rc_inst=
rc_uinst=
@@ -1031,6 +1031,15 @@ then
exit 1
fi
+ rc_systemd=
+ if command -v pkg-config >/dev/null 2>&1
+ then
+ if pkg-config --exists systemd >/dev/null 2>&1
+ then
+ rc_systemd=`pkg-config --variable=systemdsystemunitdir systemd`
+ fi
+ fi
+
if test x"${act}" = xboot
then
@@ -1105,6 +1114,33 @@ then
eval ${rc_inst}
fi
fi
+
+ if test x"${rc_systemd}" != x
+ then
+ if test x"$DESTDIR" = x
+ then
+ :
+ else
+ ${mkinstalldirs} ${DESTDIR}/${rc_systemd}
+ fi
+ if test -f init/samhain.startSystemd
+ then
+ servicescript=init/samhain.startSystemd
+ elif test -f samhain.startSystemd
+ then
+ servicescript=samhain.startSystemd
+ else
+ echo "${0}: cannot find samhain.startSystemd in ./ or ./init"
+ fi
+ if test -f ${DESTDIR}/${rc_systemd}/${samhain}.service && test x"$force" != xyes
+ then
+ echo " ${DESTDIR}/${rc_systemd}/${samhain}.service exists ... not overwritten (or use --force)"
+ else
+ test -z "$verbose" || echo " installing ${servicescript} as ${DESTDIR}/${rc_systemd}/${samhain}.service"
+ ${INSTALL_DATA} ${servicescript} "${DESTDIR}/${rc_systemd}/${samhain}.service"
+ fi
+ fi
+
echo "installing init scripts completed"
fi
@@ -1122,14 +1158,20 @@ then
for ff in $rlv
do
test -z "$verbose" || echo " rm -f ${rc_dirz}${ff}.d/S99${samhain}"
- rm -f ${rc_dirz}${ff}.d/S99${samhain}
+ rm -f "${rc_dirz}${ff}.d/S99${samhain}"
test -z "$verbose" || echo " rm -f ${rc_dirz}${ff}.d/S99${samhain}"
- rm -f ${rc_dirz}${ff}.d/K10${samhain}
+ rm -f "${rc_dirz}${ff}.d/K10${samhain}"
done
fi
test -z "$verbose" || echo " rm -f ${rc_main}/${samhain}"
- rm -f ${rc_main}/${samhain}
+ rm -f "${rc_main}/${samhain}"
+
+ if test x"${rc_systemd}" != x
+ then
+ test -z "$verbose" || echo " rm -f ${rc_systemd}/${samhain}.service"
+ rm -f "${rc_systemd}/${samhain}.service"
+ fi
echo " uninstalling init scripts completed"
fi
@@ -1297,6 +1339,7 @@ then
CONVERT=
GPGPATH=@mygpg@
+ SIGNIFY_PATH=@mysignify@
TARGETKEYID=@mykeyid@
KEYTAG=@mykeytag@
@@ -1374,6 +1417,42 @@ then
echo "**********************************************************"
cp ${RCFILE} samhainrc.pre
fi
+ elif test x"${SIGNIFY_PATH}" != x
+ then
+ echo
+ echo "You need to sign the config file now"
+ echo
+ test -z "$verbose" || echo " ${SIGNIFY_PATH} -Se -s ~/.signify/samhain.sec -m $RCFILE"
+ if test x"${NTEST}" = "x-DSH_WITH_SERVER"
+ then
+ myident_uid=`(cat /etc/passwd; ypcat passwd) 2>/dev/null |\
+ grep "^${samhain}:" | awk -F: '{ print $3; }'`
+ if test x"${myident_uid}" != x
+ then
+ DOT_SIGNIFY=`eval echo ~${samhain}/.signify`
+ test -z "$verbose" || echo " using home directory ${DOT_SIGNIFY}"
+ ${SIGNIFY_PATH} -Se -s ${DOT_GNUPG}/samhain.sec $RCFILE
+ else
+ ${SIGNIFY_PATH} -Se -s ~/.signify/samhain.sec -m $RCFILE
+ fi
+ else
+ ${SIGNIFY_PATH} -Se -s ~/.signify/samhain.sec -m $RCFILE
+ fi
+
+ if test -f ${RCFILE}.sig
+ then
+ test -z "$verbose" || echo " mv -f ${RCFILE}.sig samhainrc.pre"
+ mv -f ${RCFILE}.sig samhainrc.pre
+ else
+ echo "**********************************************************"
+ echo
+ echo "${0}: ERROR: cannot find signed file ${RCFILE}.sig"
+ echo
+ echo " --- You need to sign the configuration file ---"
+ echo
+ echo "**********************************************************"
+ cp ${RCFILE} samhainrc.pre
+ fi
else
test -z "$verbose" || echo " cp $RCFILE samhainrc.pre"
cp $RCFILE samhainrc.pre