Overview
| Comment: | rework daemonization, export enable variables and add checks for them |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
716b0393dfbad8c5922c0555989de312 |
| User & Date: | arcade on 2019-10-21 10:37:45.158 |
| Other Links: | manifest | tags |
Context
|
2019-10-21
| ||
| 14:21 | fix devd, fix order, change daemonizing process, adding nfsd check-in: 67838bd249 user: arcade tags: trunk | |
| 10:37 | rework daemonization, export enable variables and add checks for them check-in: 716b0393df user: arcade tags: trunk | |
|
2019-10-20
| ||
| 12:31 | add cloned interfaces, make sure interfaces are initialized after module loading check-in: 380071b4cc user: arcade tags: trunk | |
Changes
Modified Makefile
from [af62bbb687]
to [b46cb7ad36].
1 2 3 | .include "/etc/mrc.conf" .export | > | > > > > > > > > | < < | > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
.include "/etc/mrc.conf"
.export
OTHER_TARGETS:=_daemon _service
DAEMONIZER?=svc
.for daemonizer in ${:!find /etc/mrc -name '*.daemon.mk'!:S/\/etc\/mrc\///}
.include "${daemonizer}"
.endfor
.if !target(_daemon) || !target(_service)
.error No daemonizer defined.
.endif
#.MAKE.JOBS?=2
#.SILENT:
.if defined(AUTOBOOT)
SCRIPTS=${:!find /etc/mrc -name '*.init' -o -name '*.service'!:S/\/etc\/mrc\///}
.ERROR:
: ERROR: ABORTING BOOT (sending SIGTERM to parent)!
: target ${.ERROR_TARGET} failed to execute:
: ${.ERROR_CMD}
kill 1
.else
SCRIPTS=${:!find /etc/mrc -name '*.service'!:S/\/etc\/mrc\///}
DAEMON: NETWORK SERVERS
LOGIN: DAEMON
NETWORK:
SERVERS:
mountlate: mount cleanvar
mount:
cleanvar: mount
nfsclient: NETWORK
.endif
TARGETS:=${SCRIPTS:S/.init//:S/.service//}
.MAIN: ${TARGETS}
.PHONY: ${TARGETS} ${OTHER_TARGETS}
.undef TARGETS OTHER_TARGETS
.for file in ${SCRIPTS}
.info ${file}
.include "${file}"
.endfor
.undef SCRIPTS
ENABLED=${:!env!:C/=.*//:M*_ENABLE}
.for var in ${ENABLED}
.if !empty(${var}:tl:Mno)
#.info ${var}
.undef ${var}
.unexport ${var}
.endif
.endfor
.undef ENABLED
|
Modified NETWORK.init
from [4324e2186b]
to [b7849561ac].
1 2 | # vim:ft=make: | | | 1 2 3 | # vim:ft=make: NETWORK: ifconfig devd hostname |
Modified automountd.service
from [23565c1f4b]
to [0d789584d8].
1 2 3 4 | # vim:ft=make: DAEMON_automountd_COMMAND?=/usr/sbin/autmountd DAEMON_automountd_ENABLE?=no | < | > > | 1 2 3 4 5 6 7 8 9 |
# vim:ft=make:
DAEMON_automountd_COMMAND?=/usr/sbin/autmountd
DAEMON_automountd_ENABLE?=no
DAEMON_automountd_MODULES=autofs
automountd: _daemon nfsclient
.export DAEMON_$@_ENABLE
test -z "$${DAEMON_$@_ENABLE}" || /usr/sbin/automount
|
Modified dbus.service
from [c01f815b71]
to [a11ce34c02].
1 2 3 4 5 6 7 | # vim:ft=make: DAEMON_dbus_COMMAND?=/usr/local/bin/dbus-daemon DAEMON_dbus_ENABLE?=no DAEMON_dbus_FLAGS?=--system dbus: _daemon | > > | | > | 1 2 3 4 5 6 7 8 9 10 11 12 |
# vim:ft=make:
DAEMON_dbus_COMMAND?=/usr/local/bin/dbus-daemon
DAEMON_dbus_ENABLE?=no
DAEMON_dbus_FLAGS?=--system
dbus: _daemon
.export DAEMON_$@_ENABLE
test -z "$${DAEMON_$@_ENABLE}" || { \
/usr/local/bin/dbus-uuidgen --ensure; \
mkdir -p /var/run/dbus; \
}
|
Modified devd.service
from [1b9276dca0]
to [76e5a90210].
1 2 3 4 5 | # vim:ft=make: DAEMON_devd_COMMAND?=/sbin/devd DAEMON_devd_FLAGS?=-dq | > | | | < | 1 2 3 4 5 6 7 8 9 |
# vim:ft=make:
DAEMON_devd_COMMAND?=/sbin/devd
DAEMON_devd_ENABLE?=yes
DAEMON_devd_FLAGS?=-dq
devd: _service
.export DAEMON_$@_ENABLE
test -z "$${DAEMON_$@_ENABLE}" || sysctl hw.bus.devctl_disable=1
|
Modified dhcpcd.service
from [bbafbc6644]
to [b464216713].
1 2 3 4 5 6 | # vim:ft=make: DAEMON_dhcpcd_COMMAND?=/sbin/dhcpcd DAEMON_dhcpcd_ENABLE?=no DAEMON_dhcpcd_FLAGS?=-B | | | 1 2 3 4 5 6 7 | # vim:ft=make: DAEMON_dhcpcd_COMMAND?=/sbin/dhcpcd DAEMON_dhcpcd_ENABLE?=no DAEMON_dhcpcd_FLAGS?=-B dhcpcd: _service mount cleanvar NETWORK |
Modified dumpon.init
from [dbaf344ef8]
to [839662713b].
1 2 3 4 5 | # vim:ft=make: DUMPDEV?=no dumpon: random | < | < | 1 2 3 4 5 6 7 |
# vim:ft=make:
DUMPDEV?=no
dumpon: random
: Setting dumpon device.
test -e ${DUMPDEV} && dumpon -v ${DUMPDEV} || true
|
Modified mountlate.init
from [14ea130983]
to [7e2dc73cc9].
1 2 | # vim:ft=make: | | | 1 2 3 4 5 | # vim:ft=make: mountlate: NETWORK mount cleanvar runshm devd : Mount late FS. mount -a |
Modified node_exporter.service
from [431e8dfb71]
to [b3ad6b4e84].
1 2 3 4 5 6 7 8 9 10 11 |
# vim:ft=make:
DAEMON_node_exporter_COMMAND?=/usr/local/bin/node_exporter --web.listen-address=${DAEMON_node_exporter_LISTEN_ADDRESS} --collector.textfile.directory=${DAEMON_node_exporter_TEXTFILE_DIR}
DAEMON_node_exporter_ENABLE?=no
DAEMON_node_exporter_LISTEN_ADDRESS?=:9100
DAEMON_node_exporter_TEXTFILE_DIR?=/var/tmp/node_exporter
DAEMON_node_exporter_USER?=nobody
DAEMON_node_exporter_GROUP?=nobody
node_exporter: _daemon
install -d -o ${DAEMON_node_exporter_USER} -g ${DAEMON_node_exporter_GROUP} -m1755 ${DAEMON_node_exporter_TEXTFILE_DIR}
| > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 |
# vim:ft=make:
DAEMON_node_exporter_COMMAND?=/usr/local/bin/node_exporter --web.listen-address=${DAEMON_node_exporter_LISTEN_ADDRESS} --collector.textfile.directory=${DAEMON_node_exporter_TEXTFILE_DIR}
DAEMON_node_exporter_ENABLE?=no
DAEMON_node_exporter_LISTEN_ADDRESS?=:9100
DAEMON_node_exporter_TEXTFILE_DIR?=/var/tmp/node_exporter
DAEMON_node_exporter_USER?=nobody
DAEMON_node_exporter_GROUP?=nobody
node_exporter: _daemon
.export DAEMON_$@_ENABLE
test -z "$${DAEMON_$@_ENABLE}" || \
install -d -o ${DAEMON_node_exporter_USER} -g ${DAEMON_node_exporter_GROUP} -m1755 ${DAEMON_node_exporter_TEXTFILE_DIR}
|
Modified slim.service
from [563366cce2]
to [8661a4199f].
1 2 3 4 5 | # vim:ft=make: DAEMON_slim_COMMAND?=/usr/local/bin/slim DAEMON_slim_ENABLE?=no | | | 1 2 3 4 5 6 7 | # vim:ft=make: DAEMON_slim_COMMAND?=/usr/local/bin/slim DAEMON_slim_ENABLE?=no slim: _daemon dbus rm -f /var/run/slim.auth |
Modified smartd.service
from [c65ba8547d]
to [914546d20c].
1 2 3 4 5 6 7 8 9 |
# vim:ft=make:
DAEMON_smartd_COMMAND?=/usr/local/sbin/smartd
DAEMON_smartd_ENABLE?=no
DAEMON_smartd_FLAGS?=-c /usr/local/etc/smartd.conf -n
smartd: _daemon
test -f /usr/local/etc/smartd.conf || { \
echo smartd requires config file to start. ; \
| > > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 |
# vim:ft=make:
DAEMON_smartd_COMMAND?=/usr/local/sbin/smartd
DAEMON_smartd_ENABLE?=no
DAEMON_smartd_FLAGS?=-c /usr/local/etc/smartd.conf -n
smartd: _daemon
.export DAEMON_$@_ENABLE
test -z "$${DAEMON_$@_ENABLE}" || \
test -f /usr/local/etc/smartd.conf || { \
echo smartd requires config file to start. ; \
false; \
}
|
Renamed and modified
svc.daemon
[f1289ad94a]
to svc.daemon.mk
[6db43316c8].
|
| > > > > | > | | > | | < | > | | | > | | < | > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
LOCAL_TARGETS:=_daemon_svc _service_svc
OTHER_TARGETS+=${LOCAL_TARGETS}
.if ${DAEMONIZER} == "svc"
LOCAL_TARGETS:=${LOCAL_TARGETS} ${LOCAL_TARGETS:S/_svc//}
.endif
.for target in ${LOCAL_TARGETS}
${target}: ${target:M_daemon:DDAEMON} .USE
#.export DAEMON_$@_ENABLE
env | grep $@
test -z "$${DAEMON_$@_ENABLE}" || { \
test -n "${DAEMON_$@_MODULES}" && kldload -n ${DAEMON_$@_MODULES} || true; \
svc -u ${DAEMON_$@_USER:Uroot} -g ${DAEMON_$@_GROUP:Uwheel} init $@ ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS}; \
}
.endfor
#_service: .USE
#.export DAEMON_$@_ENABLE
# env | grep $@
# test -z "$${DAEMON_$@_ENABLE}" || { \
# test -n "${DAEMON_$@_MODULES}" && kldload -n ${DAEMON_$@_MODULES} || true; \
# svc -u ${DAEMON_$@_USER:Uroot} -g ${DAEMON_$@_GROUP:Uwheel} init $@ ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS}; \
# }
.undef LOCAL_TARGETS
|
Modified syslogd.service
from [ce75e745ae]
to [7b8aa855b6].
1 2 3 4 5 6 | # vim:ft=make: DAEMON_syslogd_COMMAND?=/usr/sbin/syslogd DAEMON_syslogd_FLAGS?=-ss8cc syslogd: _service | > | 1 2 3 4 5 6 7 | # vim:ft=make: DAEMON_syslogd_COMMAND?=/usr/sbin/syslogd DAEMON_syslogd_ENABLE?=yes DAEMON_syslogd_FLAGS?=-ss8cc syslogd: _service |