|
Michael Thomas |
71ce1c3 |
--- cyphesis-0.5.15/cyphesis.init.orig 2008-04-09 11:02:46.000000000 -0700
|
|
Michael Thomas |
71ce1c3 |
+++ cyphesis-0.5.15/cyphesis.init 2008-04-09 11:03:07.000000000 -0700
|
|
Michael Thomas |
71ce1c3 |
@@ -24,28 +24,28 @@
|
|
Michael Thomas |
6a90090 |
# Start the daemon.
|
|
Michael Thomas |
6a90090 |
|
|
Michael Thomas |
6a90090 |
# Make sure postgres superuser exists
|
|
Michael Thomas |
4869198 |
- if ! su $POSTGRESUSER -c true >/dev/null 2>&1; then
|
|
Michael Thomas |
4869198 |
+ if ! runuser $POSTGRESUSER -c true >/dev/null 2>&1; then
|
|
Michael Thomas |
6a90090 |
echo
|
|
Michael Thomas |
4869198 |
echo $"Could not check for running PostgreSQL database."
|
|
Michael Thomas |
4869198 |
return 1
|
|
Michael Thomas |
4869198 |
fi
|
|
Michael Thomas |
4869198 |
|
|
Michael Thomas |
4869198 |
# Make sure postgres is running
|
|
Michael Thomas |
4869198 |
- if ! su $POSTGRESUSER -c "psql -c \"\" template1" >/dev/null 2>&1; then
|
|
Michael Thomas |
4869198 |
+ if ! runuser $POSTGRESUSER -c "psql -c \"\" template1" >/dev/null 2>&1; then
|
|
Michael Thomas |
4869198 |
echo $"PostgreSQL server is not running."
|
|
Michael Thomas |
4869198 |
return 1
|
|
Michael Thomas |
4869198 |
fi
|
|
Michael Thomas |
4869198 |
|
|
Michael Thomas |
4869198 |
# Make sure the user we are going to run as exists
|
|
Michael Thomas |
4869198 |
- if ! su $CYPHESISUSER -c true >/dev/null 2>&1; then
|
|
Michael Thomas |
4869198 |
+ if ! runuser $CYPHESISUSER -c true >/dev/null 2>&1; then
|
|
Michael Thomas |
4869198 |
echo $"Cannot find user $CYPHESISUSER to run cyphesis service."
|
|
Michael Thomas |
4869198 |
return 1
|
|
Michael Thomas |
4869198 |
fi
|
|
Michael Thomas |
4869198 |
|
|
Michael Thomas |
4869198 |
# Make sure the user has a postgres account
|
|
Michael Thomas |
4869198 |
- if ! su $CYPHESISUSER -c "psql -c \"\" template1" >/dev/null 2>&1; then
|
|
Michael Thomas |
4869198 |
+ if ! runuser $CYPHESISUSER -c "psql -c \"\" template1" >/dev/null 2>&1; then
|
|
Michael Thomas |
4869198 |
echo -n $"Creating PostgreSQL account: "
|
|
Michael Thomas |
4869198 |
- su $POSTGRESUSER -c "createuser -A -d -q -R $CYPHESISUSER" >/dev/null 2>&1
|
|
Michael Thomas |
4869198 |
+ runuser $POSTGRESUSER -c "createuser -A -d -q -R $CYPHESISUSER" >/dev/null 2>&1
|
|
Michael Thomas |
4869198 |
RETVAL=$?
|
|
Michael Thomas |
4869198 |
if [ $RETVAL -eq 0 ]; then
|
|
Michael Thomas |
4869198 |
echo_success
|
|
Michael Thomas |
71ce1c3 |
@@ -58,10 +58,10 @@
|
|
Michael Thomas |
4869198 |
fi
|
|
Michael Thomas |
4869198 |
|
|
Michael Thomas |
4869198 |
# Make sure the database exists
|
|
Michael Thomas |
4869198 |
- if ! su $CYPHESISUSER -c "psql -c \"\" cyphesis" >/dev/null 2>&1; then
|
|
Michael Thomas |
4869198 |
+ if ! runuser $CYPHESISUSER -c "psql -c \"\" cyphesis" >/dev/null 2>&1; then
|
|
Michael Thomas |
4869198 |
# Create the database
|
|
Michael Thomas |
4869198 |
echo -n $"Creating PostgreSQL database: "
|
|
Michael Thomas |
4869198 |
- su $CYPHESISUSER -c "createdb -q cyphesis" >/dev/null 2>&1
|
|
Michael Thomas |
4869198 |
+ runuser $CYPHESISUSER -c "createdb -q cyphesis" >/dev/null 2>&1
|
|
Michael Thomas |
4869198 |
RETVAL=$?
|
|
Michael Thomas |
4869198 |
if [ $RETVAL -eq 0 ]; then
|
|
Michael Thomas |
4869198 |
echo_success
|
|
Michael Thomas |
71ce1c3 |
@@ -73,7 +73,7 @@
|
|
Michael Thomas |
4869198 |
echo
|
|
Michael Thomas |
4869198 |
# Populate it with rules
|
|
Michael Thomas |
4869198 |
echo -n $"Loading database with rules: "
|
|
Michael Thomas |
4869198 |
- su $CYPHESISUSER -c "cyloadrules" >/dev/null 2>&1
|
|
Michael Thomas |
4869198 |
+ runuser $CYPHESISUSER -c "cyloadrules" >/dev/null 2>&1
|
|
Michael Thomas |
4869198 |
RETVAL=$?
|
|
Michael Thomas |
4869198 |
if [ $RETVAL -eq 0 ]; then
|
|
Michael Thomas |
4869198 |
echo_success
|
|
Michael Thomas |
71ce1c3 |
@@ -88,7 +88,7 @@
|
|
Michael Thomas |
4869198 |
echo -n $"Starting cyphesis: "
|
|
Michael Thomas |
4869198 |
|
|
Michael Thomas |
4869198 |
# Run the server, in self daemonising mode
|
|
Michael Thomas |
4869198 |
- su $CYPHESISUSER -c "/usr/bin/cyphesis --cyphesis:daemon=true" >/dev/null 2>&1
|
|
Michael Thomas |
4869198 |
+ runuser $CYPHESISUSER -c "/usr/bin/cyphesis --cyphesis:daemon=true" >/dev/null 2>&1
|
|
Michael Thomas |
4869198 |
RETVAL=$?
|
|
Michael Thomas |
4869198 |
if [ $RETVAL -eq 0 ]; then
|
|
Michael Thomas |
4869198 |
echo_success
|
|
Michael Thomas |
71ce1c3 |
@@ -96,8 +96,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 |
4869198 |
+ runuser $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 |
71ce1c3 |
@@ -107,7 +123,10 @@
|
|
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 |
+ fi
|
|
Michael Thomas |
6a90090 |
+
|
|
Michael Thomas |
6a90090 |
return $RETVAL
|
|
Michael Thomas |
6a90090 |
}
|
|
Michael Thomas |
6a90090 |
|