Re: Patch for Suse

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

 



Oops forgot to re-add the certmaster in the startup.

Here's a new patch.

Eli Criffield

On Dec 13, 2007 11:30 AM, Michael DeHaan <mdehaan@xxxxxxxxxx> wrote:
>
> Eli Criffield wrote:
> > 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
> >
>
> We're definitely interested in this.
>
> It looks like your patch misses certmaster in one spot in the RPM
> changes (around the chkconfig --add parts).    Can you resubmit it with
> certmaster included next to funcd?
>
> If you can take care of that, I'll retest it for EL/Fedora and commit this.
>
> Thanks!
>
> --Michael
>
>
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Func-list mailing list
> > Func-list@xxxxxxxxxx
> > https://www.redhat.com/mailman/listinfo/func-list
>
>
From 5e87a3c65531ca4593f93e9ead8eabd694f1dec1 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               |   43 ++++++++++++++++++++++++++++++++++++++-----
 init-scripts/certmaster |   39 +++++++++++++++++++++++++++++++++++----
 init-scripts/funcd      |   44 +++++++++++++++++++++++++++++++++++++++-----
 3 files changed, 112 insertions(+), 14 deletions(-)

diff --git a/func.spec b/func.spec
index 376d17e..5aebc02 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,45 @@ 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
+  /usr/lib/lsb/install_initd /etc/init.d/certmaster
+elif [ -x /sbin/chkconfig ]; then
+  /sbin/chkconfig --add funcd
+  /sbin/chkconfig --add certmaster
+else
+   for i in 2 3 4 5; do
+        ln -sf /etc/init.d/funcd /etc/rc.d/rc${i}.d/S99funcd
+        ln -sf /etc/init.d/certmaster /etc/rc.d/rc${i}.d/S99certmaster
+   done
+   for i in 1 6; do
+        ln -sf /etc/init.d/funcd /etc/rc.d/rc${i}.d/S99funcd
+        ln -sf /etc/init.d/certmaster /etc/rc.d/rc${i}.d/S99certmaster
+   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