diff --git a/Makefile b/Makefile index 6d5e562e..58ab0987 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,9 @@ NAME= openrc VERSION= 0.1 PKG= ${NAME}-${VERSION} -SUBDIR= conf.d doc etc init.d man net runlevels sh src +SUBDIR= conf.d doc etc init.d man net sh src +# We need to ensure that runlevels is done last +SUBDIR+= runlevels INSTALLAFTER= _installafter diff --git a/init.d.BSD/hostid.in b/init.d.BSD/hostid.in index 7d093a42..a0588848 100644 --- a/init.d.BSD/hostid.in +++ b/init.d.BSD/hostid.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.BSD/moused.in b/init.d.BSD/moused.in index 9e8c20f6..c36110de 100644 --- a/init.d.BSD/moused.in +++ b/init.d.BSD/moused.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.BSD/newsyslog.in b/init.d.BSD/newsyslog.in index 4f7ade8c..019683e8 100644 --- a/init.d.BSD/newsyslog.in +++ b/init.d.BSD/newsyslog.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.BSD/pf.in b/init.d.BSD/pf.in index daca82a8..fa55ea48 100644 --- a/init.d.BSD/pf.in +++ b/init.d.BSD/pf.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.BSD/rarpd.in b/init.d.BSD/rarpd.in index 837e020a..e7510990 100644 --- a/init.d.BSD/rarpd.in +++ b/init.d.BSD/rarpd.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.BSD/rc-enabled.in b/init.d.BSD/rc-enabled.in index 77366f24..ab21b4ae 100644 --- a/init.d.BSD/rc-enabled.in +++ b/init.d.BSD/rc-enabled.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.BSD/rpcbind.in b/init.d.BSD/rpcbind.in index 1ac38737..2d053ebd 100644 --- a/init.d.BSD/rpcbind.in +++ b/init.d.BSD/rpcbind.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.BSD/savecore.in b/init.d.BSD/savecore.in index f37e0d26..e23bde48 100644 --- a/init.d.BSD/savecore.in +++ b/init.d.BSD/savecore.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.BSD/swap-blk.in b/init.d.BSD/swap-blk.in index a38bae98..4708bfff 100644 --- a/init.d.BSD/swap-blk.in +++ b/init.d.BSD/swap-blk.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.BSD/sysctl.in b/init.d.BSD/sysctl.in index 1de4c930..b1d8fb83 100644 --- a/init.d.BSD/sysctl.in +++ b/init.d.BSD/sysctl.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.BSD/syslogd.in b/init.d.BSD/syslogd.in index e90ba1a9..a27461c6 100644 --- a/init.d.BSD/syslogd.in +++ b/init.d.BSD/syslogd.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.FreeBSD/clock.in b/init.d.FreeBSD/clock.in index 3a2c050b..4e98e3ae 100644 --- a/init.d.FreeBSD/clock.in +++ b/init.d.FreeBSD/clock.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.FreeBSD/devd.in b/init.d.FreeBSD/devd.in index 3c312845..40ec01b7 100644 --- a/init.d.FreeBSD/devd.in +++ b/init.d.FreeBSD/devd.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.FreeBSD/dumpon.in b/init.d.FreeBSD/dumpon.in index c34c76c2..f2b65308 100644 --- a/init.d.FreeBSD/dumpon.in +++ b/init.d.FreeBSD/dumpon.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.FreeBSD/ipfw.in b/init.d.FreeBSD/ipfw.in index 200b9cee..33bafab7 100644 --- a/init.d.FreeBSD/ipfw.in +++ b/init.d.FreeBSD/ipfw.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.FreeBSD/mixer.in b/init.d.FreeBSD/mixer.in index b8c8f3af..91a8ae2b 100644 --- a/init.d.FreeBSD/mixer.in +++ b/init.d.FreeBSD/mixer.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.FreeBSD/nscd.in b/init.d.FreeBSD/nscd.in index e75f5dc9..e70ba4a3 100644 --- a/init.d.FreeBSD/nscd.in +++ b/init.d.FreeBSD/nscd.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.FreeBSD/powerd.in b/init.d.FreeBSD/powerd.in index 106962a6..0e8dc2c0 100644 --- a/init.d.FreeBSD/powerd.in +++ b/init.d.FreeBSD/powerd.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.FreeBSD/syscons.in b/init.d.FreeBSD/syscons.in index 039675b2..94c91a06 100644 --- a/init.d.FreeBSD/syscons.in +++ b/init.d.FreeBSD/syscons.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.Linux/clock.in b/init.d.Linux/clock.in index ea7ad2bf..88c61c79 100644 --- a/init.d.Linux/clock.in +++ b/init.d.Linux/clock.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.Linux/consolefont.in b/init.d.Linux/consolefont.in index 37f1feef..4244180b 100644 --- a/init.d.Linux/consolefont.in +++ b/init.d.Linux/consolefont.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.Linux/keymaps.in b/init.d.Linux/keymaps.in index 827b5505..bb601c6e 100644 --- a/init.d.Linux/keymaps.in +++ b/init.d.Linux/keymaps.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.Linux/modules.in b/init.d.Linux/modules.in index 825ca493..3f0e0dab 100644 --- a/init.d.Linux/modules.in +++ b/init.d.Linux/modules.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.Linux/mtab.in b/init.d.Linux/mtab.in index cd3e1b98..a0f14b1e 100644 --- a/init.d.Linux/mtab.in +++ b/init.d.Linux/mtab.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.Linux/numlock.in b/init.d.Linux/numlock.in index 5f9d55df..fd23ede8 100644 --- a/init.d.Linux/numlock.in +++ b/init.d.Linux/numlock.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.Linux/procfs.in b/init.d.Linux/procfs.in index 40878639..d286ca94 100644 --- a/init.d.Linux/procfs.in +++ b/init.d.Linux/procfs.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.Linux/sysctl.in b/init.d.Linux/sysctl.in index be0b539b..19408ca1 100644 --- a/init.d.Linux/sysctl.in +++ b/init.d.Linux/sysctl.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.NetBSD/ttys.in b/init.d.NetBSD/ttys.in index 3e07de3a..8381d042 100644 --- a/init.d.NetBSD/ttys.in +++ b/init.d.NetBSD/ttys.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.NetBSD/wscons.in b/init.d.NetBSD/wscons.in index 6fee03d5..4df4fc1f 100644 --- a/init.d.NetBSD/wscons.in +++ b/init.d.NetBSD/wscons.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.misc/avahi-dnsconfd.in b/init.d.misc/avahi-dnsconfd.in index dc12688e..8153f0c4 100644 --- a/init.d.misc/avahi-dnsconfd.in +++ b/init.d.misc/avahi-dnsconfd.in @@ -1,8 +1,8 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. -command=@PREFIX@/sbin/avahi-dnsconfd +command=@PKG_PREFIX@/sbin/avahi-dnsconfd command_args="${avahi_dnsconfd_args} -D" pidfile=@VARBASE@/run/avahi-dnsconfd.pid name="Avahi DNS Configuration Daemon" diff --git a/init.d.misc/avahid.in b/init.d.misc/avahid.in index 7ef37e27..458fc0bc 100644 --- a/init.d.misc/avahid.in +++ b/init.d.misc/avahid.in @@ -1,8 +1,8 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. -command=@PREFIX@%%/sbin/avahi-daemon +command=@PKG_PREFIX@/sbin/avahi-daemon command_args="${avahid_args} -D" pidfile=@VARBASE@/run/avahi-daemon/pid name="Avahi Service Advertisement Daemon" diff --git a/init.d.misc/dbus.in b/init.d.misc/dbus.in index d0226623..1e8af36c 100644 --- a/init.d.misc/dbus.in +++ b/init.d.misc/dbus.in @@ -1,8 +1,8 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. -command=@PREFIX@%%/bin/dbus-daemon +command=@PKG_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.in b/init.d.misc/dnsmasq.in index 067b3c6c..da7b5fb6 100644 --- a/init.d.misc/dnsmasq.in +++ b/init.d.misc/dnsmasq.in @@ -1,8 +1,8 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. -command=@PREFIX@/sbin/dnsmasq +command=@PKG_PREFIX@/sbin/dnsmasq command_args=${dnsmasq_args} pidfile=@VARBASE@/run/dnsmasq.pid required_files=/etc/dnsmasq.conf diff --git a/init.d.misc/hald.in b/init.d.misc/hald.in index 591cd0ba..dd7802d1 100644 --- a/init.d.misc/hald.in +++ b/init.d.misc/hald.in @@ -1,8 +1,8 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. -command=@PREFIX@/sbin/hald +command=@PKG_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.in b/init.d.misc/named.in index 2bdbef75..390a9932 100644 --- a/init.d.misc/named.in +++ b/init.d.misc/named.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.misc/ntpd.in b/init.d.misc/ntpd.in index 618da8a4..70393239 100644 --- a/init.d.misc/ntpd.in +++ b/init.d.misc/ntpd.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d.misc/openvpn.in b/init.d.misc/openvpn.in index 9fbf03cc..9e55f42b 100644 --- a/init.d.misc/openvpn.in +++ b/init.d.misc/openvpn.in @@ -1,14 +1,14 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. vpn=${SVCNAME#*.} name="OpenVPN" [ "${vpn}" != "openvpn" ] && name="${name} (${vpn})" -command=@PREFIX@/sbin/openvpn +command=@PKG_PREFIX@/sbin/openvpn pidfile=@VARBASE@/run/"${SVCNAME}".pid -openvpn_dir=${openvpn_dir:-@PREFIX@/etc/openvpn} +openvpn_dir=${openvpn_dir:-@PKG_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}" diff --git a/init.d.misc/polkitd.in b/init.d.misc/polkitd.in index b76a88a1..a1736a98 100644 --- a/init.d.misc/polkitd.in +++ b/init.d.misc/polkitd.in @@ -1,8 +1,8 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. -command=@PREFIX@/sbin/polkitd +command=@PKG_PREFIX@/sbin/polkitd pidfile=@VARBASE@/run/polkitd/polkitd.pid command_args="${polkitd_args}" name="PolicyKit Daemon" diff --git a/init.d.misc/sshd.in b/init.d.misc/sshd.in index 41341720..8c5c8b35 100644 --- a/init.d.misc/sshd.in +++ b/init.d.misc/sshd.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in index a14a2c7e..f98cf6b9 100644 --- a/init.d/bootmisc.in +++ b/init.d/bootmisc.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d/fsck.in b/init.d/fsck.in index f34a8522..61aa947a 100644 --- a/init.d/fsck.in +++ b/init.d/fsck.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d/hostname.in b/init.d/hostname.in index 646ceb87..6266fe9e 100644 --- a/init.d/hostname.in +++ b/init.d/hostname.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d/local.in b/init.d/local.in index 9b83752d..722d9714 100644 --- a/init.d/local.in +++ b/init.d/local.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d/localmount.in b/init.d/localmount.in index bc16f702..4c7d5fd4 100644 --- a/init.d/localmount.in +++ b/init.d/localmount.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d/netmount.in b/init.d/netmount.in index 3aa46e1a..f136f45a 100644 --- a/init.d/netmount.in +++ b/init.d/netmount.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d/root.in b/init.d/root.in index b7ffbf80..da21db5c 100644 --- a/init.d/root.in +++ b/init.d/root.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d/swap.in b/init.d/swap.in index b9f4fc9b..0404af1e 100644 --- a/init.d/swap.in +++ b/init.d/swap.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d/urandom.in b/init.d/urandom.in index 6e901006..904607ae 100644 --- a/init.d/urandom.in +++ b/init.d/urandom.in @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. diff --git a/mk/scripts.mk b/mk/scripts.mk index 561545de..5693dc15 100644 --- a/mk/scripts.mk +++ b/mk/scripts.mk @@ -1,12 +1,12 @@ # Install rules for our scripts # Copyright 2007-2008 Roy Marples -_IN_SH= ls -1 | sed -n -e 's:\.in$$::p' | xargs +_IN_SH= ls -1 | sed -n -e 's:\.in$$::p' | xargs; echo _IN!= ${_IN_SH} OBJS+= ${_IN}$(shell ${_IN_SH}) # We store the contents of the directory for ease of use in Makefiles -_CONTENTS_SH= ls -1 | grep -v "\(Makefile\|.in$$\)" | sed -e 's:\.in$$::g' | xargs +_CONTENTS_SH= ls -1 | grep -v Makefile | sed -e 's:\.in$$::g' | sort -u | xargs _CONTENTS!= ${_CONTENTS_SH} CONTENTS= ${_CONTENTS}$(shell ${_CONTENTS_SH}) @@ -14,10 +14,13 @@ include ${MK}/sys.mk include ${MK}/os.mk # Tweak our shell scripts -.SUFFIXES: .sh.in +.SUFFIXES: .sh.in .in .sh.in.sh: sed -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@PKG_PREFIX@:${PKG_PREFIX}:g' $< > $@ +.in: + sed -e 's:@PREFIX@:${PREFIX}:g' -e 's:@PKG_PREFIX@:${PKG_PREFIX}:g' $< > $@ + all: ${OBJS} realinstall: ${BIN} ${CONF} ${CONF_APPEND} diff --git a/runlevels/Makefile b/runlevels/Makefile index 4634d6c4..c2cac334 100644 --- a/runlevels/Makefile +++ b/runlevels/Makefile @@ -17,11 +17,20 @@ all: install: if ! test -d "${BOOTDIR}"; then \ ${INSTALL} -d ${BOOTDIR} || exit $$?; \ - for x in ${BOOT}; do ln -snf /etc/init.d/"$$x" ${BOOTDIR}/"$$x" || exit $$?; done \ + for x in ${BOOT}; do \ + if test -n "${PREFIX}"; then \ + grep -q "keyword .*noprefix" ${PREFIX}/etc/init.d/"$$x" && continue; \ + fi; \ + ln -snf ${PREFIX}/etc/init.d/"$$x" ${BOOTDIR}/"$$x" || exit $$?; \ + done \ fi if ! test -d "${DEFAULTDIR}"; then \ ${INSTALL} -d ${DEFAULTDIR} || exit $$?; \ - for x in ${DEFAULT}; do ln -snf /etc/init.d/"$$x" ${DEFAULTDIR}/"$$x" || exit $$?; done \ + for x in ${DEFAULT}; do \ + if test -n "${PREFIX}"; then \ + grep -q "keyword .*noprefix" ${PREFIX}/etc/init.d/"$$x" && continue; \ + fi; \ + ln -snf ${PREFIX}/etc/init.d/"$$x" ${DEFAULTDIR}/"$$x" || exit $$?; done \ fi clean: diff --git a/sh/Makefile b/sh/Makefile index aae07a32..ad328027 100644 --- a/sh/Makefile +++ b/sh/Makefile @@ -13,7 +13,7 @@ include ${MK}/scripts.mk _installafter: ${INSTALL} -d ${DESTDIR}/${PREFIX}/etc/init.d @# Provide an init script for the loopback interface - ln -snf ${RC_LIB}/sh/net.sh ${DESTDIR}/${PREFIX}/etc/init.d/${NET_LO} || exit $$? + ln -snf ${PREFIX}/${RC_LIB}/sh/net.sh ${DESTDIR}/${PREFIX}/etc/init.d/${NET_LO} || exit $$? @# Put functions.sh into the init.d dir so 3rd party apps don't have to @# be multilib aware - ln -snf ${RC_LIB}/sh/functions.sh ${DESTDIR}/${PREFIX}/etc/init.d || exit $$? + ln -snf ${PREFIX}/${RC_LIB}/sh/functions.sh ${DESTDIR}/${PREFIX}/etc/init.d || exit $$? diff --git a/sh/functions.sh.in b/sh/functions.sh.in index 16e36963..b8d3c95d 100644 --- a/sh/functions.sh.in +++ b/sh/functions.sh.in @@ -43,8 +43,8 @@ _sanitize_path() local IFS=":" p= path= for p in ${PATH}; do case "${p}" in - @PREFIX@/lib/rc/sbin|/bin|/sbin|/usr/bin|/usr/sbin|@PKG_PREFIX@/bin|@PKG_PREFIX@/sbin);; - *) path="${path}:${p}";; + @PREFIX@/lib/rc/sbin|@PREFIX@/bin|@PREFIX@/sbin|/usr/bin|/usr/sbin|@PKG_PREFIX@/bin|@PKG_PREFIX@/sbin);; + *) path="${path}${path:+:}${p}";; esac done @@ -60,7 +60,7 @@ if [ -n "${ZSH_VERSION}" ]; then fi # Add our bin to $PATH -export PATH="@PREFIX@/lib/rc/bin:/bin:/sbin:/usr/bin:/usr/sbin:@PKG_PREFIX@/bin:@PKG_PREFIX@/sbin:$(_sanitize_path "${PATH}")" +export PATH="@PREFIX@/lib/rc/bin:@PREFIX@/bin:@PREFIX@/sbin:/usr/bin:/usr/sbin:@PKG_PREFIX@/bin:@PKG_PREFIX@/sbin:$(_sanitize_path "${PATH}")" unset _sanitize_path for arg; do diff --git a/sh/gendepends.sh.in b/sh/gendepends.sh.in index 8e30a648..fad7665c 100644 --- a/sh/gendepends.sh.in +++ b/sh/gendepends.sh.in @@ -4,7 +4,7 @@ # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. -. /etc/init.d/functions.sh +. @PREFIX@/etc/init.d/functions.sh config() { [ -n "$*" ] && echo "${SVCNAME} config $*" >&3 @@ -31,7 +31,7 @@ depend() { : } -for _dir in /etc/init.d /usr/local/etc/init.d; do +for _dir in @PREFIX@/etc/init.d @PKG_PREFIX@/etc/init.d; do [ -d "${_dir}" ] || continue cd "${_dir}" for SVCNAME in *; do @@ -39,7 +39,7 @@ for _dir in /etc/init.d /usr/local/etc/init.d; do # Only generate dependencies for runscripts read one two < "${SVCNAME}" - [ "${one}" = "#!/sbin/runscript" ] || continue + [ "${one}" = "#!@PREFIX@/sbin/runscript" ] || continue unset one two export SVCNAME=${SVCNAME##*/} @@ -59,7 +59,7 @@ for _dir in /etc/init.d /usr/local/etc/init.d; do . "${_dir}/../conf.d/${SVCNAME}" fi - [ -e /etc/rc.conf ] && . /etc/rc.conf + [ -e @PREFIX@/etc/rc.conf ] && . @PREFIX@/etc/rc.conf if . "${_dir}/${SVCNAME}"; then echo "${SVCNAME}" >&3 diff --git a/sh/net.sh b/sh/net.sh index acf8dba7..1fe52f19 100755 --- a/sh/net.sh +++ b/sh/net.sh @@ -1,4 +1,4 @@ -#!/sbin/runscript +#!@PREFIX@/sbin/runscript # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. @@ -21,7 +21,7 @@ depend() need localmount after bootmisc provide net - keyword nojail + keyword nojail noprefix case "${IFACE}" in lo|lo0);; diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in index 6b8c3db2..df50e881 100644 --- a/sh/runscript.sh.in +++ b/sh/runscript.sh.in @@ -4,7 +4,7 @@ # Copyright 2007-2008 Roy Marples # All rights reserved. Released under the 2-clause BSD license. -. /etc/init.d/functions.sh +. @PREFIX@/etc/init.d/functions.sh . "${RC_LIBDIR}"/sh/rc-functions.sh # Support LiveCD foo @@ -59,7 +59,7 @@ elif [ -e "/etc/conf.d/${SVCNAME}" ]; then fi # Load any system overrides -[ -e /etc/rc.conf ] && . /etc/rc.conf +[ -e @PREFIX@/etc/rc.conf ] && . @PREFIX@/etc/rc.conf # Apply any ulimit defined [ -n "${rc_ulimit:-${RC_ULIMIT}}" ] && ulimit ${rc_ulimit:-${RC_ULIMIT}}