File fix-initscript.dif of Package cobbler
diff -wruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache -x .deps -x .libs ../orig-cobbler-cobbler-2.4.0-1/config/cobblerd ./config/cobblerd
--- ../orig-cobbler-cobbler-2.4.0-1/config/cobblerd 2013-06-20 07:42:48.000000000 +0200
+++ ./config/cobblerd 2013-08-13 13:40:07.784665624 +0200
@@ -7,8 +7,9 @@
### BEGIN INIT INFO
# Provides: cobblerd
-# Required-Start: $network $xinetd $httpd
-# Default-Start: 3 4 5
+# Required-Start: $syslog $local_fs $network $remote_fs apache2
+# Required-Stop: $syslog $local_fs $network $remote_fs apache2
+# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: daemon for libvirt virtualization API
# Description: This is a daemon that a provides remote cobbler API
@@ -50,8 +51,33 @@
start() {
echo -n "Starting cobbler daemon: "
+ # Change the SECRET_KEY option in the Django settings.py file
+ # required for security reasons, should be unique on all systems
+ # the default is empty -> SECRET_KEY = ''
+ # such a key will be changed now
+ # (moved from the post-section of the RPM to the init-script for appliances)
+ RAND_SECRET=$(openssl rand -base64 40 | sed 's/\//\\\//g')
+ sed -i -e "s/SECRET_KEY = ''/SECRET_KEY = \'$RAND_SECRET\'/" /usr/share/cobbler/web/settings.py
+ if ! grep '\[tftpd\]' /etc/cobbler/modules.conf > /dev/null 2>&1; then
+ echo
+ echo "no [tftpd] section found in /etc/cobbler/modules.conf"
+ echo "please update your configuration on base of /etc/cobbler/modules.conf.rpmnew"
+ RETVAL=1
+ return $RETVAL
+ fi
if [ -f $SUSE_RELEASE ]; then
- startproc -f -p /var/run/$SERVICE.pid /usr/bin/cobblerd $CONFIG_ARGS
+ if [ -e /etc/apache2/conf.d/cobbler.conf.rpmnew ]; then
+ echo
+ echo "there is a /etc/apache2/conf.d/cobbler.conf.rpmnew file."
+ echo "you should check that for changes against your /etc/apache2/conf.d/cobbler.conf"
+ fi
+ if [ -e /etc/apache2/vhosts.d/cobbler_web.conf.rpmnew ]; then
+ echo
+ echo "there is a /etc/apache2/vhosts.d/cobbler_web.conf.rpmnew file."
+ echo "you should check that for changes against your /etc/apache2/vhosts.d/cobbler_web.conf"
+ fi
+
+ startproc -p /var/run/$SERVICE.pid /usr/bin/cobblerd $CONFIG_ARGS
rc_status -v
elif [ -e $DEBIAN_VERSION ]; then
if [ -f $LOCKFILE ]; then
@@ -66,7 +92,7 @@
fi
RETVAL=$?
echo
- [ $RETVAL -eq 0 ] && touch $LOCKFILE
+ [ $RETVAL -eq 0 ] && [ -f $DEBIAN_VERSION ] && touch $LOCKFILE
return $RETVAL
}
@@ -91,7 +117,9 @@
RETVAL=$?
echo
if [ $RETVAL -eq 0 ]; then
+ if [ -f $DEBIAN_VERSION ]; then
rm -f $LOCKFILE
+ fi
rm -f /var/run/$SERVICE.pid
fi
}
@@ -111,6 +139,7 @@
echo -n "Checking for service cobblerd "
checkproc /usr/bin/cobblerd
rc_status -v
+ RETVAL=$?
elif [ -f $DEBIAN_VERSION ]; then
if [ -f $LOCKFILE ]; then
RETVAL=0
@@ -125,7 +154,7 @@
fi
;;
condrestart)
- [ -f $LOCKFILE ] && restart || :
+ [ -f $DEBIAN_VERSION ] && [ -f $LOCKFILE ] && restart || :
;;
reload)
echo "can't reload configuration, you have to restart it"