aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile7
-rw-r--r--src/checkpath/checkpath.c (renamed from src/rc/checkpath.c)4
-rw-r--r--src/checkpath/meson.build9
-rw-r--r--src/common/meson.build6
-rw-r--r--src/einfo/einfo.c (renamed from src/rc/do_e.c)0
-rw-r--r--src/einfo/meson.build32
-rw-r--r--src/fstabinfo/fstabinfo.c (renamed from src/rc/fstabinfo.c)2
-rw-r--r--src/fstabinfo/meson.build7
-rw-r--r--src/halt/halt.in29
-rw-r--r--src/halt/meson.build7
-rw-r--r--src/is_newer_than/is_newer_than.c (renamed from src/rc/is_newer_than.c)2
-rw-r--r--src/is_newer_than/meson.build6
-rw-r--r--src/is_older_than/is_older_than.c (renamed from src/rc/is_older_than.c)2
-rw-r--r--src/is_older_than/meson.build6
-rw-r--r--src/kill_all/kill_all.c (renamed from src/rc/kill_all.c)2
-rw-r--r--src/kill_all/meson.build9
-rw-r--r--src/libeinfo/.gitignore1
-rw-r--r--src/libeinfo/Makefile12
-rw-r--r--src/librc/.gitignore2
-rw-r--r--src/librc/Makefile48
-rw-r--r--src/librc/librc.h2
-rw-r--r--src/mark_service/mark_service.c (renamed from src/rc/do_mark_service.c)2
-rw-r--r--src/mark_service/meson.build20
-rw-r--r--src/meson.build36
-rw-r--r--src/mountinfo/meson.build7
-rw-r--r--src/mountinfo/mountinfo.c (renamed from src/rc/mountinfo.c)2
-rw-r--r--src/on_ac_power/meson.build3
-rw-r--r--src/on_ac_power/on_ac_power47
-rw-r--r--src/openrc-init/meson.build10
-rw-r--r--src/openrc-init/openrc-init.c (renamed from src/rc/openrc-init.c)4
-rw-r--r--src/openrc-run/meson.build17
-rw-r--r--src/openrc-run/openrc-run.c (renamed from src/rc/openrc-run.c)6
-rw-r--r--src/openrc-shutdown/broadcast.c (renamed from src/rc/broadcast.c)0
-rw-r--r--src/openrc-shutdown/broadcast.h (renamed from src/rc/broadcast.h)0
-rw-r--r--src/openrc-shutdown/meson.build10
-rw-r--r--src/openrc-shutdown/openrc-shutdown.c (renamed from src/rc/openrc-shutdown.c)4
-rw-r--r--src/openrc-shutdown/rc-sysvinit.c (renamed from src/rc/rc-sysvinit.c)0
-rw-r--r--src/openrc-shutdown/rc-sysvinit.h (renamed from src/rc/rc-sysvinit.h)0
-rw-r--r--src/openrc/meson.build17
-rw-r--r--src/openrc/rc-logger.c (renamed from src/rc/rc-logger.c)2
-rw-r--r--src/openrc/rc-logger.h (renamed from src/rc/rc-logger.h)0
-rw-r--r--src/openrc/rc.c (renamed from src/rc/rc.c)4
-rw-r--r--src/poweroff/meson.build7
-rw-r--r--src/poweroff/poweroff.in28
-rw-r--r--src/rc-abort/meson.build6
-rw-r--r--src/rc-abort/rc-abort.c (renamed from src/rc/rc-abort.c)0
-rw-r--r--src/rc-depend/meson.build7
-rw-r--r--src/rc-depend/rc-depend.c (renamed from src/rc/rc-depend.c)2
-rw-r--r--src/rc-service/meson.build7
-rw-r--r--src/rc-service/rc-service.c (renamed from src/rc/rc-service.c)2
-rw-r--r--src/rc-sstat/meson.build5
-rw-r--r--src/rc-sstat/rc-sstat149
-rw-r--r--src/rc-status/meson.build8
-rw-r--r--src/rc-status/rc-status.c (renamed from src/rc/rc-status.c)2
-rw-r--r--src/rc-update/meson.build7
-rw-r--r--src/rc-update/rc-update.c (renamed from src/rc/rc-update.c)2
-rw-r--r--src/rc/.gitignore66
-rw-r--r--src/rc/Makefile186
-rw-r--r--src/rc/meson.build320
-rw-r--r--src/reboot/meson.build7
-rw-r--r--src/reboot/reboot.in30
-rw-r--r--src/seedrng/meson.build9
-rw-r--r--src/seedrng/seedrng.c (renamed from src/rc/seedrng.c)0
-rw-r--r--src/service/meson.build20
-rw-r--r--src/service/service.c (renamed from src/rc/do_service.c)2
-rw-r--r--src/shared/_usage.c (renamed from src/rc/_usage.c)2
-rw-r--r--src/shared/_usage.h (renamed from src/rc/_usage.h)0
-rw-r--r--src/shared/helpers.h (renamed from src/includes/helpers.h)0
-rw-r--r--src/shared/meson.build35
-rw-r--r--src/shared/misc.c (renamed from src/rc/rc-misc.c)6
-rw-r--r--src/shared/misc.h (renamed from src/includes/rc-misc.h)2
-rw-r--r--src/shared/plugin.c (renamed from src/rc/rc-plugin.c)6
-rw-r--r--src/shared/plugin.h (renamed from src/rc/rc-plugin.h)2
-rw-r--r--src/shared/queue.h (renamed from src/includes/queue.h)0
-rw-r--r--src/shared/schedules.c (renamed from src/rc/rc-schedules.c)4
-rw-r--r--src/shared/schedules.h (renamed from src/rc/rc-schedules.h)0
-rw-r--r--src/shared/selinux.c (renamed from src/rc/rc-selinux.c)8
-rw-r--r--src/shared/selinux.h (renamed from src/rc/rc-selinux.h)0
-rw-r--r--src/shared/version.h.in (renamed from src/common/version.h.in)0
-rw-r--r--src/shared/version.in (renamed from src/common/version.in)0
-rw-r--r--src/shared/wtmp.c (renamed from src/rc/rc-wtmp.c)4
-rw-r--r--src/shared/wtmp.h (renamed from src/includes/rc-wtmp.h)0
-rw-r--r--src/shell_var/meson.build4
-rw-r--r--src/shell_var/shell_var.c (renamed from src/rc/shell_var.c)0
-rw-r--r--src/shutdown/meson.build7
-rw-r--r--src/shutdown/shutdown.in46
-rw-r--r--src/start-stop-daemon/meson.build15
-rw-r--r--src/start-stop-daemon/rc-pipes.c (renamed from src/rc/rc-pipes.c)0
-rw-r--r--src/start-stop-daemon/rc-pipes.h (renamed from src/rc/rc-pipes.h)0
-rw-r--r--src/start-stop-daemon/start-stop-daemon.c (renamed from src/rc/start-stop-daemon.c)4
-rw-r--r--src/start-stop-daemon/start-stop-daemon.pam (renamed from src/rc/start-stop-daemon.pam)0
-rw-r--r--src/supervise-daemon/meson.build14
-rw-r--r--src/supervise-daemon/supervise-daemon.c (renamed from src/rc/supervise-daemon.c)6
-rw-r--r--src/supervise-daemon/supervise-daemon.pam (renamed from src/rc/supervise-daemon.pam)0
-rw-r--r--src/swclock/meson.build7
-rw-r--r--src/swclock/swclock.c (renamed from src/rc/swclock.c)2
-rw-r--r--src/value/meson.build15
-rw-r--r--src/value/value.c (renamed from src/rc/do_value.c)2
98 files changed, 751 insertions, 698 deletions
diff --git a/src/Makefile b/src/Makefile
deleted file mode 100644
index 0148c4d1..00000000
--- a/src/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
-# Released under the 2-clause BSD license.
-
-SUBDIR= libeinfo librc rc
-
-MK= ../mk
-include ${MK}/subdir.mk
diff --git a/src/rc/checkpath.c b/src/checkpath/checkpath.c
index 550e7cea..34f5c452 100644
--- a/src/rc/checkpath.c
+++ b/src/checkpath/checkpath.c
@@ -33,8 +33,8 @@
#include "einfo.h"
#include "rc.h"
-#include "rc-misc.h"
-#include "rc-selinux.h"
+#include "misc.h"
+#include "selinux.h"
#include "_usage.h"
typedef enum {
diff --git a/src/checkpath/meson.build b/src/checkpath/meson.build
new file mode 100644
index 00000000..300dcf2f
--- /dev/null
+++ b/src/checkpath/meson.build
@@ -0,0 +1,9 @@
+executable('checkpath',
+ ['checkpath.c', misc_c, usage_c, selinux_c,
+ version_h],
+ c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo, librc],
+ dependencies: [audit_dep, pam_dep, pam_misc_dep, selinux_dep, crypt_dep],
+ install: true,
+ install_dir: rc_bindir)
diff --git a/src/common/meson.build b/src/common/meson.build
deleted file mode 100644
index 2e421658..00000000
--- a/src/common/meson.build
+++ /dev/null
@@ -1,6 +0,0 @@
-version_h = vcs_tag(
- input : 'version.h.in',
- output : 'version.h')
-version_f = vcs_tag(
- input : 'version.in',
- output : 'version')
diff --git a/src/rc/do_e.c b/src/einfo/einfo.c
index 1778efe4..1778efe4 100644
--- a/src/rc/do_e.c
+++ b/src/einfo/einfo.c
diff --git a/src/einfo/meson.build b/src/einfo/meson.build
new file mode 100644
index 00000000..df11d5fd
--- /dev/null
+++ b/src/einfo/meson.build
@@ -0,0 +1,32 @@
+einfo_execs = [
+ 'einfon',
+ 'einfo',
+ 'ewarnn',
+ 'ewarn',
+ 'eerrorn',
+ 'eerror',
+ 'ebegin',
+ 'eend',
+ 'ewend',
+ 'eindent',
+ 'eoutdent',
+ 'esyslog',
+ 'eval_ecolors',
+ 'ewaitfile',
+ 'veinfo',
+ 'vewarn',
+ 'vebegin',
+ 'veend',
+ 'vewend',
+ 'veindent',
+ 'veoutdent',
+ ]
+
+foreach exec: einfo_execs
+ executable(exec,
+ ['einfo.c', version_h],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo, librc],
+ install: true,
+ install_dir: rc_bindir)
+endforeach
diff --git a/src/rc/fstabinfo.c b/src/fstabinfo/fstabinfo.c
index 2a1a12ea..ef7d0609 100644
--- a/src/rc/fstabinfo.c
+++ b/src/fstabinfo/fstabinfo.c
@@ -58,7 +58,7 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
#include "_usage.h"
const char *applet = NULL;
diff --git a/src/fstabinfo/meson.build b/src/fstabinfo/meson.build
new file mode 100644
index 00000000..d7b9153a
--- /dev/null
+++ b/src/fstabinfo/meson.build
@@ -0,0 +1,7 @@
+executable('fstabinfo',
+ ['fstabinfo.c', misc_c, usage_c, version_h],
+ c_args : cc_branding_flags,
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo, librc],
+ install: true,
+ install_dir: rc_bindir)
diff --git a/src/halt/halt.in b/src/halt/halt.in
new file mode 100644
index 00000000..209dc130
--- /dev/null
+++ b/src/halt/halt.in
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+option_arg=
+poweroff_arg=
+while getopts :nwdfiph opt; do
+ case "$opt" in
+ n) ;;
+ w) poweroff_arg=--write-only ;;
+ d) option_arg=--no-write ;;
+ f) ;;
+ i) ;;
+ p) poweroff_arg=--poweroff ;;
+ [?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
+ exit 1
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+if [ -z "${poweroff_arg}" ]; then
+ poweroff_arg=--poweroff
+fi
+
+script_args="$@"
+if [ -z "${script_args}" ]; then
+ script_args=now
+fi
+
+exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "${script_args}"
diff --git a/src/halt/meson.build b/src/halt/meson.build
new file mode 100644
index 00000000..dde1bca7
--- /dev/null
+++ b/src/halt/meson.build
@@ -0,0 +1,7 @@
+if os == 'Linux' and get_option('sysvinit')
+ configure_file(input : 'halt.in',
+ output : '@BASENAME@',
+ configuration : script_conf_data,
+ install_dir: sbindir,
+ install_mode: 'rwxr-xr-x')
+endif
diff --git a/src/rc/is_newer_than.c b/src/is_newer_than/is_newer_than.c
index 957ecbf4..bd916ec5 100644
--- a/src/rc/is_newer_than.c
+++ b/src/is_newer_than/is_newer_than.c
@@ -16,7 +16,7 @@
#include <stdlib.h>
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
int main(int argc, char **argv)
{
diff --git a/src/is_newer_than/meson.build b/src/is_newer_than/meson.build
new file mode 100644
index 00000000..b20ebf58
--- /dev/null
+++ b/src/is_newer_than/meson.build
@@ -0,0 +1,6 @@
+executable('is_newer_than',
+ ['is_newer_than.c', misc_c, version_h],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo, librc],
+ install: true,
+ install_dir: rc_bindir)
diff --git a/src/rc/is_older_than.c b/src/is_older_than/is_older_than.c
index c9e25f30..b3f7072b 100644
--- a/src/rc/is_older_than.c
+++ b/src/is_older_than/is_older_than.c
@@ -16,7 +16,7 @@
#include <stdlib.h>
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
int main(int argc, char **argv)
{
diff --git a/src/is_older_than/meson.build b/src/is_older_than/meson.build
new file mode 100644
index 00000000..cd4c1c43
--- /dev/null
+++ b/src/is_older_than/meson.build
@@ -0,0 +1,6 @@
+executable('is_older_than',
+ ['is_older_than.c', misc_c, version_h],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo, librc],
+ install: true,
+ install_dir: rc_bindir)
diff --git a/src/rc/kill_all.c b/src/kill_all/kill_all.c
index 551572b7..704f30b8 100644
--- a/src/rc/kill_all.c
+++ b/src/kill_all/kill_all.c
@@ -31,7 +31,7 @@
#include "einfo.h"
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
#include "_usage.h"
const char *applet = NULL;
diff --git a/src/kill_all/meson.build b/src/kill_all/meson.build
new file mode 100644
index 00000000..177b537e
--- /dev/null
+++ b/src/kill_all/meson.build
@@ -0,0 +1,9 @@
+if os == 'Linux'
+ executable('kill_all',
+ ['kill_all.c', usage_c, version_h],
+ c_args : cc_branding_flags,
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo,librc],
+ install: true,
+ install_dir: rc_bindir)
+endif
diff --git a/src/libeinfo/.gitignore b/src/libeinfo/.gitignore
deleted file mode 100644
index 373284db..00000000
--- a/src/libeinfo/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-libeinfo.so.1
diff --git a/src/libeinfo/Makefile b/src/libeinfo/Makefile
deleted file mode 100644
index e6ccb650..00000000
--- a/src/libeinfo/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-LIB= einfo
-SHLIB_MAJOR= 1
-SRCS= libeinfo.c
-INCS= einfo.h
-VERSION_MAP= einfo.map
-
-LOCAL_CPPFLAGS+= -I../includes
-
-MK= ../../mk
-include ${MK}/lib.mk
-include ${MK}/cc.mk
-include ${MK}/termcap.mk
diff --git a/src/librc/.gitignore b/src/librc/.gitignore
deleted file mode 100644
index e7fafe8c..00000000
--- a/src/librc/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-librc.so.1
-rc.h
diff --git a/src/librc/Makefile b/src/librc/Makefile
deleted file mode 100644
index 08c599ef..00000000
--- a/src/librc/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-LIB= rc
-SHLIB_MAJOR= 1
-SRCS= librc.c librc-daemon.c librc-depend.c librc-misc.c \
- librc-stringlist.c
-INCS= rc.h
-VERSION_MAP= rc.map
-
-LDADD+= ${LIBKVM}
-
-LOCAL_CPPFLAGS+= -I../includes
-
-MK= ../../mk
-include ${MK}/lib.mk
-include ${MK}/cc.mk
-
-# Massage our header file for our dirs
-SED_CMD= -e 's:@PREFIX@:${PREFIX}:g'
-SED_CMD+= -e 's:@LIB@:${LIBNAME}:g'
-SED_CMD+= -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
-SED_CMD+= -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
-SED_CMD+= -e 's:@BINDIR@:${BINDIR}:g'
-SED_CMD+= -e 's:@SBINDIR@:${SBINDIR}:g'
-
-_PKG_PREFIX= -e 's:.*@PKG_PREFIX@.*:\#undef RC_PKG_PREFIX:g'
-ifneq (${PKG_PREFIX},)
-ifneq (${PKG_PREFIX},/)
-ifneq (${PKG_PREFIX},${PREFIX})
-_PKG_PREFIX= -e 's:@PKG_PREFIX@:${PKG_PREFIX}:g'
-endif
-endif
-endif
-SED_CMD+= ${_PKG_PREFIX}
-
-_LCL_PREFIX= -e 's:@LOCAL_PREFIX@::g'
-ifneq (${LOCAL_PREFIX},)
-ifneq (${LOCAL_PREFIX},/)
-ifneq (${LOCAL_PREFIX},${PREFIX})
-_LCL_PREFIX= -e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g'
-endif
-endif
-endif
-SED_CMD+= ${_LCL_PREFIX}
-
-%.h: %.h.in
- ${SED} ${SED_CMD} $< > $@
-${SRCS}: rc.h
-
-CLEANFILES+= rc.h
diff --git a/src/librc/librc.h b/src/librc/librc.h
index 64198b2e..09ab9276 100644
--- a/src/librc/librc.h
+++ b/src/librc/librc.h
@@ -54,6 +54,6 @@
#endif
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
#endif
diff --git a/src/rc/do_mark_service.c b/src/mark_service/mark_service.c
index d7b2658a..eaab6eed 100644
--- a/src/rc/do_mark_service.c
+++ b/src/mark_service/mark_service.c
@@ -27,7 +27,7 @@
#include "einfo.h"
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
const char *applet = NULL;
diff --git a/src/mark_service/meson.build b/src/mark_service/meson.build
new file mode 100644
index 00000000..ba046dcb
--- /dev/null
+++ b/src/mark_service/meson.build
@@ -0,0 +1,20 @@
+mark_service_execs = [
+ 'mark_service_starting',
+ 'mark_service_started',
+ 'mark_service_stopping',
+ 'mark_service_stopped',
+ 'mark_service_inactive',
+ 'mark_service_wasinactive',
+ 'mark_service_hotplugged',
+ 'mark_service_failed',
+ 'mark_service_crashed',
+ ]
+
+foreach exec : mark_service_execs
+ executable(exec,
+ ['mark_service.c', misc_c, version_h],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo,librc],
+ install: true,
+ install_dir: rc_sbindir)
+endforeach
diff --git a/src/meson.build b/src/meson.build
index d7390f54..76f6d8a1 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,4 +1,36 @@
-subdir('common')
+script_conf_data = configuration_data()
+script_conf_data.set('SBINDIR', sbindir)
+
+subdir('shared')
subdir('libeinfo')
subdir('librc')
-subdir('rc')
+subdir('checkpath')
+subdir('einfo')
+subdir('fstabinfo')
+subdir('halt')
+subdir('is_newer_than')
+subdir('is_older_than')
+subdir('kill_all')
+subdir('mark_service')
+subdir('mountinfo')
+subdir('on_ac_power')
+subdir('openrc')
+subdir('openrc-init')
+subdir('openrc-run')
+subdir('openrc-shutdown')
+subdir('poweroff')
+subdir('rc-abort')
+subdir('rc-depend')
+subdir('rc-service')
+subdir('rc-sstat')
+subdir('rc-status')
+subdir('rc-update')
+subdir('reboot')
+subdir('service')
+subdir('seedrng')
+subdir('shell_var')
+subdir('shutdown')
+subdir('start-stop-daemon')
+subdir('supervise-daemon')
+subdir('swclock')
+subdir('value')
diff --git a/src/mountinfo/meson.build b/src/mountinfo/meson.build
new file mode 100644
index 00000000..71b8a652
--- /dev/null
+++ b/src/mountinfo/meson.build
@@ -0,0 +1,7 @@
+executable('mountinfo',
+ ['mountinfo.c', misc_c, usage_c, version_h],
+ c_args : cc_branding_flags,
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo, librc],
+ install: true,
+ install_dir: rc_bindir)
diff --git a/src/rc/mountinfo.c b/src/mountinfo/mountinfo.c
index 6652760d..c55b12ab 100644
--- a/src/rc/mountinfo.c
+++ b/src/mountinfo/mountinfo.c
@@ -42,7 +42,7 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
#include "_usage.h"
const char *applet = NULL;
diff --git a/src/on_ac_power/meson.build b/src/on_ac_power/meson.build
new file mode 100644
index 00000000..aedc4daa
--- /dev/null
+++ b/src/on_ac_power/meson.build
@@ -0,0 +1,3 @@
+install_data('on_ac_power',
+ install_dir : rc_bindir,
+ install_mode: 'rwxr-xr-x')
diff --git a/src/on_ac_power/on_ac_power b/src/on_ac_power/on_ac_power
new file mode 100644
index 00000000..a4c1cf9c
--- /dev/null
+++ b/src/on_ac_power/on_ac_power
@@ -0,0 +1,47 @@
+#!/bin/sh
+# Detect AC power or not in a portable way
+# Exit 0 if on AC power, 1 if not and 255 if we don't know how to work it out
+
+# Copyright (c) 2007-2015 The OpenRC Authors.
+# See the Authors file at the top-level directory of this distribution and
+# https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
+#
+# This file is part of OpenRC. It is subject to the license terms in
+# the LICENSE file found in the top-level directory of this
+# distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
+# This file may not be copied, modified, propagated, or distributed
+# except according to the terms contained in the LICENSE file.
+
+if [ -f /proc/acpi/ac_adapter/*/state ]; then
+ cat /proc/acpi/ac_adapter/*/state | while read line; do
+ case "$line" in
+ "state:"*"off-line") exit 128;;
+ esac
+ done
+elif [ -d /sys/class/power_supply ]; then
+ for dir in /sys/class/power_supply/*/; do
+ [ "$(cat "${dir}/type")" != "Mains" ] && continue
+ [ "$(cat "${dir}/online")" = 0 ] && exit 128
+ done
+elif [ -f /proc/pmu/info ]; then
+ cat /proc/pmu/info | while read line; do
+ case "$line" in
+ "AC Power"*": 0") exit 128;;
+ esac
+ done
+elif command -v envstat >/dev/null 2>&1; then
+ # NetBSD has envstat
+ envstat -d acpiacad0 2>/dev/null | while read line; do
+ case "$line" in
+ "connected:"*"OFF") exit 128;;
+ esac
+ done
+elif sysctl -q hw.acpi.acline >/dev/null 2>/dev/null; then
+ case $(sysctl -n hw.acpi.acline) in
+ 0) exit 1;;
+ *) exit 0;;
+ esac
+else
+ exit 255
+fi
+[ $? != 128 ]
diff --git a/src/openrc-init/meson.build b/src/openrc-init/meson.build
new file mode 100644
index 00000000..08cc318d
--- /dev/null
+++ b/src/openrc-init/meson.build
@@ -0,0 +1,10 @@
+if os == 'Linux'
+ executable('openrc-init',
+ ['openrc-init.c', plugin_c, wtmp_c, version_h],
+ c_args : cc_selinux_flags,
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo, librc],
+ dependencies: [dl_dep, selinux_dep],
+ install: true,
+ install_dir: sbindir)
+endif
diff --git a/src/rc/openrc-init.c b/src/openrc-init/openrc-init.c
index 5bc53434..2e6d3677 100644
--- a/src/rc/openrc-init.c
+++ b/src/openrc-init/openrc-init.c
@@ -38,8 +38,8 @@
#include "helpers.h"
#include "rc.h"
-#include "rc-plugin.h"
-#include "rc-wtmp.h"
+#include "plugin.h"
+#include "wtmp.h"
#include "version.h"
static const char *path_default = "/sbin:/usr/sbin:/bin:/usr/bin";
diff --git a/src/openrc-run/meson.build b/src/openrc-run/meson.build
new file mode 100644
index 00000000..2e4b29a0
--- /dev/null
+++ b/src/openrc-run/meson.build
@@ -0,0 +1,17 @@
+executable('openrc-run',
+ ['openrc-run.c', misc_c, plugin_c, selinux_c, usage_c, version_h],
+ c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags],
+ link_with: [libeinfo, librc],
+ dependencies: [audit_dep, dl_dep, pam_dep, pam_misc_dep, selinux_dep, util_dep, crypt_dep],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ install: true,
+ install_dir: sbindir)
+
+executable('runscript',
+ ['openrc-run.c', misc_c, plugin_c, selinux_c, usage_c, version_h],
+ c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags],
+ link_with: [libeinfo, librc],
+ dependencies: [audit_dep, dl_dep, pam_dep, pam_misc_dep, selinux_dep, util_dep, crypt_dep],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ install: true,
+ install_dir: sbindir)
diff --git a/src/rc/openrc-run.c b/src/openrc-run/openrc-run.c
index ff9659a3..f9056110 100644
--- a/src/rc/openrc-run.c
+++ b/src/openrc-run/openrc-run.c
@@ -50,9 +50,9 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "rc-misc.h"
-#include "rc-plugin.h"
-#include "rc-selinux.h"
+#include "misc.h"
+#include "plugin.h"
+#include "selinux.h"
#include "_usage.h"
#define PREFIX_LOCK RC_SVCDIR "/prefix.lock"
diff --git a/src/rc/broadcast.c b/src/openrc-shutdown/broadcast.c
index 402a9fb9..402a9fb9 100644
--- a/src/rc/broadcast.c
+++ b/src/openrc-shutdown/broadcast.c
diff --git a/src/rc/broadcast.h b/src/openrc-shutdown/broadcast.h
index 2255fe67..2255fe67 100644
--- a/src/rc/broadcast.h
+++ b/src/openrc-shutdown/broadcast.h
diff --git a/src/openrc-shutdown/meson.build b/src/openrc-shutdown/meson.build
new file mode 100644
index 00000000..bdd58338
--- /dev/null
+++ b/src/openrc-shutdown/meson.build
@@ -0,0 +1,10 @@
+if os == 'Linux'
+ executable('openrc-shutdown',
+ ['openrc-shutdown.c', 'broadcast.c', 'rc-sysvinit.c', misc_c,
+ usage_c, wtmp_c, version_h],
+ c_args : cc_branding_flags,
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo, librc],
+ install: true,
+ install_dir: sbindir)
+endif
diff --git a/src/rc/openrc-shutdown.c b/src/openrc-shutdown/openrc-shutdown.c
index 750946f5..1234dcfc 100644
--- a/src/rc/openrc-shutdown.c
+++ b/src/openrc-shutdown/openrc-shutdown.c
@@ -34,9 +34,9 @@
#include "einfo.h"
#include "rc.h"
#include "helpers.h"
-#include "rc-misc.h"
+#include "misc.h"
#include "rc-sysvinit.h"
-#include "rc-wtmp.h"
+#include "wtmp.h"
#include "_usage.h"
const char *applet = NULL;
diff --git a/src/rc/rc-sysvinit.c b/src/openrc-shutdown/rc-sysvinit.c
index 8d258b63..8d258b63 100644
--- a/src/rc/rc-sysvinit.c
+++ b/src/openrc-shutdown/rc-sysvinit.c
diff --git a/src/rc/rc-sysvinit.h b/src/openrc-shutdown/rc-sysvinit.h
index 6142cdd6..6142cdd6 100644
--- a/src/rc/rc-sysvinit.h
+++ b/src/openrc-shutdown/rc-sysvinit.h
diff --git a/src/openrc/meson.build b/src/openrc/meson.build
new file mode 100644
index 00000000..9ab32ef4
--- /dev/null
+++ b/src/openrc/meson.build
@@ -0,0 +1,17 @@
+executable('openrc',
+ ['rc.c', 'rc-logger.c', misc_c, plugin_c, usage_c, version_h],
+ c_args : cc_branding_flags,
+ link_with: [libeinfo, librc],
+ dependencies: [dl_dep, util_dep],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ install: true,
+ install_dir: sbindir)
+
+executable('rc',
+ ['rc.c', 'rc-logger.c', misc_c, plugin_c, usage_c, version_h],
+ c_args : cc_branding_flags,
+ link_with: [libeinfo, librc],
+ dependencies: [dl_dep, util_dep],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ install: true,
+ install_dir: sbindir)
diff --git a/src/rc/rc-logger.c b/src/openrc/rc-logger.c
index 4b1b9189..b00550a7 100644
--- a/src/rc/rc-logger.c
+++ b/src/openrc/rc-logger.c
@@ -44,7 +44,7 @@
#include "rc-logger.h"
#include "queue.h"
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
#define TMPLOG RC_SVCDIR "/rc.log"
#define DEFAULTLOG "/var/log/rc.log"
diff --git a/src/rc/rc-logger.h b/src/openrc/rc-logger.h
index 52ca9717..52ca9717 100644
--- a/src/rc/rc-logger.h
+++ b/src/openrc/rc-logger.h
diff --git a/src/rc/rc.c b/src/openrc/rc.c
index 53c75bb6..bab731ed 100644
--- a/src/rc/rc.c
+++ b/src/openrc/rc.c
@@ -47,8 +47,8 @@
#include "queue.h"
#include "rc.h"
#include "rc-logger.h"
-#include "rc-misc.h"
-#include "rc-plugin.h"
+#include "misc.h"
+#include "plugin.h"
#include "version.h"
#include "_usage.h"
diff --git a/src/poweroff/meson.build b/src/poweroff/meson.build
new file mode 100644
index 00000000..c7da747f
--- /dev/null
+++ b/src/poweroff/meson.build
@@ -0,0 +1,7 @@
+if os == 'Linux' and get_option('sysvinit')
+ configure_file(input : 'poweroff.in',
+ output : '@BASENAME@',
+ configuration : script_conf_data,
+ install_dir: sbindir,
+ install_mode: 'rwxr-xr-x')
+endif
diff --git a/src/poweroff/poweroff.in b/src/poweroff/poweroff.in
new file mode 100644
index 00000000..4e944bdc
--- /dev/null
+++ b/src/poweroff/poweroff.in
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+option_arg=
+poweroff_arg=
+while getopts :nwdfiph opt; do
+ case "$opt" in
+ n) ;;
+ w) poweroff_arg=--write-only ;;
+ d) option_arg=--no-write ;;
+ f) ;;
+ i) ;;
+ [?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
+ exit 1
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+if [ -z "${poweroff_arg}" ]; then
+ poweroff_arg=--poweroff
+fi
+
+script_args="$@"
+if [ -z "${script_args}" ]; then
+ script_args=now
+fi
+
+exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "${script_args}"
diff --git a/src/rc-abort/meson.build b/src/rc-abort/meson.build
new file mode 100644
index 00000000..137cd028
--- /dev/null
+++ b/src/rc-abort/meson.build
@@ -0,0 +1,6 @@
+executable('rc-abort',
+ 'rc-abort.c',
+ include_directories: [einfo_incdir],
+ link_with: [libeinfo],
+ install: true,
+ install_dir: rc_sbindir)
diff --git a/src/rc/rc-abort.c b/src/rc-abort/rc-abort.c
index 39a22c94..39a22c94 100644
--- a/src/rc/rc-abort.c
+++ b/src/rc-abort/rc-abort.c
diff --git a/src/rc-depend/meson.build b/src/rc-depend/meson.build
new file mode 100644
index 00000000..6835a36e
--- /dev/null
+++ b/src/rc-depend/meson.build
@@ -0,0 +1,7 @@
+executable('rc-depend',
+ ['rc-depend.c', misc_c, usage_c, version_h],
+ c_args : cc_branding_flags,
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo, librc],
+ install: true,
+ install_dir: rc_bindir)
diff --git a/src/rc/rc-depend.c b/src/rc-depend/rc-depend.c
index 80754872..9f833b70 100644
--- a/src/rc/rc-depend.c
+++ b/src/rc-depend/rc-depend.c
@@ -34,7 +34,7 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
#include "_usage.h"
const char *applet = NULL;
diff --git a/src/rc-service/meson.build b/src/rc-service/meson.build
new file mode 100644
index 00000000..3a109d8e
--- /dev/null
+++ b/src/rc-service/meson.build
@@ -0,0 +1,7 @@
+executable('rc-service',
+ ['rc-service.c', misc_c, usage_c, version_h],
+ c_args : cc_branding_flags,
+ link_with: [libeinfo, librc],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ install: true,
+ install_dir: sbindir)
diff --git a/src/rc/rc-service.c b/src/rc-service/rc-service.c
index 44651cc6..69acac19 100644
--- a/src/rc/rc-service.c
+++ b/src/rc-service/rc-service.c
@@ -24,7 +24,7 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
#include "_usage.h"
const char *applet = NULL;
diff --git a/src/rc-sstat/meson.build b/src/rc-sstat/meson.build
new file mode 100644
index 00000000..85b7a5f0
--- /dev/null
+++ b/src/rc-sstat/meson.build
@@ -0,0 +1,5 @@
+if os == 'Linux'
+ install_data('rc-sstat',
+ install_dir: sbindir,
+ install_mode: 'rwxr-xr-x')
+endif
diff --git a/src/rc-sstat/rc-sstat b/src/rc-sstat/rc-sstat
new file mode 100644
index 00000000..4811293d
--- /dev/null
+++ b/src/rc-sstat/rc-sstat
@@ -0,0 +1,149 @@
+#!/bin/sh
+# Copyright (c) 2015 The OpenRC Authors.
+# See the Authors file at the top-level directory of this distribution and
+# https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
+#
+# This file is part of OpenRC. It is subject to the license terms in
+# the LICENSE file found in the top-level directory of this
+# distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
+# This file may not be copied, modified, propagated, or distributed
+# except according to the terms contained in the LICENSE file.
+
+# Define variables
+scandir="/run/openrc/s6-scan"
+statfile=/dev/shm/s6-svstat.${USER}
+
+color_red='\E[01;31m'
+color_green='\E[32m'
+color_yellow='\E[01;33m'
+
+# Time Modules
+uptimeModules() {
+ # Given a single integer argument representing seconds of uptime...
+ # convert uptime to a friendly human readable string: '2d 16h 58m 46s'
+ # define a variable to keep track of the longest length uptime string
+ uSec=${1:-0}
+
+ uDay=$(( $uSec / 86400 ))
+ uSec=$(( $uSec % 86400 ))
+ uHour=$(( $uSec / 3600 ))
+ uSec=$(( $uSec % 3600 ))
+ uMin=$(( $uSec / 60 ))
+ uSec=$(( $uSec % 60 ))
+
+ [ $uDay -ne 0 ] && pDay="${uDay}d " || pDay=""
+ [ $uHour -ne 0 ] && pHour="${uHour}h " || pHour=""
+ [ $uMin -ne 0 ] && pMin="${uMin}m " || pMin=""
+ [ $uSec -ne 0 ] && pSec="${uSec}s " || pSec=""
+
+ parsedUptime="$( echo ${pDay}${pHour}${pMin}${pSec} | sed 's#[ \t]*$##' )"
+ uCharCount=${#parsedUptime}
+}
+
+# Make sure we are running as root
+if [ $(id -u) != 0 ]; then
+ printf "This command must be run as root\n"
+ exit 1
+fi
+
+# Make sure scandir exists
+if [ ! -d $scandir ]; then
+ printf "%s\n" "$scandir does not exist"
+ exit 1
+fi
+
+# Make sure s6-svscan is running
+if ! pgrep s6-svscan >/dev/null ; then
+ printf "s6-svscan is not running\n"
+ exit 1
+fi
+
+# If TERM is undefined (launching sstat through an ssh command) then make it vt100
+if [ -z $TERM -o $TERM = "dumb" ]; then
+ export TERM=vt100
+fi
+
+# Gather list of candidate services s6-supervise may be supervising
+# filter for folders and symlinks at /run/openrc/s6-scan/* ommiting output starting with '.'
+services="$(find $scandir -maxdepth 1 -mindepth 1 \( -type d -or -type l \) | awk -F'/' '{ if ( $NF !~ "^\\." ) print $NF}')"
+if [ -z "$services" ]; then
+ printf "s6 found no services configured for supervision\n"
+ exit 1
+fi
+
+# Gather status for each service from s6-svstat
+# write to tmp file in memory for non I/O bound repeatative access
+rm -f $statfile 2>/dev/null
+for service in $services ; do
+ echo "$service $(s6-svstat ${scandir}/${service})" >> $statfile
+done
+
+# Define longest string from parsed uptime (default to 7 to match string length of 'Up Time')
+timeStringLength=7
+for uptime in $(awk '$2 == "up" {print $5}' $statfile | sort -run)
+do
+ uptimeModules $uptime
+ [ ${uCharCount} -gt $timeStringLength ] && timeStringLength=$uCharCount
+done
+
+
+# Print the status header like so...
+# Service Name State PID Up Time Start Time
+#---------------------------- ----- ----- -------------- -------------------
+printf "\n"
+printf "%28s %5s %5s %${timeStringLength}s %19s\n" "Service Name" "State" "PID" "Up Time" "Start Time"
+for dashes in 28 5 5 $timeStringLength 19 ; do
+ printf "%0.s-" $(seq 1 $dashes) ; echo -n ' '
+done && printf "\n"
+
+
+# sshd up (pid 26300) 80373 seconds
+cat $statfile | \
+while read line
+do
+ set $line
+
+ service=$1
+ state=$2
+ pid=${4/)/}
+ time=$5
+
+ # call function to convert time in seconds and define additional variables
+ uptimeModules $time
+
+ if [ "$state" = up ]; then
+ if [ $time -lt 30 ]; then
+ # uptime < 30 seconds, color the whole line yellow
+ echo -en "$color_yellow"
+ # 1st 4 columns are printed with printf for space padding
+ printf "%28s %5s %5s %${timeStringLength}s" $service $state $pid "$parsedUptime"
+ # 4th column is output from date -d
+ echo -e " $(date -d "${time} seconds ago" "+%F %T")"
+ # reset terminal colors
+ tput sgr0
+ else
+ printf "%28s" $service
+ # uptime > 30 seconds, color just the "state" value green
+ echo -en "$color_green"
+ printf " %5s" $state
+ # reset terminal colors
+ tput sgr0
+ printf " %5s" $pid
+ printf " %${timeStringLength}s" "$parsedUptime"
+ echo -e " $(date -d "${time} seconds ago" "+%F %T")"
+ fi
+ else
+ printf "%28s" $service
+ echo -en "$color_red"
+ printf " %5s" $state
+ tput sgr0
+ echo ""
+ fi
+done
+
+# Cleanup
+rm -f $statfile 2>/dev/null
+
+printf "\n\n"
+
+rc-status
diff --git a/src/rc-status/meson.build b/src/rc-status/meson.build
new file mode 100644
index 00000000..7377d837
--- /dev/null
+++ b/src/rc-status/meson.build
@@ -0,0 +1,8 @@
+executable('rc-status',
+ ['rc-status.c', misc_c, usage_c, version_h],
+ c_args : cc_branding_flags,
+ link_with: [libeinfo, librc],
+ dependencies: [util_dep],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ install: true,
+ install_dir: bindir)
diff --git a/src/rc/rc-status.c b/src/rc-status/rc-status.c
index 7eb152ec..cb701e24 100644
--- a/src/rc/rc-status.c
+++ b/src/rc-status/rc-status.c
@@ -25,7 +25,7 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
#include "_usage.h"
enum format_t {
diff --git a/src/rc-update/meson.build b/src/rc-update/meson.build
new file mode 100644
index 00000000..7d284979
--- /dev/null
+++ b/src/rc-update/meson.build
@@ -0,0 +1,7 @@
+executable('rc-update',
+ ['rc-update.c', misc_c, usage_c, version_h],
+ c_args : cc_branding_flags,
+ link_with: [libeinfo, librc],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ install: true,
+ install_dir: sbindir)
diff --git a/src/rc/rc-update.c b/src/rc-update/rc-update.c
index d6dbf240..445db4e8 100644
--- a/src/rc/rc-update.c
+++ b/src/rc-update/rc-update.c
@@ -27,7 +27,7 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
#include "_usage.h"
const char *applet = NULL;
diff --git a/src/rc/.gitignore b/src/rc/.gitignore
deleted file mode 100644
index a43088aa..00000000
--- a/src/rc/.gitignore
+++ /dev/null
@@ -1,66 +0,0 @@
-version.h
-rc-status
-rc-service
-rc-update
-runscript
-service
-start-stop-daemon
-supervise-daemon
-einfon
-einfo
-ewarnn
-ewarn
-eerrorn
-eerror
-ebegin
-eend
-ewend
-eindent
-eoutdent
-esyslog
-eval_ecolors
-ewaitfile
-veinfo
-vewarn
-vebegin
-veend
-vewend
-veindent
-veoutdent
-service_starting
-service_started
-service_stopping
-service_stopped
-service_inactive
-service_wasinactive
-service_hotplugged
-service_started_daemon
-service_crashed
-checkpath
-fstabinfo
-mountinfo
-swclock
-rc-depend
-service_get_value
-service_set_value
-get_options
-save_options
-shell_var
-is_newer_than
-is_older_than
-mark_service_starting
-mark_service_started
-mark_service_stopping
-mark_service_stopped
-mark_service_inactive
-mark_service_wasinactive
-mark_service_hotplugged
-mark_service_failed
-mark_service_crashed
-rc-abort
-rc
-openrc
-openrc-init
-openrc-run
-openrc-shutdown
-kill_all
diff --git a/src/rc/Makefile b/src/rc/Makefile
deleted file mode 100644
index 306f6d8d..00000000
--- a/src/rc/Makefile
+++ /dev/null
@@ -1,186 +0,0 @@
-include ../../Makefile.inc
-MK= ../../mk
-include ${MK}/os.mk
-
-SRCS= checkpath.c do_e.c do_mark_service.c do_service.c \
- do_value.c fstabinfo.c is_newer_than.c is_older_than.c \
- mountinfo.c openrc-run.c rc-abort.c rc.c \
- rc-depend.c rc-logger.c rc-misc.c rc-pipes.c \
- rc-plugin.c rc-service.c rc-status.c rc-update.c \
- shell_var.c start-stop-daemon.c supervise-daemon.c swclock.c _usage.c
-
-ifeq (${MKSELINUX},yes)
-SRCS+= rc-selinux.c
-endif
-
-ifeq (${OS},Linux)
-SRCS+= kill_all.c openrc-init.c openrc-shutdown.c rc-sysvinit.c broadcast.c \
- rc-wtmp.c seedrng.c
-endif
-
-CLEANFILES= version.h rc-selinux.o
-
-BINDIR= ${PREFIX}/bin
-SBINDIR= ${PREFIX}/sbin
-LINKDIR= ${LIBEXECDIR}
-
-BINPROGS= rc-status
-SBINPROGS = openrc openrc-run rc rc-service rc-update runscript \
- start-stop-daemon supervise-daemon
-RC_BINPROGS= einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
- eindent eoutdent esyslog eval_ecolors ewaitfile \
- veinfo vewarn vebegin veend vewend veindent veoutdent \
- checkpath fstabinfo mountinfo rc-depend \
- is_newer_than is_older_than \
- service_get_value service_set_value get_options save_options \
- service_starting service_started \
- service_stopping service_stopped \
- service_inactive service_wasinactive \
- service_hotplugged service_started_daemon service_crashed \
- shell_var
-RC_SBINPROGS= mark_service_starting mark_service_started \
- mark_service_stopping mark_service_stopped \
- mark_service_inactive mark_service_wasinactive \
- mark_service_hotplugged mark_service_failed \
- mark_service_crashed \
- rc-abort swclock
-
-ifeq (${OS},Linux)
-RC_BINPROGS+= kill_all
-RC_SBINPROGS+= seedrng
-SBINPROGS+= openrc-init openrc-shutdown
-endif
-
-ALL_PROGS= ${BINPROGS} ${SBINPROGS} ${RC_BINPROGS} ${RC_SBINPROGS}
-CLEANFILES+= ${ALL_PROGS}
-
-LOCAL_CPPFLAGS=-I../includes -I../librc -I../libeinfo
-LOCAL_LDFLAGS=-L../librc -L../libeinfo
-LDADD+= -lutil -lrc -leinfo
-
-include ${MK}/prog.mk
-include ${MK}/gitver.mk
-include ${MK}/cc.mk
-
-include ${MK}/termcap.mk
-LDADD+= ${LIBDL} ${LIBKVM}
-include ${MK}/pam.mk
-
-${SRCS}: version.h
-
-.PHONY: version.h.tmp
-version.h.tmp:
- echo "#define VERSION \"${VERSION}${GITVER}\"" >$@
- if test -n "${BRANDING}"; then \
- echo "#define BRANDING \"${BRANDING}\"" >> $@; \
- fi
-
-version.h: version.h.tmp
- cmp -s $@.tmp $@ && rm $@.tmp || mv $@.tmp $@
-
-install: all
- ${INSTALL} -d ${DESTDIR}${SBINDIR}
- ${INSTALL} -m ${BINMODE} ${SBINPROGS} ${DESTDIR}${SBINDIR}
- ${INSTALL} -d ${DESTDIR}${BINDIR}
- ${INSTALL} -m ${BINMODE} ${BINPROGS} ${DESTDIR}${BINDIR}
- ${INSTALL} -d ${DESTDIR}${LINKDIR}/bin
- ${INSTALL} -m ${BINMODE} ${RC_BINPROGS} ${DESTDIR}${LINKDIR}/bin
- ${INSTALL} -d ${DESTDIR}${LINKDIR}/sbin
- ${INSTALL} -m ${BINMODE} ${RC_SBINPROGS} ${DESTDIR}${LINKDIR}/sbin
- if test "${MKPAM}" = pam; then \
- ${INSTALL} -d ${DESTDIR}${PAMDIR}; \
- ${INSTALL} -m ${PAMMODE} start-stop-daemon.pam ${DESTDIR}${PAMDIR}/start-stop-daemon; \
- ${INSTALL} -m ${PAMMODE} supervise-daemon.pam ${DESTDIR}${PAMDIR}/supervise-daemon; \
- fi
-
-check test::
-
-all: ${ALL_PROGS}
-
-checkpath: checkpath.o _usage.o rc-misc.o
-ifeq (${MKSELINUX},yes)
-checkpath: rc-selinux.o
-endif
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-kill_all: kill_all.o _usage.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
-eindent eoutdent esyslog eval_ecolors ewaitfile \
-veinfo vewarn vebegin veend vewend veindent veoutdent: do_e.o rc-misc.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-fstabinfo: fstabinfo.o _usage.o rc-misc.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-openrc-init: openrc-init.o rc-plugin.o rc-wtmp.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-is_newer_than: is_newer_than.o rc-misc.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-is_older_than: is_older_than.o rc-misc.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-mark_service_starting mark_service_started \
-mark_service_stopping mark_service_stopped \
-mark_service_inactive mark_service_wasinactive \
-mark_service_hotplugged mark_service_failed \
-mark_service_crashed: do_mark_service.o rc-misc.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-mountinfo: mountinfo.o _usage.o rc-misc.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-openrc rc: rc.o rc-logger.o rc-misc.o rc-plugin.o _usage.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-openrc-shutdown: openrc-shutdown.o rc-misc.o _usage.o broadcast.o rc-wtmp.o rc-sysvinit.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-openrc-run runscript: openrc-run.o _usage.o rc-misc.o rc-plugin.o
-ifeq (${MKSELINUX},yes)
-openrc-run runscript: rc-selinux.o
-endif
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-rc-abort: rc-abort.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ -leinfo
-
-rc-depend: rc-depend.o _usage.o rc-misc.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-rc-status: rc-status.o _usage.o rc-misc.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-rc-service: rc-service.o _usage.o rc-misc.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-rc-update: rc-update.o _usage.o rc-misc.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-start-stop-daemon: start-stop-daemon.o _usage.o rc-misc.o rc-pipes.o rc-schedules.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-supervise-daemon: supervise-daemon.o _usage.o rc-misc.o rc-plugin.o rc-schedules.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-service_get_value service_set_value get_options save_options: do_value.o rc-misc.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-service_starting service_started \
-service_stopping service_stopped \
-service_inactive service_wasinactive \
-service_hotplugged service_started_daemon \
-service_crashed: do_service.o rc-misc.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-shell_var: shell_var.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^
-
-swclock: swclock.o _usage.o rc-misc.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
-
-seedrng: seedrng.o _usage.o
- ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
diff --git a/src/rc/meson.build b/src/rc/meson.build
deleted file mode 100644
index edea4a16..00000000
--- a/src/rc/meson.build
+++ /dev/null
@@ -1,320 +0,0 @@
-rc_misc_c = files([
- 'rc-misc.c',
- ])
-
-rc_plugin_c = files([
- 'rc-plugin.c',
- ])
-
-rc_schedules_c = files([
- 'rc-schedules.c',
- ])
-
-usage_c = files([
- '_usage.c',
- ])
-
-if selinux_dep.found()
- rc_selinux_c = files([
- 'rc-selinux.c',
- ])
-else
- rc_selinux_c = []
-endif
-
-rc_wtmp_c = files([
- 'rc-wtmp.c',
- ])
-
-executable('rc-status',
- ['rc-status.c', rc_misc_c, usage_c, version_h],
- c_args : cc_branding_flags,
- link_with: [libeinfo, librc],
- dependencies: [util_dep],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- install: true,
- install_dir: bindir)
-
-executable('openrc',
- ['rc.c', 'rc-logger.c', rc_misc_c, rc_plugin_c, usage_c,
- version_h],
- c_args : cc_branding_flags,
- link_with: [libeinfo, librc],
- dependencies: [dl_dep, util_dep],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- install: true,
- install_dir: sbindir)
-
-executable('openrc-run',
- ['openrc-run.c', rc_misc_c, rc_plugin_c, usage_c,
- rc_selinux_c, version_h],
- c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags],
- link_with: [libeinfo, librc],
- dependencies: [audit_dep, dl_dep, pam_dep, pam_misc_dep, selinux_dep, util_dep, crypt_dep],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- install: true,
- install_dir: sbindir)
-
-executable('rc',
- ['rc.c', 'rc-logger.c', rc_misc_c, rc_plugin_c, usage_c, version_h],
- c_args : cc_branding_flags,
- link_with: [libeinfo, librc],
- dependencies: [dl_dep, util_dep],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- install: true,
- install_dir: sbindir)
-
-executable('rc-service',
- ['rc-service.c', rc_misc_c, usage_c, version_h],
- c_args : cc_branding_flags,
- link_with: [libeinfo, librc],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- install: true,
- install_dir: sbindir)
-
-executable('rc-update',
- ['rc-update.c', rc_misc_c, usage_c, version_h],
- c_args : cc_branding_flags,
- link_with: [libeinfo, librc],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- install: true,
- install_dir: sbindir)
-
-executable('runscript',
- ['openrc-run.c', rc_misc_c, usage_c, 'rc-plugin.c',
- rc_selinux_c, version_h],
- c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags],
- link_with: [libeinfo, librc],
- dependencies: [audit_dep, dl_dep, pam_dep, pam_misc_dep, util_dep, selinux_dep, crypt_dep],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- install: true,
- install_dir: sbindir)
-
-executable('start-stop-daemon',
- ['start-stop-daemon.c', 'rc-pipes.c', rc_misc_c, rc_schedules_c,
- rc_selinux_c, usage_c, version_h],
- c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_cap_flags, cc_selinux_flags],
- link_with: [libeinfo, librc],
- dependencies: [audit_dep, dl_dep, pam_dep, cap_dep, pam_misc_dep, util_dep, selinux_dep, crypt_dep],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- install: true,
- install_dir: sbindir)
-
-if get_option('pam')
- install_data('start-stop-daemon.pam',
- rename : 'start-stop-daemon',
- install_dir : pamdir)
-endif
-
-executable('supervise-daemon',
- ['supervise-daemon.c', rc_misc_c, rc_plugin_c, rc_schedules_c,
- usage_c, version_h],
- c_args : [cc_branding_flags, cc_pam_flags, cc_cap_flags, cc_selinux_flags],
- link_with: [libeinfo, librc],
- dependencies: [dl_dep, pam_dep, cap_dep, util_dep, selinux_dep],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- install: true,
- install_dir: sbindir)
-
-if get_option('pam')
- install_data('supervise-daemon.pam',
- rename : 'supervise-daemon',
- install_dir : pamdir)
-endif
-
-if os == 'Linux'
- executable('openrc-init',
- ['openrc-init.c', rc_plugin_c, rc_wtmp_c, version_h],
- c_args : cc_selinux_flags,
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo, librc],
- dependencies: [dl_dep, selinux_dep],
- install: true,
- install_dir: sbindir)
-
- executable('openrc-shutdown',
- ['openrc-shutdown.c', 'broadcast.c', 'rc-sysvinit.c', rc_misc_c,
- usage_c, rc_wtmp_c, version_h],
- c_args : cc_branding_flags,
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo, librc],
- install: true,
- install_dir: sbindir)
-endif
-
-einfo_execs = [
- 'einfon',
- 'einfo',
- 'ewarnn',
- 'ewarn',
- 'eerrorn',
- 'eerror',
- 'ebegin',
- 'eend',
- 'ewend',
- 'eindent',
- 'eoutdent',
- 'esyslog',
- 'eval_ecolors',
- 'ewaitfile',
- 'veinfo',
- 'vewarn',
- 'vebegin',
- 'veend',
- 'vewend',
- 'veindent',
- 'veoutdent',
- ]
-
-foreach exec: einfo_execs
- executable(exec,
- ['do_e.c', rc_misc_c, version_h],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo, librc],
- install: true,
- install_dir: rc_bindir)
-endforeach
-
-executable('checkpath',
- ['checkpath.c', rc_misc_c, usage_c, rc_selinux_c,
- version_h],
- c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo, librc],
- dependencies: [audit_dep, pam_dep, pam_misc_dep, selinux_dep, crypt_dep],
- install: true,
- install_dir: rc_bindir)
-
-executable('fstabinfo',
- ['fstabinfo.c', rc_misc_c, usage_c, version_h],
- c_args : cc_branding_flags,
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo, librc],
- install: true,
- install_dir: rc_bindir)
-
-executable('mountinfo',
- ['mountinfo.c', rc_misc_c, usage_c, version_h],
- c_args : cc_branding_flags,
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo, librc],
- install: true,
- install_dir: rc_bindir)
-
-executable('rc-depend',
- ['rc-depend.c', rc_misc_c, usage_c, version_h],
- c_args : cc_branding_flags,
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo, librc],
- install: true,
- install_dir: rc_bindir)
-
-executable('is_newer_than',
- ['is_newer_than.c', rc_misc_c, version_h],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo, librc],
- install: true,
- install_dir: rc_bindir)
-
-executable('is_older_than',
- ['is_older_than.c', rc_misc_c, version_h],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo, librc],
- install: true,
- install_dir: rc_bindir)
-
-service_execs = [
- 'service_starting',
- 'service_started',
- 'service_stopping',
- 'service_stopped',
- 'service_inactive',
- 'service_wasinactive',
- 'service_hotplugged',
- 'service_started_daemon',
- 'service_crashed',
- ]
-
-foreach exec : service_execs
- executable(exec,
- ['do_service.c', rc_misc_c, version_h],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo, librc],
- install: true,
- install_dir: rc_bindir)
-endforeach
-
-value_execs = [
- 'service_get_value',
- 'service_set_value',
- 'get_options',
- 'save_options',
- ]
-
-foreach exec : value_execs
- executable(exec,
- ['do_value.c', rc_misc_c, version_h],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo, librc],
- install: true,
- install_dir: rc_bindir)
-endforeach
-
-if os == 'Linux'
- executable('kill_all',
- ['kill_all.c', usage_c, version_h],
- c_args : cc_branding_flags,
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo,librc],
- install: true,
- install_dir: rc_bindir)
-
- executable('seedrng',
- ['seedrng.c', usage_c, version_h],
- c_args : cc_branding_flags,
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo, librc],
- install: true,
- install_dir: rc_sbindir)
-endif
-
-executable('shell_var',
- ['shell_var.c'],
- install: true,
- install_dir: rc_bindir)
-
-mark_service_execs = [
- 'mark_service_starting',
- 'mark_service_started',
- 'mark_service_stopping',
- 'mark_service_stopped',
- 'mark_service_inactive',
- 'mark_service_wasinactive',
- 'mark_service_hotplugged',
- 'mark_service_failed',
- 'mark_service_crashed',
- ]
-
-foreach exec : mark_service_execs
- executable(exec,
- ['do_mark_service.c', rc_misc_c, version_h],
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo,librc],
- install: true,
- install_dir: rc_sbindir)
-endforeach
-
-executable('rc-abort',
- 'rc-abort.c',
- include_directories: [einfo_incdir],
- link_with: [libeinfo],
- install: true,
- install_dir: rc_sbindir)
-
-executable('swclock',
- ['swclock.c', rc_misc_c, usage_c, version_h],
- c_args : cc_branding_flags,
- include_directories: [incdir, einfo_incdir, rc_incdir],
- link_with: [libeinfo,librc],
- install: true,
- install_dir: rc_sbindir)
diff --git a/src/reboot/meson.build b/src/reboot/meson.build
new file mode 100644
index 00000000..a9a4ca54
--- /dev/null
+++ b/src/reboot/meson.build
@@ -0,0 +1,7 @@
+if os == 'Linux' and get_option('sysvinit')
+ configure_file(input : 'reboot.in',
+ output : '@BASENAME@',
+ configuration : script_conf_data,
+ install_dir: sbindir,
+ install_mode: 'rwxr-xr-x')
+endif
diff --git a/src/reboot/reboot.in b/src/reboot/reboot.in
new file mode 100644
index 00000000..bf50967a
--- /dev/null
+++ b/src/reboot/reboot.in
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+option_arg=
+poweroff_arg=
+while getopts :nwdfhik opt; do
+ case "$opt" in
+ n) ;;
+ w) poweroff_arg=--write-only ;;
+ d) option_arg=--no-write ;;
+ f) ;;
+ h) ;;
+ i) ;;
+ k) poweroff_arg=--kexec ;;
+ [?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
+ exit 1
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+if [ -z "${poweroff_arg}" ]; then
+ poweroff_arg=--reboot
+fi
+
+script_args="$@"
+if [ -z "${script_args}" ]; then
+ script_args=now
+fi
+
+exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "${script_args}"
diff --git a/src/seedrng/meson.build b/src/seedrng/meson.build
new file mode 100644
index 00000000..827c3506
--- /dev/null
+++ b/src/seedrng/meson.build
@@ -0,0 +1,9 @@
+if os == 'Linux'
+ executable('seedrng',
+ ['seedrng.c', usage_c, version_h],
+ c_args : cc_branding_flags,
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo, librc],
+ install: true,
+ install_dir: rc_sbindir)
+endif
diff --git a/src/rc/seedrng.c b/src/seedrng/seedrng.c
index 95fb947d..95fb947d 100644
--- a/src/rc/seedrng.c
+++ b/src/seedrng/seedrng.c
diff --git a/src/service/meson.build b/src/service/meson.build
new file mode 100644
index 00000000..b3a86f6d
--- /dev/null
+++ b/src/service/meson.build
@@ -0,0 +1,20 @@
+service_execs = [
+ 'service_starting',
+ 'service_started',
+ 'service_stopping',
+ 'service_stopped',
+ 'service_inactive',
+ 'service_wasinactive',
+ 'service_hotplugged',
+ 'service_started_daemon',
+ 'service_crashed',
+ ]
+
+foreach exec : service_execs
+ executable(exec,
+ ['service.c', misc_c, version_h],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo, librc],
+ install: true,
+ install_dir: rc_bindir)
+endforeach
diff --git a/src/rc/do_service.c b/src/service/service.c
index eca498a6..001d3ad3 100644
--- a/src/rc/do_service.c
+++ b/src/service/service.c
@@ -27,7 +27,7 @@
#include "einfo.h"
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
const char *applet = NULL;
diff --git a/src/rc/_usage.c b/src/shared/_usage.c
index ed4c63e0..bba03b92 100644
--- a/src/rc/_usage.c
+++ b/src/shared/_usage.c
@@ -14,7 +14,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
#include "_usage.h"
#include "version.h"
diff --git a/src/rc/_usage.h b/src/shared/_usage.h
index 62c131d4..62c131d4 100644
--- a/src/rc/_usage.h
+++ b/src/shared/_usage.h
diff --git a/src/includes/helpers.h b/src/shared/helpers.h
index 44d76552..44d76552 100644
--- a/src/includes/helpers.h
+++ b/src/shared/helpers.h
diff --git a/src/shared/meson.build b/src/shared/meson.build
new file mode 100644
index 00000000..b80b242e
--- /dev/null
+++ b/src/shared/meson.build
@@ -0,0 +1,35 @@
+misc_c = files([
+ 'misc.c',
+ ])
+
+plugin_c = files([
+ 'plugin.c',
+ ])
+
+schedules_c = files([
+ 'schedules.c',
+ ])
+
+if selinux_dep.found()
+ selinux_c = files([
+ 'selinux.c',
+ ])
+else
+ selinux_c = []
+endif
+
+wtmp_c = files([
+ 'wtmp.c',
+ ])
+
+usage_c = files([
+ '_usage.c',
+ ])
+
+version_h = vcs_tag(
+ input : 'version.h.in',
+ output : 'version.h')
+
+version_f = vcs_tag(
+ input : 'version.in',
+ output : 'version')
diff --git a/src/rc/rc-misc.c b/src/shared/misc.c
index 1ca51e72..d8e4d5e6 100644
--- a/src/rc/rc-misc.c
+++ b/src/shared/misc.c
@@ -1,6 +1,6 @@
/*
- * rc-misc.c
- * rc misc functions
+ * misc.c
+ * misc functions
*/
/*
@@ -38,7 +38,7 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
#include "version.h"
extern char **environ;
diff --git a/src/includes/rc-misc.h b/src/shared/misc.h
index 8e37608f..6821038d 100644
--- a/src/includes/rc-misc.h
+++ b/src/shared/misc.h
@@ -1,5 +1,5 @@
/*
- * rc-misc.h
+ * misc.h
* This is private to us and not for user consumption
*/
diff --git a/src/rc/rc-plugin.c b/src/shared/plugin.c
index 76995866..cce845fa 100644
--- a/src/rc/rc-plugin.c
+++ b/src/shared/plugin.c
@@ -1,5 +1,5 @@
/*
- * rc-plugin.c
+ * plugin.c
* Simple plugin handler
*/
@@ -32,8 +32,8 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "rc-misc.h"
-#include "rc-plugin.h"
+#include "misc.h"
+#include "plugin.h"
#define RC_PLUGIN_HOOK "rc_plugin_hook"
diff --git a/src/rc/rc-plugin.h b/src/shared/plugin.h
index 8422adec..db4b6878 100644
--- a/src/rc/rc-plugin.h
+++ b/src/shared/plugin.h
@@ -1,5 +1,5 @@
/*
- * rc-plugin.h
+ * plugin.h
* Private instructions to use plugins
*/
diff --git a/src/includes/queue.h b/src/shared/queue.h
index 67f801d7..67f801d7 100644
--- a/src/includes/queue.h
+++ b/src/shared/queue.h
diff --git a/src/rc/rc-schedules.c b/src/shared/schedules.c
index 5938086d..b1eb85ad 100644
--- a/src/rc/rc-schedules.c
+++ b/src/shared/schedules.c
@@ -39,8 +39,8 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "rc-misc.h"
-#include "rc-schedules.h"
+#include "misc.h"
+#include "schedules.h"
#include "helpers.h"
typedef struct scheduleitem {
diff --git a/src/rc/rc-schedules.h b/src/shared/schedules.h
index 5fb9e526..5fb9e526 100644
--- a/src/rc/rc-schedules.h
+++ b/src/shared/schedules.h
diff --git a/src/rc/rc-selinux.c b/src/shared/selinux.c
index 8364a5f0..213a00f1 100644
--- a/src/rc/rc-selinux.c
+++ b/src/shared/selinux.c
@@ -1,5 +1,5 @@
/*
- * rc-selinux.c
+ * selinux.c
* SELinux helpers to get and set contexts.
*/
@@ -34,9 +34,9 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "rc-misc.h"
-#include "rc-plugin.h"
-#include "rc-selinux.h"
+#include "misc.h"
+#include "plugin.h"
+#include "selinux.h"
/* the context files for selinux */
#define INITRC_FILE "initrc_context"
diff --git a/src/rc/rc-selinux.h b/src/shared/selinux.h
index 627c87bc..627c87bc 100644
--- a/src/rc/rc-selinux.h
+++ b/src/shared/selinux.h
diff --git a/src/common/version.h.in b/src/shared/version.h.in
index 4f228f55..4f228f55 100644
--- a/src/common/version.h.in
+++ b/src/shared/version.h.in
diff --git a/src/common/version.in b/src/shared/version.in
index 42179405..42179405 100644
--- a/src/common/version.in
+++ b/src/shared/version.in
diff --git a/src/rc/rc-wtmp.c b/src/shared/wtmp.c
index 42e228d0..5881aeba 100644
--- a/src/rc/rc-wtmp.c
+++ b/src/shared/wtmp.c
@@ -1,5 +1,5 @@
/*
- * rc-wtmp.c
+ * wtmp.c
* This file contains routines to deal with the wtmp file.
*/
@@ -24,7 +24,7 @@
#include <sys/types.h>
#include <sys/utsname.h>
-#include "rc-wtmp.h"
+#include "wtmp.h"
void log_wtmp(const char *user, const char *id, pid_t pid, int type,
const char *line)
diff --git a/src/includes/rc-wtmp.h b/src/shared/wtmp.h
index edab322c..edab322c 100644
--- a/src/includes/rc-wtmp.h
+++ b/src/shared/wtmp.h
diff --git a/src/shell_var/meson.build b/src/shell_var/meson.build
new file mode 100644
index 00000000..33fc5c2a
--- /dev/null
+++ b/src/shell_var/meson.build
@@ -0,0 +1,4 @@
+executable('shell_var',
+ ['shell_var.c'],
+ install: true,
+ install_dir: rc_bindir)
diff --git a/src/rc/shell_var.c b/src/shell_var/shell_var.c
index 70750245..70750245 100644
--- a/src/rc/shell_var.c
+++ b/src/shell_var/shell_var.c
diff --git a/src/shutdown/meson.build b/src/shutdown/meson.build
new file mode 100644
index 00000000..2d6f726d
--- /dev/null
+++ b/src/shutdown/meson.build
@@ -0,0 +1,7 @@
+if os == 'Linux' and get_option('sysvinit')
+ configure_file(input : 'shutdown.in',
+ output : '@BASENAME@',
+ configuration : script_conf_data,
+ install_dir: sbindir,
+ install_mode: 'rwxr-xr-x')
+endif
diff --git a/src/shutdown/shutdown.in b/src/shutdown/shutdown.in
new file mode 100644
index 00000000..23e5e31d
--- /dev/null
+++ b/src/shutdown/shutdown.in
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+do_halt=false
+while getopts :akrhPHfFnct: opt; do
+ case "$opt" in
+ a) ;;
+ k) ;;
+ r)
+ shutdown_arg=--reboot
+ ;;
+ h)
+ do_halt=true
+ shutdown_arg=--poweroff
+ ;;
+ P)
+ if ! ${do_halt}; then
+ printf "%s\n" "The -P flag requires the -h flag" >&2
+ exit 1
+ fi
+ shutdown_arg=--poweroff
+ ;;
+ H)
+ if ! ${do_halt}; then
+ printf "%s\n" "The -H flag requires the -h flag" >&2
+ exit 1
+ fi
+ shutdown_arg=--halt
+ ;;
+ f) ;;
+ F) ;;
+ n) ;;
+ c) ;;
+ t) ;;
+ [?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
+ exit 1
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+if [ -z "${shutdown_arg}" ]; then
+ shutdown_arg=--single
+fi
+
+printf "%s %s\n" "@SBINDIR@/openrc-shutdown ${shutdown_arg}" "$@"
+exec @SBINDIR@/openrc-shutdown ${shutdown_arg} "$@"
diff --git a/src/start-stop-daemon/meson.build b/src/start-stop-daemon/meson.build
new file mode 100644
index 00000000..39229132
--- /dev/null
+++ b/src/start-stop-daemon/meson.build
@@ -0,0 +1,15 @@
+executable('start-stop-daemon',
+ ['start-stop-daemon.c', 'rc-pipes.c', misc_c, schedules_c,
+ selinux_c, usage_c, version_h],
+ c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_cap_flags, cc_selinux_flags],
+ link_with: [libeinfo, librc],
+ dependencies: [audit_dep, dl_dep, pam_dep, cap_dep, pam_misc_dep, util_dep, selinux_dep, crypt_dep],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ install: true,
+ install_dir: sbindir)
+
+if get_option('pam')
+ install_data('start-stop-daemon.pam',
+ rename : 'start-stop-daemon',
+ install_dir : pamdir)
+endif
diff --git a/src/rc/rc-pipes.c b/src/start-stop-daemon/rc-pipes.c
index b4e60e03..b4e60e03 100644
--- a/src/rc/rc-pipes.c
+++ b/src/start-stop-daemon/rc-pipes.c
diff --git a/src/rc/rc-pipes.h b/src/start-stop-daemon/rc-pipes.h
index 861963b7..861963b7 100644
--- a/src/rc/rc-pipes.h
+++ b/src/start-stop-daemon/rc-pipes.h
diff --git a/src/rc/start-stop-daemon.c b/src/start-stop-daemon/start-stop-daemon.c
index db97f3b3..75b9a15c 100644
--- a/src/rc/start-stop-daemon.c
+++ b/src/start-stop-daemon/start-stop-daemon.c
@@ -70,9 +70,9 @@ static struct pam_conv conv = { NULL, NULL};
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
#include "rc-pipes.h"
-#include "rc-schedules.h"
+#include "schedules.h"
#include "_usage.h"
#include "helpers.h"
diff --git a/src/rc/start-stop-daemon.pam b/src/start-stop-daemon/start-stop-daemon.pam
index a1bada22..a1bada22 100644
--- a/src/rc/start-stop-daemon.pam
+++ b/src/start-stop-daemon/start-stop-daemon.pam
diff --git a/src/supervise-daemon/meson.build b/src/supervise-daemon/meson.build
new file mode 100644
index 00000000..808114f0
--- /dev/null
+++ b/src/supervise-daemon/meson.build
@@ -0,0 +1,14 @@
+executable('supervise-daemon',
+ ['supervise-daemon.c', misc_c, plugin_c, schedules_c, usage_c, version_h],
+ c_args : [cc_branding_flags, cc_pam_flags, cc_cap_flags, cc_selinux_flags],
+ link_with: [libeinfo, librc],
+ dependencies: [dl_dep, pam_dep, cap_dep, util_dep, selinux_dep],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ install: true,
+ install_dir: sbindir)
+
+if get_option('pam')
+ install_data('supervise-daemon.pam',
+ rename : 'supervise-daemon',
+ install_dir : pamdir)
+endif
diff --git a/src/rc/supervise-daemon.c b/src/supervise-daemon/supervise-daemon.c
index 93deedcd..194ef9df 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/supervise-daemon/supervise-daemon.c
@@ -65,9 +65,9 @@ static struct pam_conv conv = { NULL, NULL};
#include "einfo.h"
#include "queue.h"
#include "rc.h"
-#include "rc-misc.h"
-#include "rc-plugin.h"
-#include "rc-schedules.h"
+#include "misc.h"
+#include "plugin.h"
+#include "schedules.h"
#include "_usage.h"
#include "helpers.h"
diff --git a/src/rc/supervise-daemon.pam b/src/supervise-daemon/supervise-daemon.pam
index a1bada22..a1bada22 100644
--- a/src/rc/supervise-daemon.pam
+++ b/src/supervise-daemon/supervise-daemon.pam
diff --git a/src/swclock/meson.build b/src/swclock/meson.build
new file mode 100644
index 00000000..1a85f115
--- /dev/null
+++ b/src/swclock/meson.build
@@ -0,0 +1,7 @@
+executable('swclock',
+ ['swclock.c', misc_c, usage_c, version_h],
+ c_args : cc_branding_flags,
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo,librc],
+ install: true,
+ install_dir: rc_sbindir)
diff --git a/src/rc/swclock.c b/src/swclock/swclock.c
index 7f63d680..5fc5d395 100644
--- a/src/rc/swclock.c
+++ b/src/swclock/swclock.c
@@ -31,7 +31,7 @@
#include "einfo.h"
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
#include "_usage.h"
#define RC_SHUTDOWNTIME RC_SVCDIR "/shutdowntime"
diff --git a/src/value/meson.build b/src/value/meson.build
new file mode 100644
index 00000000..da958f01
--- /dev/null
+++ b/src/value/meson.build
@@ -0,0 +1,15 @@
+value_execs = [
+ 'service_get_value',
+ 'service_set_value',
+ 'get_options',
+ 'save_options',
+ ]
+
+foreach exec : value_execs
+ executable(exec,
+ ['value.c', misc_c, version_h],
+ include_directories: [incdir, einfo_incdir, rc_incdir],
+ link_with: [libeinfo, librc],
+ install: true,
+ install_dir: rc_bindir)
+endforeach
diff --git a/src/rc/do_value.c b/src/value/value.c
index 9ec5facf..f7089de4 100644
--- a/src/rc/do_value.c
+++ b/src/value/value.c
@@ -29,7 +29,7 @@
#include "einfo.h"
#include "rc.h"
-#include "rc-misc.h"
+#include "misc.h"
const char *applet = NULL;