diff options
author | William Hubbs <w.d.hubbs@gmail.com> | 2021-08-22 13:09:30 -0500 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2021-09-04 16:01:29 -0500 |
commit | d6622a1156929294b909d08273fd227c7d817bb9 (patch) | |
tree | 29df9fc3ecae9e72e467effc91f3985eafaccd82 /tools/meson_runlevels.sh | |
parent | 92004a2ed65045b7ca79063dda8fc5b4ac761606 (diff) |
add meson build files
Closes #116.
Closes #171.
Closes #172.
Closes #175.
Diffstat (limited to 'tools/meson_runlevels.sh')
-rwxr-xr-x | tools/meson_runlevels.sh | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/tools/meson_runlevels.sh b/tools/meson_runlevels.sh new file mode 100755 index 00000000..7cf068a9 --- /dev/null +++ b/tools/meson_runlevels.sh @@ -0,0 +1,94 @@ +#!/bin/sh + +set -e +set -u + +os="$1" +net="$2" +rc_libexecdir="$3" +sysconfdir="$4" + +init_d_dir="${sysconfdir}/init.d" +leveldir="${sysconfdir}/runlevels" +sysinitdir="${leveldir}/sysinit" +bootdir="${leveldir}/boot" +defaultdir="${leveldir}/default" +nonetworkdir="${leveldir}/nonetwork" +shutdowndir="${leveldir}/shutdown" + +sysinit= +case "${os}" in + Linux) + sysinit="${sysinit} cgroups devfs dmesg sysfs" + ;; +esac + +boot="bootmisc fsck hostname localmount loopback root swap sysctl urandom" +if [ "${net}" = yes ]; then + boot="${boot} network staticroute" +fi +boot_BSD="hostid newsyslog savecore syslogd" + +case "${os}" in + DragonFly) + boot="${boot} ${boot_BSD}" + ;; + FreeBSD|GNU-kFreeBSD) + boot="${boot} ${boot_BSD} adjkerntz dumpon modules syscons" + ;; + Linux) + boot="${boot} binfmt hwclock keymaps modules mtab procfs + save-keymaps save-termencoding termencoding" + ;; + NetBSD) + boot="${boot} ${boot_BSD} devdb swap-blk tys wscons" + ;; +esac + +default="local netmount" + +nonetwork="local" + +shutdown="savecache" +case "${os}" in + Linux) + shutdown="${shutdown} killprocs mount-ro" + ;; +esac + +if ! test -d "${DESTDIR}${sysinitdir}"; then + install -d "${DESTDIR}${sysinitdir}" + for x in ${sysinit}; do + ln -snf "${init_d_dir}/$x" "${DESTDIR}${sysinitdir}/$x" + done +fi + +if ! test -d "${DESTDIR}${bootdir}"; then + install -d "${DESTDIR}${bootdir}" + for x in ${boot}; do + ln -snf "${init_d_dir}/$x" "${DESTDIR}${bootdir}/$x" + done +fi + +if ! test -d "${DESTDIR}${defaultdir}"; then + install -d "${DESTDIR}${defaultdir}" + for x in ${default}; do + ln -snf "${init_d_dir}/$x" "${DESTDIR}${defaultdir}/$x" + done +fi + +if ! test -d "${DESTDIR}${nonetworkdir}"; then + install -d "${DESTDIR}${nonetworkdir}" + for x in ${nonetwork}; do + ln -snf "${init_d_dir}/$x" "${DESTDIR}${nonetworkdir}/$x" + done +fi + +if ! test -d "${DESTDIR}${shutdowndir}"; then + install -d "${DESTDIR}${shutdowndir}" + for x in ${shutdown}; do + ln -snf "${init_d_dir}/$x" "${DESTDIR}${shutdowndir}/$x" + done +fi + +ln -snf "${rc_libexecdir}"/sh/functions.sh "${DESTDIR}/${init_d_dir}" |