rpms/cyphesis/F-8 cyphesis-0.5.11-logdir.patch, NONE, 1.1 cyphesis-0.5.15-init.patch, NONE, 1.1 cyphesis.spec, 1.14, 1.15 cyphesis.te, 1.3, 1.4 cyphesis-0.5.8-init.patch, 1.1, NONE

Michael Thomas (wart) fedora-extras-commits at redhat.com
Wed Dec 19 05:48:38 UTC 2007


Author: wart

Update of /cvs/extras/rpms/cyphesis/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv1649

Modified Files:
	cyphesis.spec cyphesis.te 
Added Files:
	cyphesis-0.5.11-logdir.patch cyphesis-0.5.15-init.patch 
Removed Files:
	cyphesis-0.5.8-init.patch 
Log Message:
Move log files so they get they get the correct context



cyphesis-0.5.11-logdir.patch:

--- NEW FILE cyphesis-0.5.11-logdir.patch ---
--- common/log.cpp.orig	2007-02-24 09:57:32.000000000 -0800
+++ common/log.cpp	2007-02-24 09:57:51.000000000 -0800
@@ -65,7 +65,7 @@
 
 static void open_event_log()
 {
-    std::string event_log_file = var_directory + "/tmp/cyphesis_event.log";
+    std::string event_log_file = var_directory + "/log/cyphesis/cyphesis_event.log";
 
     event_log.open(event_log_file.c_str(), std::ios::out | std::ios::app);
 

cyphesis-0.5.15-init.patch:

--- NEW FILE cyphesis-0.5.15-init.patch ---
--- cyphesis-0.5.15/cyphesis.init.orig	2006-09-26 14:33:12.000000000 -0700
+++ cyphesis-0.5.15/cyphesis.init	2007-12-18 15:57:12.000000000 -0800
@@ -23,29 +23,35 @@
 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
+        if ! runuser $POSTGRESUSER -c true >/dev/null 2>&1; then
             echo
             echo $"Could not check for running PostgreSQL database."
             return 1
         fi
 
         # Make sure postgres is running
-        if ! su $POSTGRESUSER -c "psql -c \"\" template1" >/dev/null 2>&1; then
+        if ! runuser $POSTGRESUSER -c "psql -c \"\" template1" >/dev/null 2>&1; then
             echo $"PostgreSQL server is not running."
             return 1
         fi
 
         # Make sure the user we are going to run as exists
-        if ! su $CYPHESISUSER -c true >/dev/null 2>&1; then
+        if ! runuser $CYPHESISUSER -c true >/dev/null 2>&1; then
             echo $"Cannot find user $CYPHESISUSER to run cyphesis service."
             return 1
         fi
 
         # Make sure the user has a postgres account
-        if ! su $CYPHESISUSER -c "psql -c \"\" template1" >/dev/null 2>&1; then
+        if ! runuser $CYPHESISUSER -c "psql -c \"\" template1" >/dev/null 2>&1; then
             echo -n $"Creating PostgreSQL account: "
-            su $POSTGRESUSER -c "createuser -A -d -q -R $CYPHESISUSER" >/dev/null 2>&1
+            runuser $POSTGRESUSER -c "createuser -A -d -q -R $CYPHESISUSER" >/dev/null 2>&1
             RETVAL=$?
             if [ $RETVAL -eq 0 ]; then
                 echo_success
@@ -58,10 +64,10 @@
         fi
 
         # Make sure the database exists
-        if ! su $CYPHESISUSER -c "psql -c \"\" cyphesis" >/dev/null 2>&1; then
+        if ! runuser $CYPHESISUSER -c "psql -c \"\" cyphesis" >/dev/null 2>&1; then
             # Create the database
             echo -n $"Creating PostgreSQL database: "
-            su $CYPHESISUSER -c "createdb -q cyphesis" >/dev/null 2>&1
+            runuser $CYPHESISUSER -c "createdb -q cyphesis" >/dev/null 2>&1
             RETVAL=$?
             if [ $RETVAL -eq 0 ]; then
                 echo_success
@@ -73,7 +79,7 @@
             echo
             # Populate it with rules
             echo -n $"Loading database with rules: "
-            su $CYPHESISUSER -c "cyloadrules" >/dev/null 2>&1
+            runuser $CYPHESISUSER -c "cyloadrules" >/dev/null 2>&1
             RETVAL=$?
             if [ $RETVAL -eq 0 ]; then
                 echo_success
@@ -88,7 +94,7 @@
         echo -n $"Starting cyphesis: "
 
         # Run the server, in self daemonising mode
-        su $CYPHESISUSER -c "/usr/bin/cyphesis --cyphesis:daemon=true" >/dev/null 2>&1
+        runuser $CYPHESISUSER -c "/usr/bin/cyphesis --cyphesis:daemon=true" >/dev/null 2>&1
         RETVAL=$?
         if [ $RETVAL -eq 0 ]; then
             echo_success
@@ -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
+            runuser $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
 }
 


Index: cyphesis.spec
===================================================================
RCS file: /cvs/extras/rpms/cyphesis/F-8/cyphesis.spec,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- cyphesis.spec	16 Dec 2007 19:29:27 -0000	1.14
+++ cyphesis.spec	19 Dec 2007 05:47:59 -0000	1.15
@@ -7,7 +7,7 @@
 
 Name:           cyphesis
 Version:        0.5.15
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        WorldForge game server
 Group:          System Environment/Libraries
 # Would be GPLv2+, except server/protocol_instructions.h is GPLv2 only.
@@ -21,7 +21,8 @@
 Source5:        logwatch.script.cyphesis
 Source6:        logwatch.serviceconf.cyphesis
 Source7:        logwatch.shared.applycyphesisdate
-Patch0:         cyphesis-0.5.8-init.patch
+Patch0:         cyphesis-0.5.15-init.patch
+Patch1:         cyphesis-0.5.11-logdir.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  python-devel libgcrypt-devel pkgconfig atlascpp-devel
 BuildRequires:  varconf-devel libsigc++20-devel mercator-devel skstream-devel
@@ -67,7 +68,8 @@
 
 %prep
 %setup -q
-%patch0
+%patch0 -p1
+%patch1 -p0
 
 # Fix a bug where DESTDIR is added twice to some files during the
 # install step.  Upstream has been notified.
@@ -116,6 +118,8 @@
 install -pD -m 0644 %{SOURCE6} %{buildroot}%{logwatch_conf}/services/%{name}.conf
 install -pD -m 0755 %{SOURCE7} %{buildroot}%{logwatch_scripts}/shared/applycyphesisdate
 
+mkdir -p %{buildroot}%{_var}/log/%{name}
+
 
 # Install selinux policies
 pushd SELinux
@@ -210,6 +214,9 @@
 %config(noreplace) %{_sysconfdir}/%{name}/*
 %{_sysconfdir}/init.d/%{name}
 %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
+# Package up the log directory with special permissions so that the
+# service can write to it.
+%dir %attr(0755,cyphesis,cyphesis) %{_var}/log/%{name}
 
 %files logwatch
 %defattr(-,root,root,-)
@@ -225,6 +232,9 @@
 
 
 %changelog
+* Tue Dec 18 2007 Wart <wart at kobold.org> 0.5.15-2
+- Move log files so they get they get the correct context
+
 * Sun Dec 16 2007 Wart <wart at kobold.org> 0.5.15-1
 - Update to 0.5.15
 


Index: cyphesis.te
===================================================================
RCS file: /cvs/extras/rpms/cyphesis/F-8/cyphesis.te,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cyphesis.te	20 Jul 2007 20:28:07 -0000	1.3
+++ cyphesis.te	19 Dec 2007 05:47:59 -0000	1.4
@@ -24,16 +24,10 @@
 # setsebool cyphesis_disable_trans 1
 init_daemon_domain(cyphesis_t, cyphesis_exec_t)
 
-
-
 # pid files
 type cyphesis_var_run_t;
 files_pid_file(cyphesis_var_run_t)
 
-# log files
-type cyphesis_var_log_t;
-logging_log_file(cyphesis_var_log_t)
-
 ########################################
 #
 # cyphesis local policy
@@ -62,11 +56,9 @@
 files_pid_filetrans(cyphesis_t,cyphesis_var_run_t, { file sock_file })
 
 # log files
-allow cyphesis_t cyphesis_var_log_t:file create_file_perms;
-allow cyphesis_t cyphesis_var_log_t:sock_file create_file_perms;
-allow cyphesis_t cyphesis_var_log_t:dir { rw_dir_perms setattr };
-logging_log_filetrans(cyphesis_t,cyphesis_var_log_t,{ sock_file file dir })
+allow cyphesis_t var_log_t:file create;
 logging_send_syslog_msg(cyphesis_t)
+logging_write_generic_logs(cyphesis_t)
 
 ## Networking basics (adjust to your needs!)
 sysnet_dns_name_resolve(cyphesis_t)


--- cyphesis-0.5.8-init.patch DELETED ---




More information about the fedora-extras-commits mailing list