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