diff options
34 files changed, 65 insertions, 64 deletions
| diff --git a/conf.d.BSD/Makefile b/conf.d.BSD/Makefile index 9bd2b26e..7131f675 100644 --- a/conf.d.BSD/Makefile +++ b/conf.d.BSD/Makefile @@ -1,4 +1,4 @@ -DIR=	/etc/conf.d +DIR=	${CONFDIR}  CONF=	localmount moused powerd rarpd  MK=	../mk diff --git a/conf.d.BSD/localmount b/conf.d.BSD/localmount index c69bc73d..61f2d1b9 100644 --- a/conf.d.BSD/localmount +++ b/conf.d.BSD/localmount @@ -1,5 +1,3 @@ -# /etc/conf.d/localmount -  # Kernel core dump options for FreeBSD kernel.  # Unless you're a FreeBSD kernel developer or driver writer then this won't  # be of any interest to you at all. diff --git a/conf.d.FreeBSD/Makefile b/conf.d.FreeBSD/Makefile index 46898a13..ed58826f 100644 --- a/conf.d.FreeBSD/Makefile +++ b/conf.d.FreeBSD/Makefile @@ -1,4 +1,4 @@ -DIR=	/etc/conf.d +DIR=	${CONFDIR}  CONF=	syscons  MK=	../mk diff --git a/conf.d.Linux/Makefile b/conf.d.Linux/Makefile index b8a5bf79..57922a20 100644 --- a/conf.d.Linux/Makefile +++ b/conf.d.Linux/Makefile @@ -1,4 +1,4 @@ -DIR=		/etc/conf.d +DIR=		${CONFDIR}  CONF=		consolefont keymaps modules  CONF_APPEND=	clock diff --git a/conf.d.Linux/consolefont b/conf.d.Linux/consolefont index 3837ff04..c7fe898a 100644 --- a/conf.d.Linux/consolefont +++ b/conf.d.Linux/consolefont @@ -1,5 +1,3 @@ -# /etc/conf.d/consolefont -  # consolefont specifies the default font that you'd like Linux to use on the  # console.  You can find a good selection of fonts in /usr/share/consolefonts;  # you shouldn't specify the trailing ".psf.gz", just the font name below. diff --git a/conf.d.Linux/keymaps b/conf.d.Linux/keymaps index 781999e5..842803bb 100644 --- a/conf.d.Linux/keymaps +++ b/conf.d.Linux/keymaps @@ -1,5 +1,3 @@ -# /etc/conf.d/keymaps -  # Use KEYMAP to specify the default console keymap.  There is a complete tree  # of keymaps in /usr/share/keymaps to choose from.  keymap="us" diff --git a/conf.d/Makefile b/conf.d/Makefile index d1a527b1..9d1891f5 100644 --- a/conf.d/Makefile +++ b/conf.d/Makefile @@ -1,4 +1,4 @@ -DIR=	/etc/conf.d +DIR=	${CONFDIR}  CONF=	bootmisc clock fsck hostname local net urandom  MK=	../mk diff --git a/conf.d/bootmisc b/conf.d/bootmisc index 84bde30e..066a6314 100644 --- a/conf.d/bootmisc +++ b/conf.d/bootmisc @@ -1,5 +1,3 @@ -# /etc/conf.d/bootmisc -  # Put a nologin file in /etc to prevent people from logging in before  # system startup is complete  delay_login="NO" diff --git a/conf.d/clock b/conf.d/clock index e055474c..4dab74f7 100644 --- a/conf.d/clock +++ b/conf.d/clock @@ -1,5 +1,3 @@ -# /etc/conf.d/clock -  # Set CLOCK to "UTC" if your system clock is set to UTC (also known as  # Greenwich Mean Time).  If your clock is set to the local time, then   # set CLOCK to "local".  Note that if you dual boot with Windows, then  diff --git a/conf.d/urandom b/conf.d/urandom index b4e9c99e..fbaf4e81 100644 --- a/conf.d/urandom +++ b/conf.d/urandom @@ -1,5 +1,3 @@ -# /etc/conf.d/urandom -  # Sometimes you want to have urandom start before "localmount"  # (say for crypt swap), so you will need to customize this  # behavior.  If you have /var on a separate partition, then diff --git a/etc.BSD/Makefile b/etc.BSD/Makefile index d28c6a0c..5ce049f4 100644 --- a/etc.BSD/Makefile +++ b/etc.BSD/Makefile @@ -1,4 +1,4 @@ -DIR=		/etc +DIR=		${SYSCONFDIR}  CONF=		rc rc.shutdown  MK=		../mk diff --git a/etc.Linux/Makefile b/etc.Linux/Makefile index 77a782ab..51f1f42d 100644 --- a/etc.Linux/Makefile +++ b/etc.Linux/Makefile @@ -1,4 +1,4 @@ -DIR=		/etc +DIR=		${SYSCONFDIR}  CONF_APPEND=	rc.conf  MK=		../mk diff --git a/etc/Makefile b/etc/Makefile index 869430f8..77262595 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -1,4 +1,4 @@ -DIR=	/etc +DIR=	${SYSCONFDIR}  CONF=	rc.conf  MK=	../mk diff --git a/etc/rc.conf b/etc/rc.conf index c3347996..f0c5b770 100644 --- a/etc/rc.conf +++ b/etc/rc.conf @@ -1,4 +1,4 @@ -# /etc/rc.conf: Global OpenRC configuration settings +# Global OpenRC configuration settings  # Set to "YES" if you want the rc system to try and start services  # in parallel for a slight speed improvement. When running in parallel we diff --git a/init.d.BSD/Makefile b/init.d.BSD/Makefile index b83e4216..8edff64a 100644 --- a/init.d.BSD/Makefile +++ b/init.d.BSD/Makefile @@ -1,4 +1,4 @@ -DIR=	/etc/init.d +DIR=	${INITDIR}  SRCS=	hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \  	rpcbind.in savecore.in sysctl.in syslogd.in  BIN=	${OBJS} diff --git a/init.d.BSD/rc-enabled.in b/init.d.BSD/rc-enabled.in index ab21b4ae..9801203b 100644 --- a/init.d.BSD/rc-enabled.in +++ b/init.d.BSD/rc-enabled.in @@ -14,7 +14,7 @@ start()  {  	ebegin "Starting local rc services"  	local svc= enabled= retval=0 service= -	for svc in $(rcorder /etc/rc.d/* /usr/local/etc/rc.d/* 2>/dev/null); do +	for svc in $(rcorder /etc/rc.d/* @PKG_PREFIX@/etc/rc.d/* 2>/dev/null); do  		[ -x "$svc" ] || continue  		service=${svc##*/} @@ -24,8 +24,9 @@ start()  		done  		# If we have an init script for this service, continue -		[ -x /etc/init.d/"${service}" ] && continue -		[ -x /usr/local/etc/init.d/"${service}" ] && continue +		[ -x @SYSCONFDIR@/init.d/"${service}" ] && continue +		[ -x @PKG_PREFIX@/@SYSCONFDIR@/init.d/"${service}" ] && continue +		[ -x @LOCAL_PREFIX@/@SYSCONFDIR@/init.d/"${service}" ] && continue  		# Ensure that the users rc.conf will start us - ignore the defaults  		eval enabled=\$${svc##*/}_enable diff --git a/init.d.FreeBSD/Makefile b/init.d.FreeBSD/Makefile index e6cb6ac9..47cbedc7 100644 --- a/init.d.FreeBSD/Makefile +++ b/init.d.FreeBSD/Makefile @@ -1,4 +1,4 @@ -DIR=	/etc/init.d +DIR=	${INITDIR}  SRCS=	clock.in devd.in dumpon.in ipfw.in mixer.in nscd.in powerd.in syscons.in  BIN=	${OBJS} diff --git a/init.d.Linux/Makefile b/init.d.Linux/Makefile index b4aaae5d..8a8ba0dd 100644 --- a/init.d.Linux/Makefile +++ b/init.d.Linux/Makefile @@ -1,4 +1,4 @@ -DIR=	/etc/init.d +DIR=	${INITDIR}  SRCS=	clock.in consolefont.in keymaps.in modules.in mtab.in numlock.in \  	procfs.in sysctl.in  BIN=${OBJS} diff --git a/init.d.NetBSD/Makefile b/init.d.NetBSD/Makefile index 12ec1548..07ab1cf2 100644 --- a/init.d.NetBSD/Makefile +++ b/init.d.NetBSD/Makefile @@ -1,4 +1,4 @@ -DIR=	/etc/init.d +DIR=	${INITDIR}	  SRCS=	swap-blk.in ttys.in wscons.in  BIN=	${OBJS} diff --git a/init.d.misc/Makefile b/init.d.misc/Makefile index a9acd8c2..608407f9 100644 --- a/init.d.misc/Makefile +++ b/init.d.misc/Makefile @@ -1,4 +1,4 @@ -DIR=	/etc/init.d +DIR=	${INITDIR}  SRCS=	avahi-dnsconfd.in avahid.in dbus.in hald.in named.in ntpd.in \  	openvpn.in polkitd.in sshd.in diff --git a/init.d/Makefile b/init.d/Makefile index 855462c7..38a3f412 100644 --- a/init.d/Makefile +++ b/init.d/Makefile @@ -1,4 +1,4 @@ -DIR=	/etc/init.d +DIR=	${INITDIR}  SRCS=	bootmisc.in fsck.in halt.sh.in hostname.in local.in localmount.in \  	netmount.in root.in swap.in urandom.in  BIN=	${OBJS} diff --git a/init.d/halt.sh.in b/init.d/halt.sh.in index dca6815c..bf2ba564 100644 --- a/init.d/halt.sh.in +++ b/init.d/halt.sh.in @@ -2,9 +2,9 @@  # Copyright 2007-2008 Roy Marples <roy@marples.name>  # All rights reserved. Released under the 2-clause BSD license. -. /etc/init.d/functions.sh +. /@SYSCONFDIR@/init.d/functions.sh  . "${RC_LIBDIR}"/sh/rc-functions.sh -[ -r /etc/rc.conf ] && . /etc/rc.conf +[ -r @SYSCONFDIR@/rc.conf ] && . @SYSCONFDIR@/rc.conf  # Support LiveCD foo  if [ -r /sbin/livecd-functions.sh ]; then @@ -28,8 +28,8 @@ sync; sync  #   1) we don't need (and by default can't) umount anything (VServer) or  #   2) the host utils take care of all umounting stuff (OpenVZ)  if [ "${RC_SYS}" = "VSERVER" -o "${RC_SYS}" = "OPENVZ" ]; then -	if [ -e /etc/init.d/"$1".sh ]; then -		. /etc/init.d/"$1".sh +	if [ -e @SYSCONFDIR@/init.d/"$1".sh ]; then +		. @SYSCONFDIR@/init.d/"$1".sh  	else  		exit 0  	fi @@ -93,7 +93,7 @@ if [ ${unmounted} -ne 0 ]; then  fi  # Load the final script - not needed on BSD so they should not exist -[ -e /etc/init.d/"$1".sh ] && . /etc/init.d/"$1".sh +[ -e @SYSCONFDIR@/init.d/"$1".sh ] && . @SYSCONFDIR@/init.d/"$1".sh  # Always exit 0 here  exit 0 diff --git a/init.d/local.in b/init.d/local.in index 722d9714..bfc05107 100644 --- a/init.d/local.in +++ b/init.d/local.in @@ -19,8 +19,8 @@ start()  	fi  	# Support old configs -	if [ -e /etc/conf.d/local.start ]; then -		. /etc/conf.d/local.start +	if [ -e @SYSCONFDIR@/conf.d/local.start ]; then +		. @SYSCONFDIR@/conf.d/local.start  	fi  	eend $? "Failed to start local" @@ -35,8 +35,8 @@ stop()  	fi  	# Support old configs -	if [ -e /etc/conf.d/local.stop ]; then -		. /etc/conf.d/local.stop +	if [ -e @SYSCONFDIR@/conf.d/local.stop ]; then +		. @SYSCONFDIR@/conf.d/local.stop  	fi  	eend $? $"Failed to stop local" diff --git a/init.d/netmount.in b/init.d/netmount.in index 3219c83c..38390fa5 100644 --- a/init.d/netmount.in +++ b/init.d/netmount.in @@ -26,7 +26,7 @@ depend()  	local pmap=""  	if need_portmap; then  		pmap="${pmap} rpc.statd" -		[ -x /etc/init.d/rpcbind ] \ +		[ -x @SYSCONFDIR@/init.d/rpcbind ] \  			&& pmap="rpcbind" \  			|| pmap="portmap"  	fi @@ -40,7 +40,7 @@ depend()  start()  {	  	local myneed= myuse= pmap="portmap" nfsmounts= -	[ -x /etc/init.d/rpcbind ] && pmap="rpcbind" +	[ -x @SYSCONFDIR@/init.d/rpcbind ] && pmap="rpcbind"  	local x= fs=  	for x in ${net_fs_list}; do diff --git a/mk/scripts.mk b/mk/scripts.mk index b84f05ef..a77e17e5 100644 --- a/mk/scripts.mk +++ b/mk/scripts.mk @@ -6,13 +6,15 @@ include ${MK}/os.mk  OBJS+=	${SRCS:.in=} +_SED_REPLACE=	-e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@PKG_PREFIX@:${PKG_PREFIX}:g' -e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g' +  # Tweak our shell scripts  .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' -e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g' $< > $@ +	sed ${_SED_REPLACE} $< > $@  .in: -	sed -e 's:@PREFIX@:${PREFIX}:g' -e 's:@PKG_PREFIX@:${PKG_PREFIX}:g' -e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g' $< > $@ +	sed ${_SED_REPLACE} $< > $@  all: ${OBJS} @@ -15,6 +15,10 @@ PKG_PREFIX=		/usr/local  PICFLAG?=		-fPIC +SYSCONFDIR?=		/etc +INITDIR?=		${SYSCONFDIR}/init.d +CONFDIR?=		${SYSCONFDIR}/conf.d +  BINDIR?=		${PREFIX}/sbin  BINMODE?=		0755 diff --git a/runlevels/Makefile b/runlevels/Makefile index 0ede30e2..34e92aac 100644 --- a/runlevels/Makefile +++ b/runlevels/Makefile @@ -2,7 +2,7 @@ BOOT=		bootmisc fsck hostname localmount \  		root swap sysctl urandom  DEFAULT=	local netmount -LEVELDIR=	${DESTDIR}/${PREFIX}/etc/runlevels +LEVELDIR=	${DESTDIR}/${PREFIX}/${SYSCONFDIR}/runlevels  BOOTDIR=	${LEVELDIR}/boot  DEFAULTDIR=	${LEVELDIR}/default diff --git a/sh/Makefile b/sh/Makefile index 57a567fc..3ec217c4 100644 --- a/sh/Makefile +++ b/sh/Makefile @@ -13,9 +13,9 @@ include Makefile.${SUBOS}  include ${MK}/scripts.mk  _installafter: -	${INSTALL} -d ${DESTDIR}/${PREFIX}/etc/init.d +	${INSTALL} -d ${DESTDIR}/${PREFIX}/${INITDIR}  	@# Provide an init script for the loopback interface -	ln -snf ${PREFIX}/${RC_LIB}/sh/net.sh ${DESTDIR}/${PREFIX}/etc/init.d/${NET_LO} || exit $$? +	ln -snf ${PREFIX}/${RC_LIB}/sh/net.sh ${DESTDIR}/${PREFIX}/${INITDIR}/${NET_LO} || exit $$?  	@# Put functions.sh into the init.d dir so 3rd party apps don't have to  	@# be multilib aware -	ln -snf ${PREFIX}/${RC_LIB}/sh/functions.sh ${DESTDIR}/${PREFIX}/etc/init.d || exit $$? +	ln -snf ${PREFIX}/${RC_LIB}/sh/functions.sh ${DESTDIR}/${PREFIX}/${INITDIR} || exit $$? diff --git a/sh/gendepends.sh.in b/sh/gendepends.sh.in index 2beba641..b09ea16b 100644 --- a/sh/gendepends.sh.in +++ b/sh/gendepends.sh.in @@ -4,7 +4,7 @@  # Copyright 2007-2008 Roy Marples <roy@marples.name>  # All rights reserved. Released under the 2-clause BSD license. -. @PREFIX@/etc/init.d/functions.sh +. @PREFIX@/@SYSCONFDIR@/init.d/functions.sh  config() {  	[ -n "$*" ] && echo "${SVCNAME} config $*" >&3 @@ -33,9 +33,9 @@ depend() {  _done_dirs=  for _dir in \ -@PREFIX@/etc/init.d \ -@PKG_PREFIX@/etc/init.d \ -@LOCAL_PREFIX@/etc/init.d +@PREFIX@/@SYSCONFDIR@/init.d \ +@PKG_PREFIX@/@SYSCONFDIR@/init.d \ +@LOCAL_PREFIX@/@SYSCONFDIR@/init.d  do  	[ -d "${_dir}" ] || continue @@ -72,7 +72,7 @@ do  			. "${_dir}/../conf.d/${SVCNAME}"  		fi -		[ -e @PREFIX@/etc/rc.conf ] && . @PREFIX@/etc/rc.conf +		[ -e @PREFIX@/@SYSCONFDIR@/rc.conf ] && . @PREFIX@/@SYSCONFDIR@/rc.conf  		if . "${_dir}/${SVCNAME}"; then  			echo "${SVCNAME}" >&3 diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in index bf8489e3..88e99bd7 100644 --- a/sh/runscript.sh.in +++ b/sh/runscript.sh.in @@ -4,7 +4,7 @@  # Copyright 2007-2008 Roy Marples <roy@marples.name>  # All rights reserved. Released under the 2-clause BSD license. -. @PREFIX@/etc/init.d/functions.sh +. @PREFIX@/@SYSCONFDIR@/init.d/functions.sh  . "${RC_LIBDIR}"/sh/rc-functions.sh  # Support LiveCD foo @@ -61,7 +61,7 @@ fi  unset _conf_d  # Load any system overrides -[ -e @PREFIX@/etc/rc.conf ] && . @PREFIX@/etc/rc.conf +[ -e @PREFIX@/@SYSCONFDIR@/rc.conf ] && . @PREFIX@/@SYSCONFDIR@/rc.conf  # Apply any ulimit defined  [ -n "${rc_ulimit:-${RC_ULIMIT}}" ] && ulimit ${rc_ulimit:-${RC_ULIMIT}} diff --git a/src/includes/rc-misc.h b/src/includes/rc-misc.h index 56cfcfe0..fafbc49c 100644 --- a/src/includes/rc-misc.h +++ b/src/includes/rc-misc.h @@ -41,6 +41,10 @@  #  define LIB			"lib"  #endif +#ifndef SYSCONFDIR +#  define SYSCONFDIR		"/etc" +#endif +  #ifdef PREFIX  #  define RC_PREFIX		PREFIX  #else @@ -53,23 +57,23 @@  #define RC_LIBDIR               RC_PREFIX "/" LIB "/rc"  #define RC_SVCDIR               RC_LIBDIR "/init.d"  #define RC_DEPTREE              RC_SVCDIR "/deptree" -#define RC_RUNLEVELDIR          RC_PREFIX "/etc/runlevels" -#define RC_INITDIR              RC_PREFIX "/etc/init.d" -#define RC_CONFDIR              RC_PREFIX "/etc/conf.d" +#define RC_RUNLEVELDIR          RC_PREFIX SYSCONFDIR "/runlevels" +#define RC_INITDIR              RC_PREFIX SYSCONFDIR "/init.d" +#define RC_CONFDIR              RC_PREFIX SYSCONFDIR "/conf.d"  /* PKG_PREFIX is where packages are installed if different from the base OS   * On Gentoo this is normally unset, on FreeBSD /usr/local and on NetBSD   * /usr/pkg. */  #ifdef PKG_PREFIX -#  define RC_PKG_INITDIR        PKG_PREFIX "/etc/init.d" -#  define RC_PKG_CONFDIR        PKG_PREFIX "/etc/conf.d" +#  define RC_PKG_INITDIR        PKG_PREFIX SYSCONFDIR "/init.d" +#  define RC_PKG_CONFDIR        PKG_PREFIX SYSCONFDIR "/conf.d"  #endif  /* LOCAL_PREFIX is for user written stuff, which the base OS and package   * manger don't touch. */  #ifdef LOCAL_PREFIX -#  define RC_LOCAL_INITDIR      LOCAL_PREFIX "/etc/init.d" -#  define RC_LOCAL_CONFDIR      LOCAL_PREFIX "/etc/conf.d" +#  define RC_LOCAL_INITDIR      LOCAL_PREFIX SYSCONFDIR "/init.d" +#  define RC_LOCAL_CONFDIR      LOCAL_PREFIX SYSCONFDIR "/conf.d"  #endif  #define RC_KSOFTLEVEL           RC_SVCDIR "/ksoftlevel" diff --git a/src/librc/Makefile b/src/librc/Makefile index 880a56e7..78c97ce8 100644 --- a/src/librc/Makefile +++ b/src/librc/Makefile @@ -9,6 +9,7 @@ INCS=		rc.h  VERSION_MAP=	rc.map  CFLAGS+=	-DLIB=\"${LIBNAME}\" +CFLAGS+=	-DSYSCONFDIR=\"${SYSCONFDIR}\"  LDADD+=		${LIBKVM}  CFLAGS+=	-I../includes diff --git a/src/rc/Makefile b/src/rc/Makefile index 26ee1312..6e0ca8d3 100644 --- a/src/rc/Makefile +++ b/src/rc/Makefile @@ -40,6 +40,7 @@ include ${MK}/prog.mk  CFLAGS+=	-I../includes -I../librc -I../libeinfo  CFLAGS+=	-DLIB=\"${LIBNAME}\" +CFLAGS+=	-DSYSCONFDIR=\"${SYSCONFDIR}\"  include ${MK}/${MKTERMCAP}.mk  LDADD+=		${LIBDL} ${LIBKVM} diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c index 78c1ddca..343a1534 100644 --- a/src/rc/rc-misc.c +++ b/src/rc/rc-misc.c @@ -49,11 +49,11 @@  #include "rc-misc.h"  #include "strlist.h" -#define PROFILE_ENV     "/etc/profile.env" +#define PROFILE_ENV     SYSCONFDIR "/profile.env"  #define SYS_WHITELIST   RC_LIBDIR "/conf.d/env_whitelist" -#define USR_WHITELIST   "/etc/conf.d/env_whitelist" -#define RC_CONF         "/etc/rc.conf" -#define RC_CONF_OLD     "/etc/conf.d/rc" +#define USR_WHITELIST   SYSCONFDIR "/conf.d/env_whitelist" +#define RC_CONF         SYSCONFDIR "/rc.conf" +#define RC_CONF_OLD     SYSCONFDIR "/conf.d/rc"  #define PATH_PREFIX     RC_LIBDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin" | 
