From 3999ec5b254cfd822e2a1dc6401a7b8ec6313dbf Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Wed, 21 Oct 2009 14:55:20 +0200 Subject: Add basic OS detection Detect if the OS is Fedora, RHEL or SUSE and install the SUSE start-script on SUSE systems. --- server/Makefile.am | 12 +++++-- server/configure.ac | 1 + server/external/platform.m4 | 29 +++++++++++++++++ server/sysv/SUSE/sssd | 78 +++++++++++++++++++++++++++++++++++++++++++++ server/sysv/sssd.SUSE | 78 --------------------------------------------- 5 files changed, 118 insertions(+), 80 deletions(-) create mode 100644 server/external/platform.m4 create mode 100644 server/sysv/SUSE/sssd delete mode 100644 server/sysv/sssd.SUSE (limited to 'server') diff --git a/server/Makefile.am b/server/Makefile.am index c43eb470b..8f36f72d0 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -113,6 +113,7 @@ pyexec_LTLIBRARIES = \ endif dist_noinst_SCRIPTS = \ + $(EXTRA_SCRIPTS) \ config/setup.py \ config/ipachangeconf.py \ config/SSSDConfig.py @@ -750,8 +751,15 @@ SUFFIXES = .1.xml .1 .3.xml .3 .5.xml .5 .8.xml .8 # Installation Extras # ####################### -dist_init_SCRIPTS = \ - sysv/sssd +dist_init_SCRIPTS = +if HAVE_SUSE + dist_init_SCRIPTS += \ + sysv/SUSE/sssd +else + dist_init_SCRIPTS += \ + sysv/sssd +endif + dist_sssdconf_DATA = \ config/etc/sssd.api.conf diff --git a/server/configure.ac b/server/configure.ac index 696a5a461..e471c845b 100644 --- a/server/configure.ac +++ b/server/configure.ac @@ -55,6 +55,7 @@ WITH_KRB5_PLUGIN_PATH WITH_PYTHON_BINDINGS WITH_SELINUX +m4_include([external/platform.m4]) m4_include([external/pkg.m4]) m4_include([external/libpopt.m4]) m4_include([external/libtalloc.m4]) diff --git a/server/external/platform.m4 b/server/external/platform.m4 new file mode 100644 index 000000000..71b4f2c85 --- /dev/null +++ b/server/external/platform.m4 @@ -0,0 +1,29 @@ +AC_ARG_WITH([os], + [AC_HELP_STRING([--with-os=OS_TYPE], [Type of your operation system (fedora|redhat|suse)])] + ) +osname="" +if test x"$with_os" != x ; then + if test x"$with_os" == xfedora -o \ + x"$with_os" == xredhat -o \ + x"$with_os" == xsuse ; then + osname=$with_os + else + AC_MSG_ERROR([Illegal value -$with_os- for option --with-os]) + fi +fi + +if test x"$osname" = x ; then + if test -f /etc/fedora-release ; then + osname="fedora" + elif test -f /etc/redhat-release ; then + osname="redhat" + elif test -f /etc/SuSE-release ; then + osname="suse" + fi + + AC_MSG_NOTICE([Detected operation system type: $osname]) +fi + +AM_CONDITIONAL([HAVE_FEDORA], [test x"$osname" == xfedora]) +AM_CONDITIONAL([HAVE_REDHAT], [test x"$osname" == xredhat]) +AM_CONDITIONAL([HAVE_SUSE], [test x"$osname" == xsuse]) diff --git a/server/sysv/SUSE/sssd b/server/sysv/SUSE/sssd new file mode 100644 index 000000000..34fd837b6 --- /dev/null +++ b/server/sysv/SUSE/sssd @@ -0,0 +1,78 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: sssd +# Required-Start: $remote_fs $time +# Should-Start: $syslog +# Should-Stop: $syslog +# Required-Stop: $remote_fs +# Default-Start: 3 5 +# Default-Stop: 0 1 2 4 6 +# Short-Description: System Security Services Daemon +# Description: Provides a set of daemons to manage access to remote directories +# and authentication mechanisms. It provides an NSS and PAM +# interface toward the system and a pluggable backend system to +# connect to multiple different account sources. It is also the +# basis to provide client auditing and policy services for projects +# like FreeIPA. +### END INIT INFO + +RETVAL=0 +prog="sssd" + +# Source function library. +. /etc/rc.status +rc_reset + +SSSD=/usr/sbin/sssd +PID_FILE=/var/run/sssd.pid + +case "$1" in + start) + echo -n "Starting $prog " + /sbin/startproc $SSSD -D 2>/dev/null + rc_status -v + ;; + + stop) + echo -n "Shutting down $prog " + /sbin/killproc -p $PID_FILE $SSSD -TERM + rc_status -v + ;; + + restart) + $0 stop + $0 start + rc_status + ;; + + reload) + echo -n "Reload service $prog " + killproc $SSSD -HUP + rc_status -v + ;; + + force-reload) + $0 reload + ;; + + status) + echo -n "Checking for service $prog" + /sbin/checkproc $SSSD + rc_status -v + ;; + + condrestart|try-restart) + $0 status + if test $? = 0; then + $0 restart + else + rc_reset # Not running is not a failure. + fi + rc_status + ;; + *) + echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 1 +esac +rc_exit + diff --git a/server/sysv/sssd.SUSE b/server/sysv/sssd.SUSE deleted file mode 100644 index 34fd837b6..000000000 --- a/server/sysv/sssd.SUSE +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: sssd -# Required-Start: $remote_fs $time -# Should-Start: $syslog -# Should-Stop: $syslog -# Required-Stop: $remote_fs -# Default-Start: 3 5 -# Default-Stop: 0 1 2 4 6 -# Short-Description: System Security Services Daemon -# Description: Provides a set of daemons to manage access to remote directories -# and authentication mechanisms. It provides an NSS and PAM -# interface toward the system and a pluggable backend system to -# connect to multiple different account sources. It is also the -# basis to provide client auditing and policy services for projects -# like FreeIPA. -### END INIT INFO - -RETVAL=0 -prog="sssd" - -# Source function library. -. /etc/rc.status -rc_reset - -SSSD=/usr/sbin/sssd -PID_FILE=/var/run/sssd.pid - -case "$1" in - start) - echo -n "Starting $prog " - /sbin/startproc $SSSD -D 2>/dev/null - rc_status -v - ;; - - stop) - echo -n "Shutting down $prog " - /sbin/killproc -p $PID_FILE $SSSD -TERM - rc_status -v - ;; - - restart) - $0 stop - $0 start - rc_status - ;; - - reload) - echo -n "Reload service $prog " - killproc $SSSD -HUP - rc_status -v - ;; - - force-reload) - $0 reload - ;; - - status) - echo -n "Checking for service $prog" - /sbin/checkproc $SSSD - rc_status -v - ;; - - condrestart|try-restart) - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - rc_status - ;; - *) - echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - exit 1 -esac -rc_exit - -- cgit