File fix-initscript.diff of Package cobbler

Index: cobbler-2.4.2/config/cobblerd
===================================================================
--- cobbler-2.4.2.orig/config/cobblerd
+++ cobbler-2.4.2/config/cobblerd
@@ -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
@@ -51,8 +52,33 @@ RETVAL=0
 
 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
@@ -67,7 +93,7 @@ start() {
     fi
     RETVAL=$?
     echo
-    [ $RETVAL -eq 0 ] && touch $LOCKFILE
+    [ $RETVAL -eq 0 ] && [ -f $DEBIAN_VERSION ] && touch $LOCKFILE
     [ -f $WSGI ] && touch $WSGI
     return $RETVAL
 }
openSUSE Build Service is sponsored by