From 13c552c3ece84b0d4e3b8e24eaa6b7196019b957 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 11 Jan 2008 10:55:36 +0000 Subject: [PATCH] Allow OS to define default package locations. --- Makefile | 2 -- init.d.misc/Makefile | 28 ++++++++++++++++--- init.d.misc/Makefile.FreeBSD | 1 + init.d.misc/Makefile.Linux | 1 + init.d.misc/Makefile.NetBSD | 1 + .../{avahi-dnsconfd => avahi-dnsconfd.in} | 4 +-- init.d.misc/{avahid => avahid.in} | 4 +-- init.d.misc/{dbus => dbus.in} | 4 +-- init.d.misc/{dnsmasq => dnsmasq.in} | 6 ++-- init.d.misc/{hald => hald.in} | 4 +-- init.d.misc/{named => named.in} | 2 +- init.d.misc/{ntpd => ntpd.in} | 0 init.d.misc/{openvpn => openvpn.in} | 22 ++++++--------- init.d.misc/{polkitd => polkitd.in} | 4 +-- init.d.misc/{sshd => sshd.in} | 4 +-- mk/os.mk | 3 ++ mk/scripts.mk | 2 -- runlevels/Makefile | 2 -- 18 files changed, 54 insertions(+), 40 deletions(-) create mode 100644 init.d.misc/Makefile.FreeBSD create mode 100644 init.d.misc/Makefile.Linux create mode 100644 init.d.misc/Makefile.NetBSD rename init.d.misc/{avahi-dnsconfd => avahi-dnsconfd.in} (94%) mode change 100755 => 100644 rename init.d.misc/{avahid => avahid.in} (95%) mode change 100755 => 100644 rename init.d.misc/{dbus => dbus.in} (95%) rename init.d.misc/{dnsmasq => dnsmasq.in} (93%) rename init.d.misc/{hald => hald.in} (95%) rename init.d.misc/{named => named.in} (99%) rename init.d.misc/{ntpd => ntpd.in} (100%) rename init.d.misc/{openvpn => openvpn.in} (88%) mode change 100755 => 100644 rename init.d.misc/{polkitd => polkitd.in} (95%) rename init.d.misc/{sshd => sshd.in} (97%) diff --git a/Makefile b/Makefile index 6eb7a463..4d9a818e 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,6 @@ PKG= ${NAME}-${VERSION} SUBDIR= conf.d doc etc init.d man net runlevels sh src -INSTALL?= install - INSTALLAFTER= _installafter MK= mk diff --git a/init.d.misc/Makefile b/init.d.misc/Makefile index c50e550a..693f9134 100644 --- a/init.d.misc/Makefile +++ b/init.d.misc/Makefile @@ -1,5 +1,25 @@ -DIR = /etc/init.d -BIN = $(CONTENTS) +DIR= /etc/init.d +_SRCS!= ls *.in +SRCS?= ${_SRCS}$(shell ls *.in) +OBJS= ${SRCS:.in=} -TOPDIR = .. -include $(TOPDIR)/default.mk +MK= ../mk +include ${MK}/os.mk +include Makefile.${OS} + +VARBASE?= /var + +.SUFFIXES: .in + +all: ${OBJS} + +.in: + sed -e s':@PREFIX@:${PREFIX}:' -e 's:@VARBASE@:${VARBASE}:' $< > $@ + +install: all + for x in ${OBJS}; do \ + ${INSTALL} work/$$x ${DESTDIR}${DIR}; \ + done + +clean: + rm -f ${OBJS} diff --git a/init.d.misc/Makefile.FreeBSD b/init.d.misc/Makefile.FreeBSD new file mode 100644 index 00000000..69d25e05 --- /dev/null +++ b/init.d.misc/Makefile.FreeBSD @@ -0,0 +1 @@ +PREFIX?= /usr/local diff --git a/init.d.misc/Makefile.Linux b/init.d.misc/Makefile.Linux new file mode 100644 index 00000000..8cc7e216 --- /dev/null +++ b/init.d.misc/Makefile.Linux @@ -0,0 +1 @@ +PREFIX=/usr diff --git a/init.d.misc/Makefile.NetBSD b/init.d.misc/Makefile.NetBSD new file mode 100644 index 00000000..4c7dec3f --- /dev/null +++ b/init.d.misc/Makefile.NetBSD @@ -0,0 +1 @@ +PREFIX?= /usr/pkg diff --git a/init.d.misc/avahi-dnsconfd b/init.d.misc/avahi-dnsconfd.in old mode 100755 new mode 100644 similarity index 94% rename from init.d.misc/avahi-dnsconfd rename to init.d.misc/avahi-dnsconfd.in index 0db2731c..f857914c --- a/init.d.misc/avahi-dnsconfd +++ b/init.d.misc/avahi-dnsconfd.in @@ -23,9 +23,9 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -command=/usr/local/sbin/avahi-dnsconfd +command=@PREFIX@/sbin/avahi-dnsconfd command_args="${avahi_dnsconfd_args} -D" -pidfile=/var/run/avahi-dnsconfd.pid +pidfile=@VARBASE@/run/avahi-dnsconfd.pid name="Avahi DNS Configuration Daemon" depend() { diff --git a/init.d.misc/avahid b/init.d.misc/avahid.in old mode 100755 new mode 100644 similarity index 95% rename from init.d.misc/avahid rename to init.d.misc/avahid.in index df1d32d7..8444fbd3 --- a/init.d.misc/avahid +++ b/init.d.misc/avahid.in @@ -23,9 +23,9 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -command=/usr/local/sbin/avahi-daemon +command=@PREFIX@%%/sbin/avahi-daemon command_args="${avahid_args} -D" -pidfile=/var/run/avahi-daemon/pid +pidfile=@VARBASE@/run/avahi-daemon/pid name="Avahi Service Advertisement Daemon" depend() { diff --git a/init.d.misc/dbus b/init.d.misc/dbus.in similarity index 95% rename from init.d.misc/dbus rename to init.d.misc/dbus.in index be707f89..aa387b35 100644 --- a/init.d.misc/dbus +++ b/init.d.misc/dbus.in @@ -23,8 +23,8 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -command=/usr/local/bin/dbus-daemon -pidfile=/var/run/dbus/dbus.pid +command=@PREFIX@%%/bin/dbus-daemon +pidfile=@VARBASE@/run/dbus/dbus.pid command_args="${dbusd_args---system}" name="Message Bus Daemon" diff --git a/init.d.misc/dnsmasq b/init.d.misc/dnsmasq.in similarity index 93% rename from init.d.misc/dnsmasq rename to init.d.misc/dnsmasq.in index 960c5fae..9e88b8fe 100644 --- a/init.d.misc/dnsmasq +++ b/init.d.misc/dnsmasq.in @@ -23,10 +23,10 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -command=/usr/local/sbin/dnsmasq +command=@PREFIX@/sbin/dnsmasq command_args=${dnsmasq_args} -pidfile=/var/run/dnsmasq.pid -required_files=/usr/local/etc/dnsmasq.conf +pidfile=@VARBASE@/run/dnsmasq.pid +required_files=/etc/dnsmasq.conf extra_started_commands="reload" diff --git a/init.d.misc/hald b/init.d.misc/hald.in similarity index 95% rename from init.d.misc/hald rename to init.d.misc/hald.in index e6a9b2d2..70e702df 100644 --- a/init.d.misc/hald +++ b/init.d.misc/hald.in @@ -23,8 +23,8 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -command=/usr/local/sbin/hald -pidfile=/var/run/hald/hald.pid +command=@PREFIX@/sbin/hald +pidfile=@VARBASE@/run/hald/hald.pid command_args="${hald_args}" name="Hardware Abstraction Layer Daemon" diff --git a/init.d.misc/named b/init.d.misc/named.in similarity index 99% rename from init.d.misc/named rename to init.d.misc/named.in index 1b8f1906..ae17b198 100644 --- a/init.d.misc/named +++ b/init.d.misc/named.in @@ -25,7 +25,7 @@ command=/usr/sbin/named command_args=${named_args} -pidfile=/var/run/named/pid +pidfile=@VARBASE@/run/named/pid name="Domain Name server" extra_started_commands="reload" diff --git a/init.d.misc/ntpd b/init.d.misc/ntpd.in similarity index 100% rename from init.d.misc/ntpd rename to init.d.misc/ntpd.in diff --git a/init.d.misc/openvpn b/init.d.misc/openvpn.in old mode 100755 new mode 100644 similarity index 88% rename from init.d.misc/openvpn rename to init.d.misc/openvpn.in index 591464c7..017dcf73 --- a/init.d.misc/openvpn +++ b/init.d.misc/openvpn.in @@ -23,21 +23,13 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -if [ -z "${openvpn_dir}" ]; then - if [ -d /usr/local/etc/openvpn ]; then - openvpn_dir=/usr/local/etc/openvpn - else - openvpn_dir=/etc/openvpn - fi -fi - vpn=${SVCNAME#*.} name="OpenVPN" [ "${vpn}" != "openvpn" ] && name="${name} (${vpn})" -command=/usr/sbin/openvpn -[ -x ${command} ] || command=/usr/local/sbin/openvpn +command=@PREFIX/sbin/openvpn -pidfile="/var/run/${SVCNAME}.pid" +pidfile=@VARBASE@/run/"${SVCNAME}".pid +openvpn_dir=${openvpn_dir:-@PREFIX@/etc/openvpn} openvpn_config=${openvpn_config:-${openvpn_dir}/${vpn}.conf} command_args="${openvpn_args} --daemon --config ${openvpn_config} --writepid ${pidfile}" required_dirs="${openvpn_dir}" @@ -78,9 +70,11 @@ start_pre() { eend $? fi else - # Hammer the modules home by default - sysctl -a | grep -q '\.tun\.' || kldload if_tun - sysctl -a | grep -q '\.tap\.' || kldload if_tap + if type kldload >/dev/null 2>&1; then + # Hammer the modules home by default + sysctl -a | grep -q '\.tun\.' || kldload if_tun + sysctl -a | grep -q '\.tap\.' || kldload if_tap + fi fi # If the config file does not specify the cd option, we do diff --git a/init.d.misc/polkitd b/init.d.misc/polkitd.in similarity index 95% rename from init.d.misc/polkitd rename to init.d.misc/polkitd.in index c1e336e0..0e697f13 100644 --- a/init.d.misc/polkitd +++ b/init.d.misc/polkitd.in @@ -23,8 +23,8 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -command=/usr/local/sbin/polkitd -pidfile=/var/run/polkitd/polkitd.pid +command=@PREFIX@/sbin/polkitd +pidfile=@VARBASE@/run/polkitd/polkitd.pid command_args="${polkitd_args}" name="PolicyKit Daemon" diff --git a/init.d.misc/sshd b/init.d.misc/sshd.in similarity index 97% rename from init.d.misc/sshd rename to init.d.misc/sshd.in index 4a050617..8d5139bf 100644 --- a/init.d.misc/sshd +++ b/init.d.misc/sshd.in @@ -25,9 +25,9 @@ command=/usr/sbin/sshd command_args=${sshd_args} -pidfile=/var/run/sshd.pid +pidfile=@VARBASE@/run/sshd.pid required_files=/etc/ssh/sshd_config -required_dirs=/var/empty +required_dirs=@VARBASE@/empty depend() { use logger dns diff --git a/mk/os.mk b/mk/os.mk index 2de3bc61..f2499416 100644 --- a/mk/os.mk +++ b/mk/os.mk @@ -29,3 +29,6 @@ LIBDL?= ${_LIBDL}$(shell ${_LIBDL_SH}) _LIBKVM_SH= case `uname -s` in *BSD) echo "-lkvm";; *) echo;; esac _LIBKVM!= ${_LIBKVM_SH} LIBKVM?= ${_LIBKVM}$(shell ${_LIBKVM_SH}) + +# Maye as well define INSTALL here as everything uses us +INSTALL?= install diff --git a/mk/scripts.mk b/mk/scripts.mk index 806a5453..c7254aed 100644 --- a/mk/scripts.mk +++ b/mk/scripts.mk @@ -6,8 +6,6 @@ _CONTENTS_SH= ls -1 | grep -v Makefile | xargs _CONTENTS!= ${_CONTENTS_SH} CONTENTS= ${_CONTENTS}$(shell ${_CONTENTS_SH}) -INSTALL?= install - include ${MK}/os.mk all: diff --git a/runlevels/Makefile b/runlevels/Makefile index 2640d040..e6ca09d4 100644 --- a/runlevels/Makefile +++ b/runlevels/Makefile @@ -11,8 +11,6 @@ include ${MK}/os.mk include Makefile.${OS} include Makefile.${SUBOS} -INSTALL?= install - all: install: