Hi,

here is the patch to build and run rhnsd on openSUSE.

0005-changes-to-build-rhnsd-on-SUSE.patch:
- specfile work
- provide SUSE init script 

-- 
Regards,

        Michael Calmer

--------------------------------------------------------------------------
Michael Calmer
SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuernberg
T: +49 (0) 911 74053 0
F: +49 (0) 911 74053575  - e-mail: michael.cal...@suse.com
--------------------------------------------------------------------------
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
From 74c43ea440c79538a4b290aac5040ac5bc39c547 Mon Sep 17 00:00:00 2001
From: Michael Calmer <m...@suse.de>
Date: Mon, 4 Apr 2011 14:27:53 +0200
Subject: [PATCH 05/17] changes to build rhnsd on SUSE

- modify specfile
- add and install init script for SUSE
---
 client/rhel/rhnsd/rhnsd.init.SUSE |  114 +++++++++++++++++++++++++++++++++++++
 client/rhel/rhnsd/rhnsd.spec      |   15 ++++-
 2 files changed, 127 insertions(+), 2 deletions(-)
 create mode 100644 client/rhel/rhnsd/rhnsd.init.SUSE

diff --git a/client/rhel/rhnsd/rhnsd.init.SUSE b/client/rhel/rhnsd/rhnsd.init.SUSE
new file mode 100644
index 0000000..e2faf8e
--- /dev/null
+++ b/client/rhel/rhnsd/rhnsd.init.SUSE
@@ -0,0 +1,114 @@
+#!/bin/sh
+#
+# rhnsd:	Starts the Red Hat Network Daemon
+#
+# chkconfig: 345 97 03
+# description:  This is a daemon which handles the task of connecting \
+#		periodically to the Red Hat Network servers to \
+#		check for updates, notifications and perform system \
+#		monitoring tasks according to the service level that \
+#		this server is subscribed for
+#
+# processname: rhnsd
+# pidfile: /var/run/rhnsd.pid
+#
+
+### BEGIN INIT INFO
+# Provides: rhnsd
+# Required-Start: $local_fs $network $remote_fs $named $time
+# Required-Stop: $local_fs $network $remote_fs $named
+# Default-Start: 2 3 5
+# Default-Stop: 0 1 6
+# Short-Description: Starts the Red Hat Network Daemon
+# Description: This is a daemon which handles the task of connecting
+#               periodically to the Red Hat Network servers to
+#               check for updates, notifications and perform system
+#               monitoring tasks according to the service level that
+#               this server is subscribed for.
+### END INIT INFO
+
+
+# interval in minutes to connect to Red Hat Network. The minimum allowed
+# value is currently 1 hour; by default rhnsd will connect every four hours.
+# This should be more than suitable for the vast majority of systems.  You
+# may adjust the interval by editing the file /etc/sysconfig/rhn/rhnsd.
+
+RHNSD=/usr/sbin/rhnsd
+RHNSD_PIDFILE=/var/run/rhnsd.pid
+
+# Sanity checks.
+[ -x $RHNSD ] || exit 6
+RHN_UP2DATE_FILE="/etc/sysconfig/rhn/up2date"
+[ -f $RHN_UP2DATE_FILE ] || exit 6
+if [ -r $RHN_UP2DATE_FILE ]; then
+        RHN_SYSTEMID_FILE=`awk -F '=[[:space:]]*' '/^[[:space:]]*systemIdPath[[:space:]]*=/ {print $2}' $RHN_UP2DATE_FILE`
+        [ -f $RHN_SYSTEMID_FILE ] || exit 6
+elif [ "$1" != "status" ];  then
+        echo "Insufficient privilege. Cannot open file $RHN_UP2DATE_FILE for reading."
+        exit 4
+fi
+
+# Source function library.
+. /etc/rc.status
+
+# Shell functions sourced from /etc/rc.status:
+#      rc_check         check and set local and overall rc status
+#      rc_status        check and set local and overall rc status
+#      rc_status -v     ditto but be verbose in local rc status
+#      rc_status -v -r  ditto and clear the local rc status
+#      rc_failed        set local and overall rc status to failed
+#      rc_reset         clear local rc status (overall remains)
+#      rc_exit          exit appropriate to overall rc status
+
+# First reset status of this service
+rc_reset
+
+start() {
+    echo -n $"Starting Red Hat Network Daemon: "
+    startproc -p $RHNSD_PIDFILE $RHNSD
+    rc_status
+    touch /var/lock/subsys/rhnsd
+    rc_status -v
+}
+
+stop() {
+    echo -n $"Stopping Red Hat Network Daemon: "
+    killproc -p $RHNSD_PIDFILE $RHNSD
+    rc_status -v
+    rm -f /var/lock/subsys/rhnsd
+}
+
+# See how we were called.
+case "$1" in
+    start)
+	start
+	;;
+    stop)
+	stop
+	;;
+    status)
+        echo -n "Checking for service rhnsd: "
+        checkproc -p $RHNSD_PIDFILE $RHNSD
+	rc_status -v
+        ;;
+    restart|force-reload)
+	stop
+	start
+	;;
+    condrestart|try-restart)
+	if [ -f /var/lock/subsys/rhnsd ]; then
+	    stop
+	    start
+	fi
+	;;
+    reload)
+        echo -n $"Reloading Red Hat Network Daemon: "
+        killproc -p $RHNSD_PIDFILE -HUP $RHNSD
+        rc_status -v
+        echo
+        ;;
+    *)
+	echo $"Usage: $0 {start|stop|status|restart|force-reload|condrestart|try-restart|reload}"
+        exit 2
+esac
+rc_exit
diff --git a/client/rhel/rhnsd/rhnsd.spec b/client/rhel/rhnsd/rhnsd.spec
index bf99b51..ea566e4 100644
--- a/client/rhel/rhnsd/rhnsd.spec
+++ b/client/rhel/rhnsd/rhnsd.spec
@@ -11,11 +11,17 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: gettext
 
 Requires: rhn-check >= 0.0.8
+%if 0%{?suse_version}
+Requires(post): aaa_base
+Requires(preun): aaa_base
+BuildRequires: sysconfig
+%else
 Requires(post): chkconfig
 Requires(preun): chkconfig
 # This is for /sbin/service
 Requires(preun): initscripts
 Requires(postun): initscripts
+%endif
 
 %description
 The Red Hat Update Agent that automatically queries the Red Hat
@@ -23,14 +29,18 @@ Network servers and determines which packages need to be updated on
 your machine, and runs any actions.
 
 %prep
-%setup -q 
+%setup -q
 
 %build
 make -f Makefile.rhnsd %{?_smp_mflags} CFLAGS="%{optflags}"
 
 %install
 rm -rf $RPM_BUILD_ROOT
-make -f Makefile.rhnsd install VERSION=%{version}-%{release} PREFIX=$RPM_BUILD_ROOT MANPATH=%{_mandir}
+make -f Makefile.rhnsd install VERSION=%{version}-%{release} PREFIX=$RPM_BUILD_ROOT MANPATH=%{_mandir} INIT_DIR=$RPM_BUILD_ROOT/%{_initrddir}
+
+%if 0%{?suse_version}
+install -m 0755 rhnsd.init.SUSE $RPM_BUILD_ROOT/%{_initrddir}/rhnsd
+%endif
 
 %find_lang %{name}
 
@@ -56,6 +66,7 @@ rm -fr $RPM_BUILD_ROOT
 
 %files -f %{name}.lang 
 %defattr(-,root,root)
+%dir %{_sysconfdir}/sysconfig/rhn
 %config(noreplace) %{_sysconfdir}/sysconfig/rhn/rhnsd
 %{_sbindir}/rhnsd
 %{_initrddir}/rhnsd
-- 
1.7.3.4

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to