From c19ece348e308b47bd99aad2f4e98c691e78d15d Mon Sep 17 00:00:00 2001 From: William Immendorf Date: Sun, 5 Apr 2009 20:38:00 +0200 Subject: [PATCH] add init script for LFS --- configure.ac | 7 ++++-- initscript/Makefile.am | 4 ++++ initscript/lfs/Makefile.am | 29 ++++++++++++++++++++++ initscript/lfs/avahi.in | 49 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 initscript/lfs/Makefile.am create mode 100644 initscript/lfs/avahi.in diff --git a/configure.ac b/configure.ac index b6e44b3..404f283 100644 --- a/configure.ac +++ b/configure.ac @@ -244,11 +244,12 @@ AC_TRY_COMPILE([#include ], [ # # Detecting the linux distribution for specific things like init scripts. # -AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of debian, gentoo, archlinux, fedora, mandriva, darwin, netbsd, freebsd, slackware or none])) +AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of lfs, debian, gentoo, archlinux, fedora, mandriva, darwin, netbsd, freebsd, slackware or none])) if test "z$with_distro" = "z"; then if test "$cross_compiling" = yes; then AC_MSG_WARN([Target distribution cannot be reliably detected when cross-compiling. You should specify it with --with-distro (see $0 --help for recognized distros)]) else + AC_CHECK_FILE(/etc/lfs-release,with_distro="lfs") AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse") AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo") AC_CHECK_FILE(/etc/arch-release,with_distro="archlinux") @@ -264,7 +265,7 @@ fi with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' ` case $with_distro in - debian|gentoo|archlinux|suse|fedora|mandriva|darwin|freebsd|slackware|none) + lfs|debian|gentoo|archlinux|suse|fedora|mandriva|darwin|freebsd|slackware|none) ;; netbsd) AC_MSG_WARN([Your distribution (${with_distro}) is supported but no init script exist yet! (patches welcome)]) @@ -277,6 +278,7 @@ case $with_distro in ;; esac +AM_CONDITIONAL(TARGET_LFS, test x"$with_distro" = xlfs) 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) @@ -1063,6 +1065,7 @@ initscript/gentoo/Makefile initscript/archlinux/Makefile initscript/suse/Makefile initscript/fedora/Makefile +initscript/lfs/Makefile initscript/mandriva/Makefile initscript/darwin/Makefile initscript/freebsd/Makefile diff --git a/initscript/Makefile.am b/initscript/Makefile.am index 7fcd15f..d5fadda 100644 --- a/initscript/Makefile.am +++ b/initscript/Makefile.am @@ -19,6 +19,10 @@ SUBDIRS = +if TARGET_LFS +SUBDIRS += lfs +endif + if TARGET_DEBIAN SUBDIRS += debian endif diff --git a/initscript/lfs/Makefile.am b/initscript/lfs/Makefile.am new file mode 100644 index 0000000..d5e33f8 --- /dev/null +++ b/initscript/lfs/Makefile.am @@ -0,0 +1,29 @@ +# $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. + +initddir = $(sysconfdir)/rc.d/init.d + +EXTRA_DIST = avahi.in + +initd_SCRIPTS = avahi + +CLEANFILES = avahi + +avahi: avahi.in + chmod +x $@ diff --git a/initscript/lfs/avahi.in b/initscript/lfs/avahi.in new file mode 100644 index 0000000..ba3672a --- /dev/null +++ b/initscript/lfs/avahi.in @@ -0,0 +1,49 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/avahi +# +# Description : Avahi daemon loader +# +# Authors : William Immendorf - will.immendorf@gmail.com +# +# Version : 00.00 +# +# Notes : Based off of the LFS 6.4 sysklogd script. +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + start) + boot_mesg "Starting the Avahi daemon..." + loadproc avahi-daemon -D + ;; + + stop) + boot_mesg "Stopping the Avahi daemon..." + avahi-daemon -k + evaluate_retval + ;; + + reload) + boot_mesg "Reloading the Avahi daemon..." + reloadproc avahi-daemon -r + ;; + restart) + ${0} stop + sleep 1 + ${0} start + ;; + + status) + statusproc avahi-daemon + ;; + *) + echo "Usage: ${0} {start|stop|reload|restart|status}" + exit 1 + ;; +esac + +# End $rc_base/init.d/avahi -- 2.39.2