Add tunable SYSCONFDIR

This commit is contained in:
Roy Marples 2008-03-05 12:27:11 +00:00
parent 7aa231de2e
commit a689b66023
34 changed files with 65 additions and 64 deletions

View File

@ -1,4 +1,4 @@
DIR= /etc/conf.d DIR= ${CONFDIR}
CONF= localmount moused powerd rarpd CONF= localmount moused powerd rarpd
MK= ../mk MK= ../mk

View File

@ -1,5 +1,3 @@
# /etc/conf.d/localmount
# Kernel core dump options for FreeBSD kernel. # Kernel core dump options for FreeBSD kernel.
# Unless you're a FreeBSD kernel developer or driver writer then this won't # Unless you're a FreeBSD kernel developer or driver writer then this won't
# be of any interest to you at all. # be of any interest to you at all.

View File

@ -1,4 +1,4 @@
DIR= /etc/conf.d DIR= ${CONFDIR}
CONF= syscons CONF= syscons
MK= ../mk MK= ../mk

View File

@ -1,4 +1,4 @@
DIR= /etc/conf.d DIR= ${CONFDIR}
CONF= consolefont keymaps modules CONF= consolefont keymaps modules
CONF_APPEND= clock CONF_APPEND= clock

View File

@ -1,5 +1,3 @@
# /etc/conf.d/consolefont
# consolefont specifies the default font that you'd like Linux to use on the # 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; # 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. # you shouldn't specify the trailing ".psf.gz", just the font name below.

View File

@ -1,5 +1,3 @@
# /etc/conf.d/keymaps
# Use KEYMAP to specify the default console keymap. There is a complete tree # Use KEYMAP to specify the default console keymap. There is a complete tree
# of keymaps in /usr/share/keymaps to choose from. # of keymaps in /usr/share/keymaps to choose from.
keymap="us" keymap="us"

View File

@ -1,4 +1,4 @@
DIR= /etc/conf.d DIR= ${CONFDIR}
CONF= bootmisc clock fsck hostname local net urandom CONF= bootmisc clock fsck hostname local net urandom
MK= ../mk MK= ../mk

View File

@ -1,5 +1,3 @@
# /etc/conf.d/bootmisc
# Put a nologin file in /etc to prevent people from logging in before # Put a nologin file in /etc to prevent people from logging in before
# system startup is complete # system startup is complete
delay_login="NO" delay_login="NO"

View File

@ -1,5 +1,3 @@
# /etc/conf.d/clock
# Set CLOCK to "UTC" if your system clock is set to UTC (also known as # 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 # 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 # set CLOCK to "local". Note that if you dual boot with Windows, then

View File

@ -1,5 +1,3 @@
# /etc/conf.d/urandom
# Sometimes you want to have urandom start before "localmount" # Sometimes you want to have urandom start before "localmount"
# (say for crypt swap), so you will need to customize this # (say for crypt swap), so you will need to customize this
# behavior. If you have /var on a separate partition, then # behavior. If you have /var on a separate partition, then

View File

@ -1,4 +1,4 @@
DIR= /etc DIR= ${SYSCONFDIR}
CONF= rc rc.shutdown CONF= rc rc.shutdown
MK= ../mk MK= ../mk

View File

@ -1,4 +1,4 @@
DIR= /etc DIR= ${SYSCONFDIR}
CONF_APPEND= rc.conf CONF_APPEND= rc.conf
MK= ../mk MK= ../mk

View File

@ -1,4 +1,4 @@
DIR= /etc DIR= ${SYSCONFDIR}
CONF= rc.conf CONF= rc.conf
MK= ../mk MK= ../mk

View File

@ -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 # 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 # in parallel for a slight speed improvement. When running in parallel we

View File

@ -1,4 +1,4 @@
DIR= /etc/init.d DIR= ${INITDIR}
SRCS= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \ SRCS= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \
rpcbind.in savecore.in sysctl.in syslogd.in rpcbind.in savecore.in sysctl.in syslogd.in
BIN= ${OBJS} BIN= ${OBJS}

View File

@ -14,7 +14,7 @@ start()
{ {
ebegin "Starting local rc services" ebegin "Starting local rc services"
local svc= enabled= retval=0 service= 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 [ -x "$svc" ] || continue
service=${svc##*/} service=${svc##*/}
@ -24,8 +24,9 @@ start()
done done
# If we have an init script for this service, continue # If we have an init script for this service, continue
[ -x /etc/init.d/"${service}" ] && continue [ -x @SYSCONFDIR@/init.d/"${service}" ] && continue
[ -x /usr/local/etc/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 # Ensure that the users rc.conf will start us - ignore the defaults
eval enabled=\$${svc##*/}_enable eval enabled=\$${svc##*/}_enable

View File

@ -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 SRCS= clock.in devd.in dumpon.in ipfw.in mixer.in nscd.in powerd.in syscons.in
BIN= ${OBJS} BIN= ${OBJS}

View File

@ -1,4 +1,4 @@
DIR= /etc/init.d DIR= ${INITDIR}
SRCS= clock.in consolefont.in keymaps.in modules.in mtab.in numlock.in \ SRCS= clock.in consolefont.in keymaps.in modules.in mtab.in numlock.in \
procfs.in sysctl.in procfs.in sysctl.in
BIN=${OBJS} BIN=${OBJS}

View File

@ -1,4 +1,4 @@
DIR= /etc/init.d DIR= ${INITDIR}
SRCS= swap-blk.in ttys.in wscons.in SRCS= swap-blk.in ttys.in wscons.in
BIN= ${OBJS} BIN= ${OBJS}

View File

@ -1,4 +1,4 @@
DIR= /etc/init.d DIR= ${INITDIR}
SRCS= avahi-dnsconfd.in avahid.in dbus.in hald.in named.in ntpd.in \ SRCS= avahi-dnsconfd.in avahid.in dbus.in hald.in named.in ntpd.in \
openvpn.in polkitd.in sshd.in openvpn.in polkitd.in sshd.in

View File

@ -1,4 +1,4 @@
DIR= /etc/init.d DIR= ${INITDIR}
SRCS= bootmisc.in fsck.in halt.sh.in hostname.in local.in localmount.in \ SRCS= bootmisc.in fsck.in halt.sh.in hostname.in local.in localmount.in \
netmount.in root.in swap.in urandom.in netmount.in root.in swap.in urandom.in
BIN= ${OBJS} BIN= ${OBJS}

View File

@ -2,9 +2,9 @@
# Copyright 2007-2008 Roy Marples <roy@marples.name> # Copyright 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license. # 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 . "${RC_LIBDIR}"/sh/rc-functions.sh
[ -r /etc/rc.conf ] && . /etc/rc.conf [ -r @SYSCONFDIR@/rc.conf ] && . @SYSCONFDIR@/rc.conf
# Support LiveCD foo # Support LiveCD foo
if [ -r /sbin/livecd-functions.sh ]; then 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 # 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) # 2) the host utils take care of all umounting stuff (OpenVZ)
if [ "${RC_SYS}" = "VSERVER" -o "${RC_SYS}" = "OPENVZ" ]; then if [ "${RC_SYS}" = "VSERVER" -o "${RC_SYS}" = "OPENVZ" ]; then
if [ -e /etc/init.d/"$1".sh ]; then if [ -e @SYSCONFDIR@/init.d/"$1".sh ]; then
. /etc/init.d/"$1".sh . @SYSCONFDIR@/init.d/"$1".sh
else else
exit 0 exit 0
fi fi
@ -93,7 +93,7 @@ if [ ${unmounted} -ne 0 ]; then
fi fi
# Load the final script - not needed on BSD so they should not exist # 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 # Always exit 0 here
exit 0 exit 0

View File

@ -19,8 +19,8 @@ start()
fi fi
# Support old configs # Support old configs
if [ -e /etc/conf.d/local.start ]; then if [ -e @SYSCONFDIR@/conf.d/local.start ]; then
. /etc/conf.d/local.start . @SYSCONFDIR@/conf.d/local.start
fi fi
eend $? "Failed to start local" eend $? "Failed to start local"
@ -35,8 +35,8 @@ stop()
fi fi
# Support old configs # Support old configs
if [ -e /etc/conf.d/local.stop ]; then if [ -e @SYSCONFDIR@/conf.d/local.stop ]; then
. /etc/conf.d/local.stop . @SYSCONFDIR@/conf.d/local.stop
fi fi
eend $? $"Failed to stop local" eend $? $"Failed to stop local"

View File

@ -26,7 +26,7 @@ depend()
local pmap="" local pmap=""
if need_portmap; then if need_portmap; then
pmap="${pmap} rpc.statd" pmap="${pmap} rpc.statd"
[ -x /etc/init.d/rpcbind ] \ [ -x @SYSCONFDIR@/init.d/rpcbind ] \
&& pmap="rpcbind" \ && pmap="rpcbind" \
|| pmap="portmap" || pmap="portmap"
fi fi
@ -40,7 +40,7 @@ depend()
start() start()
{ {
local myneed= myuse= pmap="portmap" nfsmounts= local myneed= myuse= pmap="portmap" nfsmounts=
[ -x /etc/init.d/rpcbind ] && pmap="rpcbind" [ -x @SYSCONFDIR@/init.d/rpcbind ] && pmap="rpcbind"
local x= fs= local x= fs=
for x in ${net_fs_list}; do for x in ${net_fs_list}; do

View File

@ -6,13 +6,15 @@ include ${MK}/os.mk
OBJS+= ${SRCS:.in=} 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 # Tweak our shell scripts
.SUFFIXES: .sh.in .in .SUFFIXES: .sh.in .in
.sh.in.sh: .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: .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} all: ${OBJS}

View File

@ -15,6 +15,10 @@ PKG_PREFIX= /usr/local
PICFLAG?= -fPIC PICFLAG?= -fPIC
SYSCONFDIR?= /etc
INITDIR?= ${SYSCONFDIR}/init.d
CONFDIR?= ${SYSCONFDIR}/conf.d
BINDIR?= ${PREFIX}/sbin BINDIR?= ${PREFIX}/sbin
BINMODE?= 0755 BINMODE?= 0755

View File

@ -2,7 +2,7 @@ BOOT= bootmisc fsck hostname localmount \
root swap sysctl urandom root swap sysctl urandom
DEFAULT= local netmount DEFAULT= local netmount
LEVELDIR= ${DESTDIR}/${PREFIX}/etc/runlevels LEVELDIR= ${DESTDIR}/${PREFIX}/${SYSCONFDIR}/runlevels
BOOTDIR= ${LEVELDIR}/boot BOOTDIR= ${LEVELDIR}/boot
DEFAULTDIR= ${LEVELDIR}/default DEFAULTDIR= ${LEVELDIR}/default

View File

@ -13,9 +13,9 @@ include Makefile.${SUBOS}
include ${MK}/scripts.mk include ${MK}/scripts.mk
_installafter: _installafter:
${INSTALL} -d ${DESTDIR}/${PREFIX}/etc/init.d ${INSTALL} -d ${DESTDIR}/${PREFIX}/${INITDIR}
@# Provide an init script for the loopback interface @# 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 @# Put functions.sh into the init.d dir so 3rd party apps don't have to
@# be multilib aware @# 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 $$?

View File

@ -4,7 +4,7 @@
# Copyright 2007-2008 Roy Marples <roy@marples.name> # Copyright 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license. # All rights reserved. Released under the 2-clause BSD license.
. @PREFIX@/etc/init.d/functions.sh . @PREFIX@/@SYSCONFDIR@/init.d/functions.sh
config() { config() {
[ -n "$*" ] && echo "${SVCNAME} config $*" >&3 [ -n "$*" ] && echo "${SVCNAME} config $*" >&3
@ -33,9 +33,9 @@ depend() {
_done_dirs= _done_dirs=
for _dir in \ for _dir in \
@PREFIX@/etc/init.d \ @PREFIX@/@SYSCONFDIR@/init.d \
@PKG_PREFIX@/etc/init.d \ @PKG_PREFIX@/@SYSCONFDIR@/init.d \
@LOCAL_PREFIX@/etc/init.d @LOCAL_PREFIX@/@SYSCONFDIR@/init.d
do do
[ -d "${_dir}" ] || continue [ -d "${_dir}" ] || continue
@ -72,7 +72,7 @@ do
. "${_dir}/../conf.d/${SVCNAME}" . "${_dir}/../conf.d/${SVCNAME}"
fi fi
[ -e @PREFIX@/etc/rc.conf ] && . @PREFIX@/etc/rc.conf [ -e @PREFIX@/@SYSCONFDIR@/rc.conf ] && . @PREFIX@/@SYSCONFDIR@/rc.conf
if . "${_dir}/${SVCNAME}"; then if . "${_dir}/${SVCNAME}"; then
echo "${SVCNAME}" >&3 echo "${SVCNAME}" >&3

View File

@ -4,7 +4,7 @@
# Copyright 2007-2008 Roy Marples <roy@marples.name> # Copyright 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license. # 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 . "${RC_LIBDIR}"/sh/rc-functions.sh
# Support LiveCD foo # Support LiveCD foo
@ -61,7 +61,7 @@ fi
unset _conf_d unset _conf_d
# Load any system overrides # 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 # Apply any ulimit defined
[ -n "${rc_ulimit:-${RC_ULIMIT}}" ] && ulimit ${rc_ulimit:-${RC_ULIMIT}} [ -n "${rc_ulimit:-${RC_ULIMIT}}" ] && ulimit ${rc_ulimit:-${RC_ULIMIT}}

View File

@ -41,6 +41,10 @@
# define LIB "lib" # define LIB "lib"
#endif #endif
#ifndef SYSCONFDIR
# define SYSCONFDIR "/etc"
#endif
#ifdef PREFIX #ifdef PREFIX
# define RC_PREFIX PREFIX # define RC_PREFIX PREFIX
#else #else
@ -53,23 +57,23 @@
#define RC_LIBDIR RC_PREFIX "/" LIB "/rc" #define RC_LIBDIR RC_PREFIX "/" LIB "/rc"
#define RC_SVCDIR RC_LIBDIR "/init.d" #define RC_SVCDIR RC_LIBDIR "/init.d"
#define RC_DEPTREE RC_SVCDIR "/deptree" #define RC_DEPTREE RC_SVCDIR "/deptree"
#define RC_RUNLEVELDIR RC_PREFIX "/etc/runlevels" #define RC_RUNLEVELDIR RC_PREFIX SYSCONFDIR "/runlevels"
#define RC_INITDIR RC_PREFIX "/etc/init.d" #define RC_INITDIR RC_PREFIX SYSCONFDIR "/init.d"
#define RC_CONFDIR RC_PREFIX "/etc/conf.d" #define RC_CONFDIR RC_PREFIX SYSCONFDIR "/conf.d"
/* PKG_PREFIX is where packages are installed if different from the base OS /* 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 * On Gentoo this is normally unset, on FreeBSD /usr/local and on NetBSD
* /usr/pkg. */ * /usr/pkg. */
#ifdef PKG_PREFIX #ifdef PKG_PREFIX
# define RC_PKG_INITDIR PKG_PREFIX "/etc/init.d" # define RC_PKG_INITDIR PKG_PREFIX SYSCONFDIR "/init.d"
# define RC_PKG_CONFDIR PKG_PREFIX "/etc/conf.d" # define RC_PKG_CONFDIR PKG_PREFIX SYSCONFDIR "/conf.d"
#endif #endif
/* LOCAL_PREFIX is for user written stuff, which the base OS and package /* LOCAL_PREFIX is for user written stuff, which the base OS and package
* manger don't touch. */ * manger don't touch. */
#ifdef LOCAL_PREFIX #ifdef LOCAL_PREFIX
# define RC_LOCAL_INITDIR LOCAL_PREFIX "/etc/init.d" # define RC_LOCAL_INITDIR LOCAL_PREFIX SYSCONFDIR "/init.d"
# define RC_LOCAL_CONFDIR LOCAL_PREFIX "/etc/conf.d" # define RC_LOCAL_CONFDIR LOCAL_PREFIX SYSCONFDIR "/conf.d"
#endif #endif
#define RC_KSOFTLEVEL RC_SVCDIR "/ksoftlevel" #define RC_KSOFTLEVEL RC_SVCDIR "/ksoftlevel"

View File

@ -9,6 +9,7 @@ INCS= rc.h
VERSION_MAP= rc.map VERSION_MAP= rc.map
CFLAGS+= -DLIB=\"${LIBNAME}\" CFLAGS+= -DLIB=\"${LIBNAME}\"
CFLAGS+= -DSYSCONFDIR=\"${SYSCONFDIR}\"
LDADD+= ${LIBKVM} LDADD+= ${LIBKVM}
CFLAGS+= -I../includes CFLAGS+= -I../includes

View File

@ -40,6 +40,7 @@ include ${MK}/prog.mk
CFLAGS+= -I../includes -I../librc -I../libeinfo CFLAGS+= -I../includes -I../librc -I../libeinfo
CFLAGS+= -DLIB=\"${LIBNAME}\" CFLAGS+= -DLIB=\"${LIBNAME}\"
CFLAGS+= -DSYSCONFDIR=\"${SYSCONFDIR}\"
include ${MK}/${MKTERMCAP}.mk include ${MK}/${MKTERMCAP}.mk
LDADD+= ${LIBDL} ${LIBKVM} LDADD+= ${LIBDL} ${LIBKVM}

View File

@ -49,11 +49,11 @@
#include "rc-misc.h" #include "rc-misc.h"
#include "strlist.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 SYS_WHITELIST RC_LIBDIR "/conf.d/env_whitelist"
#define USR_WHITELIST "/etc/conf.d/env_whitelist" #define USR_WHITELIST SYSCONFDIR "/conf.d/env_whitelist"
#define RC_CONF "/etc/rc.conf" #define RC_CONF SYSCONFDIR "/rc.conf"
#define RC_CONF_OLD "/etc/conf.d/rc" #define RC_CONF_OLD SYSCONFDIR "/conf.d/rc"
#define PATH_PREFIX RC_LIBDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin" #define PATH_PREFIX RC_LIBDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin"