diff --git a/install.sh b/install.sh index 81bd813..aa99d1e 100755 --- a/install.sh +++ b/install.sh @@ -61,13 +61,13 @@ fi if [ -f /sbin/init ]; then if file /sbin/init | grep systemd > /dev/null; then - init=systemd + init="systemd" else - init=init + init="initV" fi else - echo "Can't detect init system." - exit 1 + echo "Can't detect initV or systemd. Service files won't be installed. You can still run $PROGRAM manually or via cron." + init=none fi if [ ! -d "$CONF_DIR" ]; then @@ -129,6 +129,7 @@ if [ -f "./ssh_filter.sh" ]; then fi fi + # OSYNC SPECIFIC if ([ "$init" == "systemd" ] && [ -f "./$OSYNC_SERVICE_FILE_SYSTEMD_SYSTEM" ]); then cp "./$OSYNC_SERVICE_FILE_SYSTEMD_SYSTEM" "$SERVICE_DIR_SYSTEMD_SYSTEM" && cp "./$OSYNC_SERVICE_FILE_SYSTEMD_USER" "$SERVICE_DIR_SYSTEMD_USER/$SERVICE_FILE_SYSTEMD_SYSTEM" @@ -140,7 +141,7 @@ if ([ "$init" == "systemd" ] && [ -f "./$OSYNC_SERVICE_FILE_SYSTEMD_SYSTEM" ]); echo "Can be enabled on boot with [systemctl enable osync-srv@instance.conf]." echo "In userland, active with [systemctl --user start osync-srv@instance.conf]." fi -elif [ -f "./$OSYNC_SERVICE_FILE_INIT" ]; then +elif ( "$init" == "initV" ] && [ -f "./$OSYNC_SERVICE_FILE_INIT" ]); then cp "./$OSYNC_SERVICE_FILE_INIT" "$SERVICE_DIR_INIT" if [ $? != 0 ]; then echo "Cannot copy osync-srv to [$SERVICE_DIR_INIT]." @@ -162,7 +163,7 @@ if ([ "$init" == "systemd" ] && [ -f "./$PMOCR_SERVICE_FILE_SYSTEMD_SYSTEM" ]); echo "Can be activated with [systemctl start pmocr-srv] after configuring file options in [$BIN_DIR/$PROGRAM]." echo "Can be enabled on boot with [systemctl enable pmocr-srv]." fi -elif [ -f "./$PMOCR_SERVICE_FILE_INIT" ]; then +elif ([ "$init" == "initV" ] && [ -f "./$PMOCR_SERVICE_FILE_INIT" ]); then cp "./$PMOCR_SERVICE_FILE_INIT" "$SERVICE_DIR_INIT" if [ $? != 0 ]; then echo "Cannot copy pmoct-srv to [$SERVICE_DIR_INIT]."