aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-01-11 10:55:36 +0000
committerRoy Marples <roy@marples.name>2008-01-11 10:55:36 +0000
commit13c552c3ece84b0d4e3b8e24eaa6b7196019b957 (patch)
tree83e9094e446624f94fa41ff5dc276027a825e915
parent349f4a81e64d8c29d87490b73a65ad10c8e506e2 (diff)
Allow OS to define default package locations.
-rw-r--r--Makefile2
-rw-r--r--init.d.misc/Makefile28
-rw-r--r--init.d.misc/Makefile.FreeBSD1
-rw-r--r--init.d.misc/Makefile.Linux1
-rw-r--r--init.d.misc/Makefile.NetBSD1
-rw-r--r--[-rwxr-xr-x]init.d.misc/avahi-dnsconfd.in (renamed from init.d.misc/avahi-dnsconfd)4
-rw-r--r--[-rwxr-xr-x]init.d.misc/avahid.in (renamed from init.d.misc/avahid)4
-rw-r--r--init.d.misc/dbus.in (renamed from init.d.misc/dbus)4
-rw-r--r--init.d.misc/dnsmasq.in (renamed from init.d.misc/dnsmasq)6
-rw-r--r--init.d.misc/hald.in (renamed from init.d.misc/hald)4
-rw-r--r--init.d.misc/named.in (renamed from init.d.misc/named)2
-rw-r--r--init.d.misc/ntpd.in (renamed from init.d.misc/ntpd)0
-rw-r--r--[-rwxr-xr-x]init.d.misc/openvpn.in (renamed from init.d.misc/openvpn)22
-rw-r--r--init.d.misc/polkitd.in (renamed from init.d.misc/polkitd)4
-rw-r--r--init.d.misc/sshd.in (renamed from init.d.misc/sshd)4
-rw-r--r--mk/os.mk3
-rw-r--r--mk/scripts.mk2
-rw-r--r--runlevels/Makefile2
18 files changed, 54 insertions, 40 deletions
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
index 0db2731c..f857914c 100755..100644
--- 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
index df1d32d7..8444fbd3 100755..100644
--- 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
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
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
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
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
index de1ccb38..de1ccb38 100644
--- a/init.d.misc/ntpd
+++ b/init.d.misc/ntpd.in
diff --git a/init.d.misc/openvpn b/init.d.misc/openvpn.in
index 591464c7..017dcf73 100755..100644
--- 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
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
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: