watchdog: Added first version of watchdog addon
authorDirk Wagner <glotzi@ipfire.org>
Fri, 30 Oct 2009 19:09:55 +0000 (20:09 +0100)
committerDirk Wagner <glotzi@ipfire.org>
Fri, 30 Oct 2009 19:09:55 +0000 (20:09 +0100)
config/backup/includes/watchdog [new file with mode: 0644]
config/rootfiles/packages/watchdog [new file with mode: 0644]
lfs/watchdog [new file with mode: 0644]
make.sh
src/initscripts/init.d/watchdog [new file with mode: 0755]
src/paks/watchdog/install.sh [new file with mode: 0644]
src/paks/watchdog/uninstall.sh [new file with mode: 0644]
src/paks/watchdog/update.sh [new file with mode: 0644]

diff --git a/config/backup/includes/watchdog b/config/backup/includes/watchdog
new file mode 100644 (file)
index 0000000..a708771
--- /dev/null
@@ -0,0 +1 @@
+etc/watchdog.conf
diff --git a/config/rootfiles/packages/watchdog b/config/rootfiles/packages/watchdog
new file mode 100644 (file)
index 0000000..0805b73
--- /dev/null
@@ -0,0 +1,5 @@
+var/ipfire/backup/addons/includes/watchdog
+etc/rc.d/init.d/watchdog
+etc/watchdog.conf
+usr/sbin/watchdog
+usr/sbin/wd_keepalive
\ No newline at end of file
diff --git a/lfs/watchdog b/lfs/watchdog
new file mode 100644 (file)
index 0000000..c8b0b45
--- /dev/null
@@ -0,0 +1,86 @@
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2009  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+VER        = 5.6
+
+THISAPP    = watchdog-$(VER)
+DL_FILE    = $(THISAPP).tar.gz
+DL_FROM    = $(URL_IPFIRE)
+DIR_APP    = $(DIR_SRC)/$(THISAPP)
+TARGET     = $(DIR_INFO)/$(THISAPP)
+PROG       = watchdog
+PAK_VER    = 1
+
+DEPS       = ""
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+objects = $(DL_FILE)
+
+$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+
+$(DL_FILE)_MD5 = 6df285569dd1d85528b983c98c9b2b7c
+
+install : $(TARGET)
+
+check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+
+download :$(patsubst %,$(DIR_DL)/%,$(objects))
+
+md5 : $(subst %,%_MD5,$(objects))
+
+dist: 
+       @$(PAK)
+
+###############################################################################
+# Downloading, checking, md5sum
+###############################################################################
+
+$(patsubst %,$(DIR_CHK)/%,$(objects)) :
+       @$(CHECK)
+
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
+       @$(LOAD)
+
+$(subst %,%_MD5,$(objects)) :
+       @$(MD5)
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+       @$(PREBUILD)
+       @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+       cd $(DIR_APP) && ./configure
+       cd $(DIR_APP) && make $(MAKETUNING)
+       cd $(DIR_APP) && make install
+       install -v -m 644 $(DIR_SRC)/config/backup/includes/watchdog \
+                        /var/ipfire/backup/addons/includes/watchdog 
+       @rm -rf $(DIR_APP)
+       @$(POSTBUILD)
diff --git a/make.sh b/make.sh
index 89ef361..af17848 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -632,6 +632,7 @@ buildipfire() {
   ipfiremake motion
   ipfiremake joe
   ipfiremake nut
+  ipfiremake watchdog
   echo Build on $HOSTNAME > $BASEDIR/build/var/ipfire/firebuild
   cat /proc/version >> $BASEDIR/build/var/ipfire/firebuild
   echo >> $BASEDIR/build/var/ipfire/firebuild
diff --git a/src/initscripts/init.d/watchdog b/src/initscripts/init.d/watchdog
new file mode 100755 (executable)
index 0000000..6d15775
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+test -x /usr/sbin/watchdog || exit 0
+
+# For configuration of the init script use the file
+# /etc/sysconfig/watchdog, do not edit this init script.
+
+# Set run_watchdog to 1 to start watchdog or 0 to disable it.
+run_watchdog=0
+
+# Specify additional watchdog options here (see manpage).
+watchdog_options=""
+
+# Specify module to load
+watchdog_module="none"
+
+[ -e /etc/sysconfig/watchdog ] && . /etc/sysconfig/watchdog
+
+DAEMON=/usr/sbin/watchdog
+WD_DAEMON=/usr/sbin/wd_keepalive
+
+case "${1}" in
+       start)
+               boot_mesg "Starting watchdog ..."
+               if [ $run_watchdog = 1 ]
+               then
+                       # do we have to load a module?
+                       [ ${watchdog_module:-none} != "none" ] && /sbin/modprobe $watchdog_module
+
+                       loadproc $DAEMON $watchdog_options
+               fi
+               ;;
+
+       stop)
+               boot_mesg "Stopping watchdog ..."
+               killproc $DAEMON
+               ;;
+
+       restart)
+               ${0} stop
+               sleep 1
+               ${0} start
+               ;;
+
+       status)
+               statusproc $DAEMON
+               ;;
+
+       *)
+               echo "Usage: ${0} {start|stop|restart|status}"
+               exit 1
+               ;;
+esac
+
diff --git a/src/paks/watchdog/install.sh b/src/paks/watchdog/install.sh
new file mode 100644 (file)
index 0000000..0f9e0ca
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+############################################################################
+#                                                                          #
+# This file is part of the IPFire Firewall.                                #
+#                                                                          #
+# IPFire is free software; you can redistribute it and/or modify           #
+# it under the terms of the GNU General Public License as published by     #
+# the Free Software Foundation; either version 2 of the License, or        #
+# (at your option) any later version.                                      #
+#                                                                          #
+# IPFire is distributed in the hope that it will be useful,                #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
+# GNU General Public License for more details.                             #
+#                                                                          #
+# You should have received a copy of the GNU General Public License        #
+# along with IPFire; if not, write to the Free Software                    #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
+#                                                                          #
+# Copyright (C) 2007 IPFire-Team <info@ipfire.org>.                        #
+#                                                                          #
+############################################################################
+#
+. /opt/pakfire/lib/functions.sh
+extract_files
+restore_backup ${NAME}
+
+ln -svf  ../init.d/watchdog /etc/rc.d/rc0.d/K80watchdog
+ln -svf  ../init.d/watchdog /etc/rc.d/rc3.d/S10watchdog
+ln -svf  ../init.d/watchdog /etc/rc.d/rc6.d/K80watchdog
+
+start_service --background ${NAME}
diff --git a/src/paks/watchdog/uninstall.sh b/src/paks/watchdog/uninstall.sh
new file mode 100644 (file)
index 0000000..41ec270
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+############################################################################
+#                                                                          #
+# This file is part of the IPFire Firewall.                                #
+#                                                                          #
+# IPFire is free software; you can redistribute it and/or modify           #
+# it under the terms of the GNU General Public License as published by     #
+# the Free Software Foundation; either version 2 of the License, or        #
+# (at your option) any later version.                                      #
+#                                                                          #
+# IPFire is distributed in the hope that it will be useful,                #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
+# GNU General Public License for more details.                             #
+#                                                                          #
+# You should have received a copy of the GNU General Public License        #
+# along with IPFire; if not, write to the Free Software                    #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
+#                                                                          #
+# Copyright (C) 2007 IPFire-Team <info@ipfire.org>.                        #
+#                                                                          #
+############################################################################
+#
+. /opt/pakfire/lib/functions.sh
+stop_service ${NAME}
+make_backup ${NAME}
+remove_files
+
+rm -rf /etc/rc.d/rc*.d/*watchdog
diff --git a/src/paks/watchdog/update.sh b/src/paks/watchdog/update.sh
new file mode 100644 (file)
index 0000000..89c40d0
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash
+############################################################################
+#                                                                          #
+# This file is part of the IPFire Firewall.                                #
+#                                                                          #
+# IPFire is free software; you can redistribute it and/or modify           #
+# it under the terms of the GNU General Public License as published by     #
+# the Free Software Foundation; either version 2 of the License, or        #
+# (at your option) any later version.                                      #
+#                                                                          #
+# IPFire is distributed in the hope that it will be useful,                #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
+# GNU General Public License for more details.                             #
+#                                                                          #
+# You should have received a copy of the GNU General Public License        #
+# along with IPFire; if not, write to the Free Software                    #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
+#                                                                          #
+# Copyright (C) 2007 IPFire-Team <info@ipfire.org>.                        #
+#                                                                          #
+############################################################################
+#
+. /opt/pakfire/lib/functions.sh
+./uninstall.sh
+./install.sh