Patch for Suse

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've been working on a program very similar to func, but func seems
more mature so it looks like I'll be switching to using func for my
project.

Where I work we use all SUSE though, so I had to change a couple
things to get func to build and start on SLES10. All of these changes
shouldn't break building or starting on fedora, but i haven't tested
on fedora.

I've attached a git-format-patch of the changes.

Eli Criffield
From 6dc25ab87726add858f8ccf0d31d5e505f0dbe41 Mon Sep 17 00:00:00 2001
From: Eli Criffield <elicriffield@xxxxxxxxx>
Date: Thu, 13 Dec 2007 10:41:53 -0600
Subject: [PATCH] Changes to work on suse, should still work on fedora.

Changed the .spec file to use suse's style init script installer if its suse
 and BuildRequires for suse package names
Changed init scripts to so they should work on both suse and fedora
 (not tested on fedora)
---
 func.spec               |   39 ++++++++++++++++++++++++++++++++++-----
 init-scripts/certmaster |   39 +++++++++++++++++++++++++++++++++++----
 init-scripts/funcd      |   44 +++++++++++++++++++++++++++++++++++++++-----
 3 files changed, 108 insertions(+), 14 deletions(-)

diff --git a/func.spec b/func.spec
index 376d17e..141b6d5 100644
--- a/func.spec
+++ b/func.spec
@@ -1,6 +1,8 @@
 
 %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
 
+%define is_suse %(test -e /etc/SuSE-release && echo 1 || echo 0)
+
 Summary: Remote config, monitoring, and management api
 Name: func
 Source1: version
@@ -12,11 +14,15 @@ Group: Applications/System
 Requires: python >= 2.3
 Requires: pyOpenSSL
 BuildRequires: python-devel
+%if %is_suse
+BuildRequires: gettext-devel
+%else
 %if 0%{?fedora} >= 8
 BuildRequires: python-setuptools-devel
 %else
 BuildRequires: python-setuptools
 %endif
+%endif
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
 BuildArch: noarch
 Url: https://hosted.fedoraproject.org/projects/func/
@@ -33,7 +39,7 @@ func is a remote api for mangement, configation, and monitoring of systems.
 
 %install
 test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
-%{__python} setup.py install --root=$RPM_BUILD_ROOT
+%{__python} setup.py install --prefix=/usr --root=$RPM_BUILD_ROOT
 
 %clean
 rm -fr $RPM_BUILD_ROOT
@@ -77,18 +83,41 @@ rm -fr $RPM_BUILD_ROOT
 
 
 %post
-/sbin/chkconfig --add funcd
-/sbin/chkconfig --add certmaster
+if [ -x /usr/lib/lsb/install_initd ]; then
+  /usr/lib/lsb/install_initd /etc/init.d/funcd
+elif [ -x /sbin/chkconfig ]; then
+  /sbin/chkconfig --add funcd
+else
+   for i in 2 3 4 5; do
+        ln -sf /etc/init.d/funcd /etc/rc.d/rc${i}.d/S99funcd
+   done
+   for i in 1 6; do
+        ln -sf /etc/init.d/funcd /etc/rc.d/rc${i}.d/S99funcd
+   done
+fi
 exit 0
 
 %preun
 if [ "$1" = 0 ] ; then
-  /sbin/service funcd stop > /dev/null 2>&1
-  /sbin/chkconfig --del funcd
+  /etc/init.d/funcd stop  > /dev/null 2>&1
+  /etc/init.d/certmaster stop  > /dev/null 2>&1
+  if [ -x /usr/lib/lsb/remove_initd ]; then
+    /usr/lib/lsb/remove_initd /etc/init.d/funcd
+    /usr/lib/lsb/remove_initd /etc/init.d/certmaster
+  elif [ -x /sbin/chkconfig ]; then
+    /sbin/chkconfig --del funcd
+    /sbin/chkconfig --del certmaster
+  else
+    rm -f /etc/rc.d/rc?.d/???funcd
+    rm -f /etc/rc.d/rc?.d/???certmaster
+  fi
 fi
 
 
 %changelog
+* Thu Dec 13 2007 Eli Criffield <elicriffield@xxxxxxxxx> - 0.0.14-4
+- changes for suse integration 
+
 * Tue Dec 11 2007 Michael DeHaan <mdehaan@xxxxxxxxxx> - 0.0.14-2
 - python egg section added for F9 and later
 
diff --git a/init-scripts/certmaster b/init-scripts/certmaster
index 11a4539..13449a6 100755
--- a/init-scripts/certmaster
+++ b/init-scripts/certmaster
@@ -8,6 +8,8 @@
 ### BEGIN INIT INFO
 # Provides: certmaster
 # Required-Start: network
+# Default-Start: 3 4 5
+# Default-Stop: 0 1 2 6
 # Short-Description: certificate master for Fedora Unified Network Control 'master server only'
 # Description: certificate master to sign/manage ca/cert infrastructure for func
 ### END INIT INFO
@@ -22,18 +24,47 @@
 # Sanity checks.
 [ -x /usr/bin/certmaster ] || exit 0
 
-# Source function library.
-. /etc/rc.d/init.d/functions
-
 SERVICE=certmaster
 PROCESS=certmaster
+DEAMON=/usr/bin/certmaster
 CONFIG_ARGS=" "
 
+CAStatus()
+{
+  ps wt? | grep "$DAEMON" 2>&1 > /dev/null
+  if [ "x$?" = "x0" ]; then
+    RVAL=0
+    echo "certmaster is running"
+  else
+    RVAL=3
+    echo "certmaster is not running"
+  fi
+}
+
+if [ -f /lib/lsb/init-functions ]; then
+  . /lib/lsb/init-functions
+  alias START_DAEMON=start_daemon
+  alias STATUS=CAStatus
+  alias LOG_SUCCESS=log_success_msg
+  alias LOG_FAILURE=log_failure_msg
+  alias LOG_WARNING=log_warning_msg
+elif [ -f /etc/init.d/functions ]; then
+  . /etc/init.d/functions
+  alias START_DAEMON=daemon
+  alias STATUS=status
+  alias LOG_SUCCESS=success
+  alias LOG_FAILURE=failure
+  alias LOG_WARNING=passed
+else
+  echo "Error: your platform is not supported by $0" > /dev/stderr
+  exit 1
+fi
+
 RETVAL=0
 
 start() {
     echo -n $"Starting certmaster daemon: "
-    daemon --check $SERVICE $PROCESS --daemon $CONFIG_ARGS
+    START_DAEMON $PROCESS $CONFIG_ARGS
     RETVAL=$?
     echo
     [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE
diff --git a/init-scripts/funcd b/init-scripts/funcd
index 72e2de5..5a2d20d 100755
--- a/init-scripts/funcd
+++ b/init-scripts/funcd
@@ -7,7 +7,10 @@
 
 ### BEGIN INIT INFO
 # Provides: funcd
-# Required-Start: network, xinetd, httpd
+# Required-Start: network
+# Required-Stop:
+# Default-Start: 3 4 5
+# Default-Stop: 0 1 2 6
 # Short-Description: Fedora Unified Network Control
 # Description: Crazy simple, secure remote management.
 ### END INIT INFO
@@ -22,18 +25,49 @@
 # Sanity checks.
 [ -x /usr/bin/funcd ] || exit 0
 
-# Source function library.
-. /etc/rc.d/init.d/functions
-
 SERVICE=funcd
 PROCESS=funcd
+DAEMON=/usr/bin/funcd
 CONFIG_ARGS=" "
 
+
+FuncStatus()
+{
+  ps wt? | grep "$DAEMON" 2>&1 > /dev/null
+  if [ "x$?" = "x0" ]; then
+    RVAL=0
+    echo "$DAEMON is running"
+  else
+    RVAL=3
+    echo "$DAEMON is not running"
+  fi
+}
+
+if [ -f /lib/lsb/init-functions ]; then
+  . /lib/lsb/init-functions
+  alias START_DAEMON=start_daemon
+  alias STATUS=FuncStatus
+  alias LOG_SUCCESS=log_success_msg
+  alias LOG_FAILURE=log_failure_msg
+  alias LOG_WARNING=log_warning_msg
+elif [ -f /etc/init.d/functions ]; then
+  . /etc/init.d/functions
+  alias START_DAEMON=daemon
+  alias STATUS=status
+  alias LOG_SUCCESS=success
+  alias LOG_FAILURE=failure
+  alias LOG_WARNING=passed
+else
+  echo "Error: your platform is not supported by $0" > /dev/stderr
+  exit 1
+fi
+
+
 RETVAL=0
 
 start() {
     echo -n $"Starting func daemon: "
-    daemon --check $SERVICE $PROCESS --daemon $CONFIG_ARGS
+    START_DAEMON $PROCESS $CONFIG_ARGS
     RETVAL=$?
     echo
     [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE
-- 
1.5.2.5


[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux