From da5014cb5f3d06271ae79dc28354a03c7392cf0f Mon Sep 17 00:00:00 2001 From: Trent Lloyd Date: Tue, 23 Aug 2005 08:16:13 +0000 Subject: [PATCH] * Clean up init script handling stuff * Add archlinux support git-svn-id: file:///home/lennart/svn/public/avahi/trunk@406 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- configure.ac | 72 +++++++++++++------------ initscript/Makefile.am | 4 ++ initscript/archlinux/Makefile.am | 40 ++++++++++++++ initscript/archlinux/avahi-daemon.in | 74 ++++++++++++++++++++++++++ initscript/archlinux/avahi-dnsconfd.in | 74 ++++++++++++++++++++++++++ 5 files changed, 230 insertions(+), 34 deletions(-) create mode 100644 initscript/archlinux/Makefile.am create mode 100644 initscript/archlinux/avahi-daemon.in create mode 100755 initscript/archlinux/avahi-dnsconfd.in diff --git a/configure.ac b/configure.ac index 9feaea6..8cb6f2a 100644 --- a/configure.ac +++ b/configure.ac @@ -46,6 +46,37 @@ AC_PROG_GCC_TRADITIONAL # libtool stuff AC_PROG_LIBTOOL +# +# Detecting the linux distro for specific things like initscripts. +# +AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the Linux distribution to target: One of debian, archlinux or none])) +if test "z$with_distro" = "z"; then + #AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse") + #AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo") + AC_CHECK_FILE(/etc/arch-version,with_distro="archlinux") + AC_CHECK_FILE(/etc/debian_version,with_distro="debian") +fi +with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' ` + +if test "z$with_distro" = "z"; then + echo "Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO" + exit 1 +else +case $with_distro in + debian|arch) + ;; + *) + echo "Your distribution (${with_distro}) is not yet supported, init scripts and dbus configuration will not be installed! (patches welcome)" + ;; +esac +fi + +#AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse) +#AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo) +AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian) +AM_CONDITIONAL(TARGET_ARCHLINUX, test x"$with_distro" = xarchlinux) + + test_gcc_flag() { AC_LANG_CONFTEST([int main() {}]) $CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null @@ -57,7 +88,13 @@ test_gcc_flag() { # If using GCC specify some additional parameters if test "x$GCC" = "xyes" ; then - DESIRED_FLAGS="-std=c99 -Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wlarger-than-4000 -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter" + DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wlarger-than-4000 -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter" + + # Work around a kernel header bug in arch linux where rtnetlink.h + # can't be included with -std=c99 + if test "x$with_distro" != "xarchlinux" ; then + DESIRED_FLAGS="$DESIRED_FLAGS -std=c99" + fi for flag in $DESIRED_FLAGS ; do AC_MSG_CHECKING([whether $CC accepts $flag]) @@ -231,39 +268,6 @@ if test "x$HAVE_PYTHON" = "xyes" ; then fi AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = "xyes" ]) -# -# Detecting the linux distro for specific things like initscripts. -# -AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the Linux distribution to target: One of redhat, suse, gentoo, debian, slackware or none])) -if test "z$with_distro" = "z"; then - AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat") - AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse") - AC_CHECK_FILE(/etc/fedora-release,with_distro="redhat") - AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo") - AC_CHECK_FILE(/etc/debian_version,with_distro="debian") - AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware") -fi -with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' ` - -if test "z$with_distro" = "z"; then - echo "Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO" - exit 1 -else -case $with_distro in - debian|gentoo|suse) - ;; - *) - echo "Your distribution (${with_distro}) is not yet supported, init scripts and dbus configuration will not be installed! (patches welcome)" - ;; -esac - -fi -AM_CONDITIONAL(TARGET_REDHAT, test x"$with_distro" = xredhat) -AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse) -AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo) -AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian) -AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware) - # # Defining Avahi User and Group. # diff --git a/initscript/Makefile.am b/initscript/Makefile.am index 2ce1076..eb5c75d 100644 --- a/initscript/Makefile.am +++ b/initscript/Makefile.am @@ -23,6 +23,10 @@ if TARGET_DEBIAN SUBDIRS += Debian endif +if TARGET_ARCHLINUX +SUBDIRS += archlinux +endif + # We disable shipping of Gentoo and SUSE init scripts for now as they are out of date #if TARGET_GENTOO diff --git a/initscript/archlinux/Makefile.am b/initscript/archlinux/Makefile.am new file mode 100644 index 0000000..22096b4 --- /dev/null +++ b/initscript/archlinux/Makefile.am @@ -0,0 +1,40 @@ +# $Id: Makefile.am 267 2005-08-08 10:19:22Z lennart $ + +# This file is part of avahi. +# +# avahi is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# avahi is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with avahi; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. + +initddir = $(sysconfdir)/rc.d + +EXTRA_DIST = \ + avahi-daemon.in \ + avahi-dnsconfd.in + +initd_SCRIPTS = \ + avahi-daemon \ + avahi-dnsconfd + +CLEANFILES = \ + avahi-daemon \ + avahi-dnsconfd + +avahi-daemon: avahi-daemon.in + sed -e 's,@sbindir\@,$(sbindir),g' $< > $@ + chmod +x $@ + +avahi-dnsconfd: avahi-dnsconfd.in + sed -e 's,@sbindir\@,$(sbindir),g' $< > $@ + chmod +x $@ diff --git a/initscript/archlinux/avahi-daemon.in b/initscript/archlinux/avahi-daemon.in new file mode 100644 index 0000000..020db3e --- /dev/null +++ b/initscript/archlinux/avahi-daemon.in @@ -0,0 +1,74 @@ +#!/bin/bash + +# $Id$ + +# This file is part of avahi. +# +# avahi is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# avahi is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with avahi; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. + +# +# Authors: +# + + +# general config +. /etc/rc.conf +. /etc/rc.d/functions + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +DESC="Avahi mDNS/DNS-SD Daemon" +NAME="avahi-daemon" +DAEMON="@sbindir@/$NAME" + +case "$1" in + start) + stat_busy "Starting $DESC" + $DAEMON -D + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon avahi-daemon + stat_done + fi + ;; + stop) + stat_busy "Stopping $DESC" + $DAEMON -k + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon avahi-daemon + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + reload) + stat_busy "Reloading services for $DESC" + $DAEMON -r + if [ $? -gt 0 ]; then + stat_fail + else + stat_done + endif + *) + echo "usage: $0 {start|stop|restart|reload}" + ;; +esac +exit 0 diff --git a/initscript/archlinux/avahi-dnsconfd.in b/initscript/archlinux/avahi-dnsconfd.in new file mode 100755 index 0000000..5bfbcbf --- /dev/null +++ b/initscript/archlinux/avahi-dnsconfd.in @@ -0,0 +1,74 @@ +#!/bin/bash + +# $Id$ + +# This file is part of avahi. +# +# avahi is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# avahi is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with avahi; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. + +# +# Authors: +# + + +# general config +. /etc/rc.conf +. /etc/rc.d/functions + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +DESC="Avahi mDNS/DNS-SD DNS Server Configuration Daemon" +NAME="avahi-dnsconfd" +DAEMON="@sbindir@/$NAME" + +case "$1" in + start) + stat_busy "Starting $DESC" + $DAEMON -D + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon avahi-daemon + stat_done + fi + ;; + stop) + stat_busy "Stopping $DESC" + $DAEMON -k + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon avahi-daemon + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + reload) + stat_busy "Reloading services for $DESC" + $DAEMON -r + if [ $? -gt 0 ]; then + stat_fail + else + stat_done + endif + *) + echo "usage: $0 {start|stop|restart|reload}" + ;; +esac +exit 0 -- 2.39.5