Hi,

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

0006-build-osad-on-SUSE.patch:
- specfile work
- add init script for SUSE
- osad.py missed and import of the config module

-- 
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 17423372daefefabeb43a68b921dd665196adc86 Mon Sep 17 00:00:00 2001
From: Michael Calmer <m...@suse.de>
Date: Mon, 4 Apr 2011 15:17:06 +0200
Subject: [PATCH 06/17] build osad on SUSE

- modify specfile
- add init script for SUSE
---
 client/tools/osad/osad.spec      |   57 +++++++++++++++++++++++++++--
 client/tools/osad/prog.init.SUSE |   75 ++++++++++++++++++++++++++++++++++++++
 client/tools/osad/src/osad.py    |    1 +
 3 files changed, 129 insertions(+), 4 deletions(-)
 create mode 100755 client/tools/osad/prog.init.SUSE

diff --git a/client/tools/osad/osad.spec b/client/tools/osad/osad.spec
index 80cb6ab..285d30e 100644
--- a/client/tools/osad/osad.spec
+++ b/client/tools/osad/osad.spec
@@ -3,6 +3,14 @@
 %define client_caps_dir /etc/sysconfig/rhn/clientCaps.d
 %{!?pythongen:%define pythongen %(%{__python} -c "import sys ; print sys.version[:3]")}
 
+%if 0%{?suse_version}
+%define apache_group www
+%define include_selinux_package 0
+%else
+%define apache_group apache
+%define include_selinux_package 1
+%endif
+
 Name: osad
 Summary: Open Source Architecture Daemon
 Group:   System Environment/Daemons
@@ -17,22 +25,32 @@ BuildRequires: python-devel
 Requires: python
 Requires: rhnlib >= 2.5.38
 Requires: jabberpy
-%if 0%{?rhel} <= 5
+%if 0%{?rhel} && 0%{?rhel} <= 5
 Requires: python-hashlib
 %endif
 # This should have been required by rhnlib
+%if 0%{?suse_version} >= 1140
+Requires: python-xml
+%else
 Requires: PyXML
+%endif
 %if "%{pythongen}" == "1.5"
 Requires: python-iconv
 %endif
 Conflicts: osa-dispatcher < %{version}-%{release}
 Conflicts: osa-dispatcher > %{version}-%{release}
+%if !0%{?suse_version}
 Requires(post): chkconfig
 Requires(preun): chkconfig
 # This is for /sbin/service
 Requires(preun): initscripts
+%else
+Requires(post): aaa_base
+Requires(preun): aaa_base
+BuildRequires: sysconfig syslog
+%endif
 
-%description 
+%description
 OSAD agent receives commands over jabber protocol from Spacewalk Server and
 commands are instantly executed.
 
@@ -47,16 +65,24 @@ Requires: jabberpy
 Requires: lsof
 Conflicts: %{name} < %{version}-%{release}
 Conflicts: %{name} > %{version}-%{release}
+%if !0%{?suse_version}
 Requires(post): chkconfig
 Requires(preun): chkconfig
 # This is for /sbin/service
 Requires(preun): initscripts
+%else
+Requires(post): aaa_base
+Requires(preun): aaa_base
+Requires: logrotate
+BuildRequires: sysconfig
+%endif
 
 %description -n osa-dispatcher
 OSA dispatcher is supposed to run on the Spacewalk server. It gets information
 from the Spacewalk server that some command needs to be execute on the client;
 that message is transported via jabber protocol to OSAD agent on the clients.
 
+%if 0%{?include_selinux_package}
 %package -n osa-dispatcher-selinux
 %define selinux_variants mls strict targeted
 %define selinux_policyver %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp 2> /dev/null)
@@ -83,13 +109,18 @@ Requires: osa-dispatcher
 
 %description -n osa-dispatcher-selinux
 SELinux policy module supporting osa-dispatcher.
+%endif
 
 %prep
 %setup -q
+%if 0%{?suse_version}
+cp prog.init.SUSE prog.init
+%endif
 
 %build
 make -f Makefile.osad all
 
+%if 0%{?include_selinux_package}
 %{__perl} -i -pe 'BEGIN { $VER = join ".", grep /^\d+$/, split /\./, "%{version}.%{release}"; } s!\@\@VERSION\@\@!$VER!g;' osa-dispatcher-selinux/%{modulename}.te
 for selinuxvariant in %{selinux_variants}
 do
@@ -97,12 +128,14 @@ do
     mv osa-dispatcher-selinux/%{modulename}.pp osa-dispatcher-selinux/%{modulename}.pp.${selinuxvariant}
     make -C osa-dispatcher-selinux NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean
 done
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT%{rhnroot}
-make -f Makefile.osad install PREFIX=$RPM_BUILD_ROOT ROOT=%{rhnroot}
+make -f Makefile.osad install PREFIX=$RPM_BUILD_ROOT ROOT=%{rhnroot} INITDIR=%{_initrddir}
 
+%if 0%{?include_selinux_package}
 for selinuxvariant in %{selinux_variants}
   do
     install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant}
@@ -121,6 +154,7 @@ install -p -m 644 osa-dispatcher-selinux/%{modulename}.if \
 # Install osa-dispatcher-selinux-enable which will be called in %post
 install -d %{buildroot}%{_sbindir}
 install -p -m 755 osa-dispatcher-selinux/osa-dispatcher-selinux-enable %{buildroot}%{_sbindir}/osa-dispatcher-selinux-enable
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -147,6 +181,7 @@ if [ $1 = 0 ]; then
     /sbin/chkconfig --del osa-dispatcher
 fi
 
+%if 0%{?include_selinux_package}
 %post -n osa-dispatcher-selinux
 if /usr/sbin/selinuxenabled ; then
    %{_sbindir}/osa-dispatcher-selinux-enable
@@ -177,6 +212,7 @@ fi
 
 rpm -ql osa-dispatcher | xargs -n 1 /sbin/restorecon -rvi {}
 /sbin/restorecon -vvi /var/log/rhn/osa-dispatcher.log
+%endif
 
 %files
 %defattr(-,root,root)
@@ -195,6 +231,11 @@ rpm -ql osa-dispatcher | xargs -n 1 /sbin/restorecon -rvi {}
 %attr(755,root,root) %{_initrddir}/osad
 %doc LICENSE
 %doc PYTHON-LICENSES.txt
+%if 0%{?suse_version}
+%dir %{rhnroot}
+%dir %{_sysconfdir}/sysconfig/rhn
+%dir %{_sysconfdir}/sysconfig/rhn/clientCaps.d
+%endif
 
 %files -n osa-dispatcher
 %defattr(-,root,root)
@@ -211,11 +252,18 @@ rpm -ql osa-dispatcher | xargs -n 1 /sbin/restorecon -rvi {}
 %config %{_sysconfdir}/rhn/tns_admin/osa-dispatcher
 %config(noreplace) %{_sysconfdir}/rhn/tns_admin/osa-dispatcher/sqlnet.ora
 %attr(755,root,root) %{_initrddir}/osa-dispatcher
-%attr(770,root,apache) %dir %{_var}/log/rhn/oracle
+%attr(770,root,%{apache_group}) %dir %{_var}/log/rhn/oracle
 %attr(770,root,root) %dir %{_var}/log/rhn/oracle/osa-dispatcher
 %doc LICENSE
 %doc PYTHON-LICENSES.txt
+%if 0%{?suse_version}
+%dir %{_sysconfdir}/rhn
+%dir %{_sysconfdir}/rhn/tns_admin
+%dir %{_sysconfdir}/rhn/default
+%attr(770,root,%{apache_group}) %dir %{_var}/log/rhn
+%endif
 
+%if 0%{?include_selinux_package}
 %files -n osa-dispatcher-selinux
 %defattr(-,root,root,0755)
 %doc osa-dispatcher-selinux/%{modulename}.fc
@@ -226,6 +274,7 @@ rpm -ql osa-dispatcher | xargs -n 1 /sbin/restorecon -rvi {}
 %doc LICENSE
 %doc PYTHON-LICENSES.txt
 %attr(0755,root,root) %{_sbindir}/osa-dispatcher-selinux-enable
+%endif
 
 %changelog
 * Tue Apr 05 2011 Michael Mraka <michael.mr...@redhat.com> 5.10.8-1
diff --git a/client/tools/osad/prog.init.SUSE b/client/tools/osad/prog.init.SUSE
new file mode 100755
index 0000000..c1662a3
--- /dev/null
+++ b/client/tools/osad/prog.init.SUSE
@@ -0,0 +1,75 @@
+#!/bin/sh
+#
+# @@PROG@@     This shell script starts the @@PROG@@ daemon
+#
+# chkconfig: - 81 04
+# description: @@PROG@@ is a daemon used by the Spacewalk
+#
+### BEGIN INIT INFO
+# Provides: @@PROG@@
+# Required-Start: $syslog $local_fs $network $remote_fs
+# Required-Stop: $syslog $local_fs $network $remote_fs
+# Should-Start: oracle-xe jabberd
+# Should-Stop:  oracle-xe jabberd
+# Default-Start:  3 5
+# Default-Stop: 0 1 6
+# Short-Description: This shell script starts the @@PROG@@ daemon
+# Description:       @@PROG@@ is a daemon used by the Spacewalk
+### END INIT INFO
+
+# Source function library.
+. /etc/rc.status
+
+prog="@@PROG@@"
+script="/usr/sbin/@@PROG@@"
+PIDFILE="/var/run/@@PROG@@.pid"
+
+[ -f $script ] || exit 0
+
+start() {
+    # Start daemon
+    echo -n "Starting $prog: "
+    startproc -p $PIDFILE $script --pid-file="$PIDFILE"
+    rc_status
+    touch /var/lock/subsys/$prog
+    rc_status -v
+}
+
+
+stop() {
+    # Stop daemon
+    echo -n "Shutting down $prog: "
+    rm -f /var/lock/subsys/$prog
+    killproc -p $PIDFILE $script
+    rc_status -v
+}
+
+# See how we were called.
+case "$1" in
+    start)
+        start
+        ;;
+    stop)
+        stop
+        ;;
+    restart|reload)
+        stop
+        start
+        ;;
+    status)
+        echo -n "Checking for service $prog: "
+        checkproc -p $PIDFILE $script
+        rc_status -v
+        ;;
+    condrestart|try-restart)
+        if [ -f /var/lock/subsys/$prog ]; then
+            stop
+            start
+        fi
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
+        exit 1
+esac
+
+rc_exit
diff --git a/client/tools/osad/src/osad.py b/client/tools/osad/src/osad.py
index a0443a5..f0bcf81 100644
--- a/client/tools/osad/src/osad.py
+++ b/client/tools/osad/src/osad.py
@@ -22,6 +22,7 @@ from rhn import rpclib
 import random
 
 from up2date_client.config import initUp2dateConfig
+from up2date_client import config
 
 from rhn_log import set_debug_level, log_debug, die, set_logfile
 
-- 
1.7.3.4

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

Reply via email to