summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Likins <alikins@grimlock.devel.redhat.com>2007-12-13 15:57:06 -0500
committerAdrian Likins <alikins@grimlock.devel.redhat.com>2007-12-13 15:57:06 -0500
commit835eb9298e83c32693ddcc66258fcdd6ffd3f980 (patch)
treebe6d6df45102bd35dff85e2f09283769d42f9893
parent9aa702e1b83bc682597a11fddb394ee87c9cdfa0 (diff)
downloadthird_party-func-835eb9298e83c32693ddcc66258fcdd6ffd3f980.tar.gz
third_party-func-835eb9298e83c32693ddcc66258fcdd6ffd3f980.tar.xz
third_party-func-835eb9298e83c32693ddcc66258fcdd6ffd3f980.zip
apply patch from Eli Criffield <elicriffield@gmail.com> for
running on Suse (fixing up spec and init-scripts to be suse compatible)
-rw-r--r--func.spec46
-rwxr-xr-xinit-scripts/certmaster39
-rwxr-xr-xinit-scripts/funcd44
3 files changed, 115 insertions, 14 deletions
diff --git a/func.spec b/func.spec
index 376d17e..2586c06 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,48 @@ rm -fr $RPM_BUILD_ROOT
%post
-/sbin/chkconfig --add funcd
-/sbin/chkconfig --add certmaster
+# for suse
+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
+# for red hat distros
+elif [ -x /sbin/chkconfig ]; then
+ /sbin/chkconfig --add funcd
+ /sbin/chkconfig --add certmaster
+# or, the old fashioned way
+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@gmail.com> - 0.0.14-4
+- changes for suse integration
+
* Tue Dec 11 2007 Michael DeHaan <mdehaan@redhat.com> - 0.0.14-2
- python egg section added for F9 and later
diff --git a/init-scripts/certmaster b/init-scripts/certmaster
index 11a4539..0e177a8 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
+DAEMON=/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