Hi,
I've created a patch to use cobbler on suse10 server. I would like to
share this patch.
I haven't tested all functions of cobbler yet, but the basic functions
that are start/stop, distro/profile/system, dhcpd management, provisioning
to clients and GUI interface worked well.
Some lines in this patch might not be smart and need more investigations,
but it would be good start as initial patch :)
Thanks
-Ihara
diff --git a/cobbler.spec b/cobbler.spec
index fe79c93..d1e9e94 100644
--- a/cobbler.spec
+++ b/cobbler.spec
@@ -8,17 +8,25 @@ Source0: %{name}-%{version}.tar.gz
License: GPLv2+
Group: Applications/System
Requires: python >= 2.3
+%if 0%{?suse_version} >= 1000
+Requires: apache2
+Requires: apache2-mod_python
+Requires: tftp
+%else
Requires: httpd
Requires: tftp-server
+Requires: mod_python
+%endif
Requires: python-devel
Requires: createrepo
-Requires: mod_python
Requires: python-cheetah
Requires: rsync
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
+%if 0%{?suse_version} < 0
BuildRequires: redhat-rpm-config
+%endif
BuildRequires: python-devel
BuildRequires: python-cheetah
%if 0%{?fedora} >= 8
@@ -53,7 +61,10 @@ applications.
%install
test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
-%{__python} setup.py install --optimize=1 --root=$RPM_BUILD_ROOT
+%if 0%{?suse_version} >= 1000
+PREFIX="--prefix=/usr"
+%endif
+%{__python} setup.py install --optimize=1 --root=$RPM_BUILD_ROOT $PREFIX
%post
if [ -e /var/lib/cobbler/distros ]; then
@@ -150,8 +161,13 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%{python_sitelib}/cobbler/webui/*.py*
%{_mandir}/man1/cobbler.1.gz
/etc/init.d/cobblerd
+%if 0%{?suse_version} >= 1000
+%config(noreplace) /etc/apache2/conf.d/cobbler.conf
+%config(noreplace) /etc/apache2/conf.d/cobbler_svc.conf
+%else
%config(noreplace) /etc/httpd/conf.d/cobbler.conf
%config(noreplace) /etc/httpd/conf.d/cobbler_svc.conf
+%endif
%dir /var/log/cobbler/syslog
%defattr(755,root,root)
diff --git a/cobbler/utils.py b/cobbler/utils.py
index c6e5889..61137ef 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -726,6 +726,8 @@ def check_dist():
"""
if os.path.exists("/etc/debian_version"):
return "debian"
+ elif os.path.exists("/etc/SuSE-release"):
+ return "suse"
else:
# valid for Fedora and all Red Hat / Fedora derivatives
return "redhat"
@@ -761,6 +763,15 @@ def os_release():
rest = parts[1]
make = "debian"
return (make, float(version), rest)
+ elif check_dist() == "suse":
+ fd = open("/etc/SuSE-release")
+ for line in fd.read().split("\n"):
+ if line.find("VERSION") != -1:
+ version = line.replace("VERSION = ","")
+ if line.find("PATCHLEVEL") != -1:
+ rest = line.replace("PATCHLEVEL = ","")
+ make = "suse"
+ return (make, float(version), rest)
else:
return ("unknown",0)
diff --git a/config/cobblerd b/config/cobblerd
index 7d6d571..cf97f4d 100755
--- a/config/cobblerd
+++ b/config/cobblerd
@@ -26,10 +26,13 @@
[ -x /usr/bin/cobblerd ] || exit 0
DEBIAN_VERSION=/etc/debian_version
+SUSE_RELEASE=/etc/SuSE-release
# Source function library.
if [ -e $DEBIAN_VERSION ]; then
. /etc/init.d/functions
+elif [ -f $SUSE_RELEASE -a -r /etc/rc.status ]; then
+ . /etc/rc.status
else
. /etc/rc.d/init.d/functions
fi
@@ -47,7 +50,12 @@ RETVAL=0
start() {
echo -n $"Starting cobbler daemon: "
- daemon --check $SERVICE $PROCESS --daemon $CONFIG_ARGS
+ if [ -e $SUSE_RELEASE ]; then
+ startproc -f -p /var/run/$SERVICE.pid /usr/bin/cobblerd $CONFIG_ARGS
+ rc_status -v
+ else
+ daemon --check $SERVICE $PROCESS --daemon $CONFIG_ARGS
+ fi
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCKFILE
@@ -56,7 +64,12 @@ start() {
stop() {
echo -n $"Stopping cobbler daemon: "
- killproc $PROCESS
+ if [ -e $SUSE_RELEASE ]; then
+ killproc -TERM /usr/bin/cobblerd
+ rc_status -v
+ else
+ killproc $PROCESS
+ fi
RETVAL=$?
echo
if [ $RETVAL -eq 0 ]; then
@@ -76,8 +89,14 @@ case "$1" in
$1
;;
status)
- status $PROCESS
- RETVAL=$?
+ if [ -e $SUSE_RELEASE ]; then
+ echo -n "Checking for service cobblerd "
+ checkproc /usr/bin/cobblerd
+ rc_status -v
+ else
+ status $PROCESS
+ RETVAL=$?
+ fi
;;
condrestart)
[ -f $LOCKFILE ] && restart || :
diff --git a/setup.py b/setup.py
index a08c554..d6ad253 100644
--- a/setup.py
+++ b/setup.py
@@ -39,7 +39,10 @@ if __name__ == "__main__":
backpath = "/var/lib/cobbler/backup/"
trigpath = "/var/lib/cobbler/triggers/"
etcpath = "/etc/cobbler/"
- wwwconf = "/etc/httpd/conf.d/"
+ if os.path.exists("/etc/SuSE-release"):
+ wwwconf = "/etc/apache2/conf.d/"
+ else:
+ wwwconf = "/etc/httpd/conf.d/"
wwwpath = "/var/www/cobbler/"
wwwcon = "/var/www/cobbler/webui/"
initpath = "/etc/init.d/"