Add tunable SYSCONFDIR
Roy Marples
16 years ago
0 | DIR= /etc/conf.d | |
0 | DIR= ${CONFDIR} | |
1 | 1 | CONF= bootmisc clock fsck hostname local net urandom |
2 | 2 | |
3 | 3 | MK= ../mk |
0 | # /etc/conf.d/bootmisc | |
1 | ||
2 | 0 | # Put a nologin file in /etc to prevent people from logging in before |
3 | 1 | # system startup is complete |
4 | 2 | delay_login="NO" |
0 | # /etc/conf.d/clock | |
1 | ||
2 | 0 | # Set CLOCK to "UTC" if your system clock is set to UTC (also known as |
3 | 1 | # Greenwich Mean Time). If your clock is set to the local time, then |
4 | 2 | # set CLOCK to "local". Note that if you dual boot with Windows, then |
0 | # /etc/conf.d/urandom | |
1 | ||
2 | 0 | # Sometimes you want to have urandom start before "localmount" |
3 | 1 | # (say for crypt swap), so you will need to customize this |
4 | 2 | # behavior. If you have /var on a separate partition, then |
0 | # /etc/conf.d/localmount | |
1 | ||
2 | 0 | # Kernel core dump options for FreeBSD kernel. |
3 | 1 | # Unless you're a FreeBSD kernel developer or driver writer then this won't |
4 | 2 | # be of any interest to you at all. |
0 | # /etc/conf.d/consolefont | |
1 | ||
2 | 0 | # consolefont specifies the default font that you'd like Linux to use on the |
3 | 1 | # console. You can find a good selection of fonts in /usr/share/consolefonts; |
4 | 2 | # you shouldn't specify the trailing ".psf.gz", just the font name below. |
0 | # /etc/conf.d/keymaps | |
1 | ||
2 | 0 | # Use KEYMAP to specify the default console keymap. There is a complete tree |
3 | 1 | # of keymaps in /usr/share/keymaps to choose from. |
4 | 2 | keymap="us" |
0 | # /etc/rc.conf: Global OpenRC configuration settings | |
0 | # Global OpenRC configuration settings | |
1 | 1 | |
2 | 2 | # Set to "YES" if you want the rc system to try and start services |
3 | 3 | # in parallel for a slight speed improvement. When running in parallel we |
0 | DIR= /etc/init.d | |
0 | DIR= ${INITDIR} | |
1 | 1 | SRCS= bootmisc.in fsck.in halt.sh.in hostname.in local.in localmount.in \ |
2 | 2 | netmount.in root.in swap.in urandom.in |
3 | 3 | BIN= ${OBJS} |
1 | 1 | # Copyright 2007-2008 Roy Marples <roy@marples.name> |
2 | 2 | # All rights reserved. Released under the 2-clause BSD license. |
3 | 3 | |
4 | . /etc/init.d/functions.sh | |
4 | . /@SYSCONFDIR@/init.d/functions.sh | |
5 | 5 | . "${RC_LIBDIR}"/sh/rc-functions.sh |
6 | [ -r /etc/rc.conf ] && . /etc/rc.conf | |
6 | [ -r @SYSCONFDIR@/rc.conf ] && . @SYSCONFDIR@/rc.conf | |
7 | 7 | |
8 | 8 | # Support LiveCD foo |
9 | 9 | if [ -r /sbin/livecd-functions.sh ]; then |
27 | 27 | # 1) we don't need (and by default can't) umount anything (VServer) or |
28 | 28 | # 2) the host utils take care of all umounting stuff (OpenVZ) |
29 | 29 | if [ "${RC_SYS}" = "VSERVER" -o "${RC_SYS}" = "OPENVZ" ]; then |
30 | if [ -e /etc/init.d/"$1".sh ]; then | |
31 | . /etc/init.d/"$1".sh | |
30 | if [ -e @SYSCONFDIR@/init.d/"$1".sh ]; then | |
31 | . @SYSCONFDIR@/init.d/"$1".sh | |
32 | 32 | else |
33 | 33 | exit 0 |
34 | 34 | fi |
92 | 92 | fi |
93 | 93 | |
94 | 94 | # Load the final script - not needed on BSD so they should not exist |
95 | [ -e /etc/init.d/"$1".sh ] && . /etc/init.d/"$1".sh | |
95 | [ -e @SYSCONFDIR@/init.d/"$1".sh ] && . @SYSCONFDIR@/init.d/"$1".sh | |
96 | 96 | |
97 | 97 | # Always exit 0 here |
98 | 98 | exit 0 |
18 | 18 | fi |
19 | 19 | |
20 | 20 | # Support old configs |
21 | if [ -e /etc/conf.d/local.start ]; then | |
22 | . /etc/conf.d/local.start | |
21 | if [ -e @SYSCONFDIR@/conf.d/local.start ]; then | |
22 | . @SYSCONFDIR@/conf.d/local.start | |
23 | 23 | fi |
24 | 24 | |
25 | 25 | eend $? "Failed to start local" |
34 | 34 | fi |
35 | 35 | |
36 | 36 | # Support old configs |
37 | if [ -e /etc/conf.d/local.stop ]; then | |
38 | . /etc/conf.d/local.stop | |
37 | if [ -e @SYSCONFDIR@/conf.d/local.stop ]; then | |
38 | . @SYSCONFDIR@/conf.d/local.stop | |
39 | 39 | fi |
40 | 40 | |
41 | 41 | eend $? $"Failed to stop local" |
25 | 25 | local pmap="" |
26 | 26 | if need_portmap; then |
27 | 27 | pmap="${pmap} rpc.statd" |
28 | [ -x /etc/init.d/rpcbind ] \ | |
28 | [ -x @SYSCONFDIR@/init.d/rpcbind ] \ | |
29 | 29 | && pmap="rpcbind" \ |
30 | 30 | || pmap="portmap" |
31 | 31 | fi |
39 | 39 | start() |
40 | 40 | { |
41 | 41 | local myneed= myuse= pmap="portmap" nfsmounts= |
42 | [ -x /etc/init.d/rpcbind ] && pmap="rpcbind" | |
42 | [ -x @SYSCONFDIR@/init.d/rpcbind ] && pmap="rpcbind" | |
43 | 43 | |
44 | 44 | local x= fs= |
45 | 45 | for x in ${net_fs_list}; do |
0 | DIR= /etc/init.d | |
0 | DIR= ${INITDIR} | |
1 | 1 | SRCS= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \ |
2 | 2 | rpcbind.in savecore.in sysctl.in syslogd.in |
3 | 3 | BIN= ${OBJS} |
13 | 13 | { |
14 | 14 | ebegin "Starting local rc services" |
15 | 15 | local svc= enabled= retval=0 service= |
16 | for svc in $(rcorder /etc/rc.d/* /usr/local/etc/rc.d/* 2>/dev/null); do | |
16 | for svc in $(rcorder /etc/rc.d/* @PKG_PREFIX@/etc/rc.d/* 2>/dev/null); do | |
17 | 17 | [ -x "$svc" ] || continue |
18 | 18 | service=${svc##*/} |
19 | 19 | |
23 | 23 | done |
24 | 24 | |
25 | 25 | # If we have an init script for this service, continue |
26 | [ -x /etc/init.d/"${service}" ] && continue | |
27 | [ -x /usr/local/etc/init.d/"${service}" ] && continue | |
26 | [ -x @SYSCONFDIR@/init.d/"${service}" ] && continue | |
27 | [ -x @PKG_PREFIX@/@SYSCONFDIR@/init.d/"${service}" ] && continue | |
28 | [ -x @LOCAL_PREFIX@/@SYSCONFDIR@/init.d/"${service}" ] && continue | |
28 | 29 | |
29 | 30 | # Ensure that the users rc.conf will start us - ignore the defaults |
30 | 31 | eval enabled=\$${svc##*/}_enable |
0 | DIR= /etc/init.d | |
0 | DIR= ${INITDIR} | |
1 | 1 | SRCS= clock.in devd.in dumpon.in ipfw.in mixer.in nscd.in powerd.in syscons.in |
2 | 2 | BIN= ${OBJS} |
3 | 3 |
0 | DIR= /etc/init.d | |
0 | DIR= ${INITDIR} | |
1 | 1 | SRCS= clock.in consolefont.in keymaps.in modules.in mtab.in numlock.in \ |
2 | 2 | procfs.in sysctl.in |
3 | 3 | BIN=${OBJS} |
0 | DIR= /etc/init.d | |
0 | DIR= ${INITDIR} | |
1 | 1 | SRCS= avahi-dnsconfd.in avahid.in dbus.in hald.in named.in ntpd.in \ |
2 | 2 | openvpn.in polkitd.in sshd.in |
3 | 3 |
5 | 5 | |
6 | 6 | OBJS+= ${SRCS:.in=} |
7 | 7 | |
8 | _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' | |
9 | ||
8 | 10 | # Tweak our shell scripts |
9 | 11 | .SUFFIXES: .sh.in .in |
10 | 12 | .sh.in.sh: |
11 | 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' $< > $@ | |
13 | sed ${_SED_REPLACE} $< > $@ | |
12 | 14 | |
13 | 15 | .in: |
14 | sed -e 's:@PREFIX@:${PREFIX}:g' -e 's:@PKG_PREFIX@:${PKG_PREFIX}:g' -e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g' $< > $@ | |
16 | sed ${_SED_REPLACE} $< > $@ | |
15 | 17 | |
16 | 18 | all: ${OBJS} |
17 | 19 |
13 | 13 | PKG_PREFIX= /usr/local |
14 | 14 | |
15 | 15 | PICFLAG?= -fPIC |
16 | ||
17 | SYSCONFDIR?= /etc | |
18 | INITDIR?= ${SYSCONFDIR}/init.d | |
19 | CONFDIR?= ${SYSCONFDIR}/conf.d | |
16 | 20 | |
17 | 21 | BINDIR?= ${PREFIX}/sbin |
18 | 22 | BINMODE?= 0755 |
1 | 1 | root swap sysctl urandom |
2 | 2 | DEFAULT= local netmount |
3 | 3 | |
4 | LEVELDIR= ${DESTDIR}/${PREFIX}/etc/runlevels | |
4 | LEVELDIR= ${DESTDIR}/${PREFIX}/${SYSCONFDIR}/runlevels | |
5 | 5 | BOOTDIR= ${LEVELDIR}/boot |
6 | 6 | DEFAULTDIR= ${LEVELDIR}/default |
7 | 7 |
12 | 12 | include ${MK}/scripts.mk |
13 | 13 | |
14 | 14 | _installafter: |
15 | ${INSTALL} -d ${DESTDIR}/${PREFIX}/etc/init.d | |
15 | ${INSTALL} -d ${DESTDIR}/${PREFIX}/${INITDIR} | |
16 | 16 | @# Provide an init script for the loopback interface |
17 | ln -snf ${PREFIX}/${RC_LIB}/sh/net.sh ${DESTDIR}/${PREFIX}/etc/init.d/${NET_LO} || exit $$? | |
17 | ln -snf ${PREFIX}/${RC_LIB}/sh/net.sh ${DESTDIR}/${PREFIX}/${INITDIR}/${NET_LO} || exit $$? | |
18 | 18 | @# Put functions.sh into the init.d dir so 3rd party apps don't have to |
19 | 19 | @# be multilib aware |
20 | ln -snf ${PREFIX}/${RC_LIB}/sh/functions.sh ${DESTDIR}/${PREFIX}/etc/init.d || exit $$? | |
20 | ln -snf ${PREFIX}/${RC_LIB}/sh/functions.sh ${DESTDIR}/${PREFIX}/${INITDIR} || exit $$? |
3 | 3 | # Copyright 2007-2008 Roy Marples <roy@marples.name> |
4 | 4 | # All rights reserved. Released under the 2-clause BSD license. |
5 | 5 | |
6 | . @PREFIX@/etc/init.d/functions.sh | |
6 | . @PREFIX@/@SYSCONFDIR@/init.d/functions.sh | |
7 | 7 | |
8 | 8 | config() { |
9 | 9 | [ -n "$*" ] && echo "${SVCNAME} config $*" >&3 |
32 | 32 | |
33 | 33 | _done_dirs= |
34 | 34 | for _dir in \ |
35 | @PREFIX@/etc/init.d \ | |
36 | @PKG_PREFIX@/etc/init.d \ | |
37 | @LOCAL_PREFIX@/etc/init.d | |
35 | @PREFIX@/@SYSCONFDIR@/init.d \ | |
36 | @PKG_PREFIX@/@SYSCONFDIR@/init.d \ | |
37 | @LOCAL_PREFIX@/@SYSCONFDIR@/init.d | |
38 | 38 | do |
39 | 39 | [ -d "${_dir}" ] || continue |
40 | 40 | |
71 | 71 | . "${_dir}/../conf.d/${SVCNAME}" |
72 | 72 | fi |
73 | 73 | |
74 | [ -e @PREFIX@/etc/rc.conf ] && . @PREFIX@/etc/rc.conf | |
74 | [ -e @PREFIX@/@SYSCONFDIR@/rc.conf ] && . @PREFIX@/@SYSCONFDIR@/rc.conf | |
75 | 75 | |
76 | 76 | if . "${_dir}/${SVCNAME}"; then |
77 | 77 | echo "${SVCNAME}" >&3 |
3 | 3 | # Copyright 2007-2008 Roy Marples <roy@marples.name> |
4 | 4 | # All rights reserved. Released under the 2-clause BSD license. |
5 | 5 | |
6 | . @PREFIX@/etc/init.d/functions.sh | |
6 | . @PREFIX@/@SYSCONFDIR@/init.d/functions.sh | |
7 | 7 | . "${RC_LIBDIR}"/sh/rc-functions.sh |
8 | 8 | |
9 | 9 | # Support LiveCD foo |
60 | 60 | unset _conf_d |
61 | 61 | |
62 | 62 | # Load any system overrides |
63 | [ -e @PREFIX@/etc/rc.conf ] && . @PREFIX@/etc/rc.conf | |
63 | [ -e @PREFIX@/@SYSCONFDIR@/rc.conf ] && . @PREFIX@/@SYSCONFDIR@/rc.conf | |
64 | 64 | |
65 | 65 | # Apply any ulimit defined |
66 | 66 | [ -n "${rc_ulimit:-${RC_ULIMIT}}" ] && ulimit ${rc_ulimit:-${RC_ULIMIT}} |
40 | 40 | # define LIB "lib" |
41 | 41 | #endif |
42 | 42 | |
43 | #ifndef SYSCONFDIR | |
44 | # define SYSCONFDIR "/etc" | |
45 | #endif | |
46 | ||
43 | 47 | #ifdef PREFIX |
44 | 48 | # define RC_PREFIX PREFIX |
45 | 49 | #else |
52 | 56 | #define RC_LIBDIR RC_PREFIX "/" LIB "/rc" |
53 | 57 | #define RC_SVCDIR RC_LIBDIR "/init.d" |
54 | 58 | #define RC_DEPTREE RC_SVCDIR "/deptree" |
55 | #define RC_RUNLEVELDIR RC_PREFIX "/etc/runlevels" | |
56 | #define RC_INITDIR RC_PREFIX "/etc/init.d" | |
57 | #define RC_CONFDIR RC_PREFIX "/etc/conf.d" | |
59 | #define RC_RUNLEVELDIR RC_PREFIX SYSCONFDIR "/runlevels" | |
60 | #define RC_INITDIR RC_PREFIX SYSCONFDIR "/init.d" | |
61 | #define RC_CONFDIR RC_PREFIX SYSCONFDIR "/conf.d" | |
58 | 62 | |
59 | 63 | /* PKG_PREFIX is where packages are installed if different from the base OS |
60 | 64 | * On Gentoo this is normally unset, on FreeBSD /usr/local and on NetBSD |
61 | 65 | * /usr/pkg. */ |
62 | 66 | #ifdef PKG_PREFIX |
63 | # define RC_PKG_INITDIR PKG_PREFIX "/etc/init.d" | |
64 | # define RC_PKG_CONFDIR PKG_PREFIX "/etc/conf.d" | |
67 | # define RC_PKG_INITDIR PKG_PREFIX SYSCONFDIR "/init.d" | |
68 | # define RC_PKG_CONFDIR PKG_PREFIX SYSCONFDIR "/conf.d" | |
65 | 69 | #endif |
66 | 70 | |
67 | 71 | /* LOCAL_PREFIX is for user written stuff, which the base OS and package |
68 | 72 | * manger don't touch. */ |
69 | 73 | #ifdef LOCAL_PREFIX |
70 | # define RC_LOCAL_INITDIR LOCAL_PREFIX "/etc/init.d" | |
71 | # define RC_LOCAL_CONFDIR LOCAL_PREFIX "/etc/conf.d" | |
74 | # define RC_LOCAL_INITDIR LOCAL_PREFIX SYSCONFDIR "/init.d" | |
75 | # define RC_LOCAL_CONFDIR LOCAL_PREFIX SYSCONFDIR "/conf.d" | |
72 | 76 | #endif |
73 | 77 | |
74 | 78 | #define RC_KSOFTLEVEL RC_SVCDIR "/ksoftlevel" |
8 | 8 | VERSION_MAP= rc.map |
9 | 9 | |
10 | 10 | CFLAGS+= -DLIB=\"${LIBNAME}\" |
11 | CFLAGS+= -DSYSCONFDIR=\"${SYSCONFDIR}\" | |
11 | 12 | LDADD+= ${LIBKVM} |
12 | 13 | |
13 | 14 | CFLAGS+= -I../includes |
39 | 39 | |
40 | 40 | CFLAGS+= -I../includes -I../librc -I../libeinfo |
41 | 41 | CFLAGS+= -DLIB=\"${LIBNAME}\" |
42 | CFLAGS+= -DSYSCONFDIR=\"${SYSCONFDIR}\" | |
42 | 43 | |
43 | 44 | include ${MK}/${MKTERMCAP}.mk |
44 | 45 | LDADD+= ${LIBDL} ${LIBKVM} |
48 | 48 | #include "rc-misc.h" |
49 | 49 | #include "strlist.h" |
50 | 50 | |
51 | #define PROFILE_ENV "/etc/profile.env" | |
51 | #define PROFILE_ENV SYSCONFDIR "/profile.env" | |
52 | 52 | #define SYS_WHITELIST RC_LIBDIR "/conf.d/env_whitelist" |
53 | #define USR_WHITELIST "/etc/conf.d/env_whitelist" | |
54 | #define RC_CONF "/etc/rc.conf" | |
55 | #define RC_CONF_OLD "/etc/conf.d/rc" | |
53 | #define USR_WHITELIST SYSCONFDIR "/conf.d/env_whitelist" | |
54 | #define RC_CONF SYSCONFDIR "/rc.conf" | |
55 | #define RC_CONF_OLD SYSCONFDIR "/conf.d/rc" | |
56 | 56 | |
57 | 57 | #define PATH_PREFIX RC_LIBDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin" |
58 | 58 |