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