]> granicus.if.org Git - fcron/commitdiff
startup script removes fcron.reboot (in case the OS doesn't do it)
authorThibault Godouet <fcron@free.fr>
Tue, 27 Nov 2012 00:12:40 +0000 (00:12 +0000)
committerThibault Godouet <fcron@free.fr>
Tue, 27 Nov 2012 00:28:31 +0000 (00:28 +0000)
Makefile.in
script/.gitignore [new file with mode: 0644]
script/boot-install
script/fcron.init.suse.in [moved from script/fcron.init.suse with 93% similarity]
script/fcron.sh [deleted file]
script/fcron.sh.in [new file with mode: 0755]
script/sysVinit-launcher.in [moved from script/sysVinit-launcher with 90% similarity]

index 5a927ef64cff3b3fc373b1440e11bc83482cca31..6390990069620a4b7c28b7a12bdcf8c7cd4eee83 100644 (file)
@@ -129,6 +129,10 @@ exe_list_test: exe_list.o u_list.o exe_list_test.o log.o subs.o
 
 install: install-staged strip perms
 ifeq ($(BOOTINSTALL), 1)
+       if test ! -d script; then mkdir script ; fi
+        for F in sysVinit-launcher fcron.sh fcron.init.suse ; do \
+           $(SRCDIR)/script/gen-in.pl $(SRCDIR)/script/$${F}.in script/$${F} ./ ; \
+        done
        $(SRCDIR)/script/boot-install "$(INSTALL) -o $(ROOTNAME)" $(DESTSBIN) $(DEBUG) $(FCRONTABS) $(ANSWERALL) $(SRCDIR)
 endif
 
@@ -227,6 +231,10 @@ ifeq ($(FCRONDYN), 1)
 endif
 
 install-boot: install
+       if test ! -d script; then mkdir script ; fi
+       for F in sysVinit-launcher fcron.sh fcron.init.suse ; do \
+           $(SRCDIR)/script/gen-in.pl $(SRCDIR)/script/$${F}.in script/$${F} ./ ; \
+        done
        $(SRCDIR)/script/boot-install "$(INSTALL) -o $(ROOTNAME)" $(DESTSBIN) $(DEBUG) $(FCRONTABS)  $(ANSWERALL) $(SRCDIR)
 
 install-restart: install
@@ -253,7 +261,8 @@ ciclean: clean
        rm -fR autom4te*
 
 vclean: ciclean
-       rm -f config.log config.status config.h config.cache Makefile PREVIOUS_VERSION
+       rm -f config.log config.status config.h config.cache Makefile PREVIOUS_VERSION \
+            files/fcron.conf script/fcron.init.suse script/fcron.sh script/sysVinit-launcher
        make -C doc clean
 
 
diff --git a/script/.gitignore b/script/.gitignore
new file mode 100644 (file)
index 0000000..f0ef23b
--- /dev/null
@@ -0,0 +1,4 @@
+# Auto-generated files:
+fcron.sh
+sysVinit-launcher
+fcron.init.suse
index 3aa4a7135314a84d11aae78caa48ab63b49ddb4a..ca0c65862de7e3d664ea1cc9cbcd8b375d1f32ce 100755 (executable)
@@ -122,13 +122,11 @@ if test $IS_FREEBSD -eq 1; then
       INSTALL="n"
     fi
     if test \( -z "$INSTALL" \) -o \( "$INSTALL" = "y" \); then
-      cp -f $SRCDIR/script/fcron.sh /usr/local/etc/rc.d/
+      cp -f script/fcron.sh /usr/local/etc/rc.d/
       if test $DEBUG -eq 1; then
         cat /usr/local/etc/rc.d/fcron.sh | sed 's: -b: -b -d:' > /usr/local/etc/rc.d/fcron.sh2
         mv -f /usr/local/etc/rc.d/fcron.sh2 /usr/local/etc/rc.d/fcron.sh
       fi
-      cat /usr/local/etc/rc.d/fcron.sh | sed "s:@@DESTSBIN@:$DESTBIN:" > /usr/local/etc/rc.d/fcron.sh2
-      mv -f /usr/local/etc/rc.d/fcron.sh2 /usr/local/etc/rc.d/fcron.sh
       chmod +x /usr/local/etc/rc.d/fcron.sh
       INSTALLED=1
     else
@@ -161,14 +159,12 @@ if test \( ! "$INSTALLED" -eq 1 \) -a \( "$ROOTDIR" != "" \); then
     INSTALL="n"
   fi
   if test \( -z "$INSTALL" \) -o \( "$INSTALL" = "y" \); then
-    $INSPROG -c -m 755 $SRCDIR/script/sysVinit-launcher $ROOTDIR/init.d/fcron
+    $INSPROG -c -m 755 script/sysVinit-launcher $ROOTDIR/init.d/fcron
     if test $DEBUG -eq 1; then
       cat $ROOTDIR/init.d/fcron | sed 's: -b: -b -d:' >$ROOTDIR/init.d/fcron2
       mv -f $ROOTDIR/init.d/fcron2 $ROOTDIR/init.d/fcron
       chmod +x $ROOTDIR/init.d/fcron
     fi
-    cat $ROOTDIR/init.d/fcron | sed "s:@@DESTSBIN@:$DESTBIN:" >$ROOTDIR/init.d/fcron2
-    mv -f $ROOTDIR/init.d/fcron2 $ROOTDIR/init.d/fcron
     chmod +x $ROOTDIR/init.d/fcron
 
     for j in 2 3 4 5
similarity index 93%
rename from script/fcron.init.suse
rename to script/fcron.init.suse.in
index a493352dc2f41e93f5a4210717ecaae99731808b..dad96c73341e6940b920ae80f7113964f1572209 100644 (file)
@@ -17,6 +17,7 @@ DAEMON_PIDFILE="/var/run/fcron.pid"
 #DAEMON_OPT=""
 DAEMON_USER="root"
 SUPPORTS_HUP="yes"
+REBOOT_LOCK=@@REBOOT_LOCK@
 
 pid_par=${DAEMON_PIDFILE:+"-p $DAEMON_PIDFILE"}
 usr_par=${DAEMON_USER:+"-u $DAEMON_USER"}
@@ -78,6 +79,12 @@ case "$1" in
                echo -n " Warning: daemon not running. "
                killproc $pid_par -t 10 ${DAEMON_BIN}
                rc_status -v
+               if test \( "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "6" \) \
+                       -a -f "$REBOOT_LOCK" ; then
+                       # Make sure the lock file is deleted on reboot/shutdown
+                       # in case the OS doesn't do it itself
+                       rm -f "$REBOOT_LOCK"
+               fi
                ;;
        try-restart|condrestart)
                if test "$1" = "condrestart"; then
diff --git a/script/fcron.sh b/script/fcron.sh
deleted file mode 100755 (executable)
index 1f994a9..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-# Start fcron at boot time under FreeBSD
-
-SBIN=@@DESTSBIN@
-
-case "$1" in
-  start)
-    $SBIN/fcron -b && echo -n " fcron"
-    ;;
-  stop)
-    killall -TERM fcron
-    ;;
-  *)
-    echo "Usage: fcron start|stop"
-    exit 1
-    ;;
-esac
\ No newline at end of file
diff --git a/script/fcron.sh.in b/script/fcron.sh.in
new file mode 100755 (executable)
index 0000000..09fbd85
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# Start fcron at boot time under FreeBSD
+
+SBIN=@@DESTSBIN@
+REBOOT_LOCK=@@REBOOT_LOCK@
+
+case "$1" in
+  start)
+    $SBIN/fcron -b && echo -n " fcron"
+    ;;
+  stop)
+    killall -TERM fcron
+    if test \( "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "6" \) \
+        -a -f "$REBOOT_LOCK" ; then
+      # Make sure the lock file is deleted on reboot/shutdown
+      # in case the OS doesn't do it itself
+      rm -f "$REBOOT_LOCK"
+    fi
+    ;;
+  *)
+    echo "Usage: fcron start|stop"
+    exit 1
+    ;;
+esac
similarity index 90%
rename from script/sysVinit-launcher
rename to script/sysVinit-launcher.in
index 3e96f7cbd5d3f441255c2a6f1d6c77a64f16ca5f..c66027d82a63d1687a312bf757c0ff466da692b9 100755 (executable)
@@ -24,6 +24,7 @@ export PATH="/sbin:/usr/sbin:/bin:/usr/bin"
 
 FUNCTION=0
 SBIN=@@DESTSBIN@
+REBOOT_LOCK=@@REBOOT_LOCK@
 
 EXEC="$SBIN/fcron"
 
@@ -77,6 +78,13 @@ case "$1" in
        if test -d /var/lock/subsys/; then
            [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/fcron
        fi
+       if test \( "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "6" \) \
+           -a -f "$REBOOT_LOCK" ; then
+           # Make sure the lock file is deleted on reboot/shutdown
+           # in case the OS doesn't do it itself
+           rm -f "$REBOOT_LOCK"
+       fi
+
        $FINALECHO
        ;;
   status)