Blob Blame Raw
--- cyphesis.init.orig	2006-07-31 19:10:56.000000000 -0700
+++ cyphesis.init	2006-08-10 17:17:00.000000000 -0700
@@ -23,6 +23,12 @@
 start() {
         # Start the daemon.
 
+        if selinuxenabled ; then
+            /usr/sbin/semanage port -a -t cyphesis_port_t -p tcp 6767 &>/dev/null || :
+            /usr/sbin/semanage port -a -t cyphesis_port_t -p tcp 6769 &>/dev/null || :
+            /usr/sbin/semanage port -a -t cyphesis_port_t -p udp 32771 &>/dev/null || :
+        fi
+
         # Make sure postgres superuser exists
         if ! su $POSTGRESUSER -c true >/dev/null 2>&1; then
             echo
@@ -96,8 +102,24 @@
         else
             echo_failure
             echo
+            return $RETVAL
         fi
         echo
+
+        if [ "$POPULATE_WORLD" == "1" ] ; then
+            echo -n $"Populating cyphesis world: "
+
+            # Populate the world with game data
+            su $CYPHESISUSER -c "/usr/bin/cyclient" >/dev/null 2>&1
+            RETVAL=$?
+            if [ $RETVAL -eq 0 ]; then
+                echo_success
+            else
+                echo_failure
+            fi
+            echo
+        fi
+
         return $RETVAL
 }
 
@@ -107,7 +129,13 @@
         killproc cyphesis
         RETVAL=$?
         echo
-        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/cyphesis
+        if [ $RETVAL -eq 0 ] ; then
+            rm -f /var/lock/subsys/cyphesis
+            /usr/sbin/semanage port -d -t cyphesis_port_t -p tcp 6767 &>/dev/null || :
+            /usr/sbin/semanage port -d -t cyphesis_port_t -p tcp 6769 &>/dev/null || :
+            /usr/sbin/semanage port -d -t cyphesis_port_t -p udp 32771 &>/dev/null || :
+        fi
+
         return $RETVAL
 }