Add convenient SysV init /etc/rc.local compat

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2016-07-15 13:17:09 +02:00
parent 8f9ea0ae57
commit 48e2cbd183
3 changed files with 31 additions and 0 deletions
+10
View File
@@ -86,6 +86,10 @@ AC_ARG_WITH(rcsd,
[rcsd=$withval], [rcsd='$(sysconfdir)/finit.d'])
AC_SUBST(rcsd)
AC_ARG_WITH(rc-local,
AS_HELP_STRING([--with-rc-local=FILE], [SysV init /etc/rc.local file, default /etc/rc.local]),
[rclocal=$withval], [rclocal=$sysconfdir/rc.local])
AC_ARG_WITH(console,
AS_HELP_STRING([--with-console=DEV], [Console to use, default: /dev/console]),
[console=$withval], [console=/dev/console])
@@ -154,6 +158,12 @@ AS_IF([test "x$with_config" != "xno"],[
conf='$(sysconfdir)/finit.conf'])
AC_SUBST(conf)
AS_IF([test "x$with_rc_local" != "xno"],[
AS_IF([test "x$rclocal" = "xyes"],[
rclocal=$sysconfdir/rc.local])])
AC_EXPAND_DIR(lurvig, "$rclocal")
AC_DEFINE_UNQUOTED(FINIT_RC_LOCAL, "$lurvig", [Compat SysV /etc/rc.local file to run last at boot.])
AS_IF([test "x$with_heading" != "xno"],[
AS_IF([test "x$heading" = "xyes"],[
AC_MSG_ERROR([Must supply argument])])
+4
View File
@@ -215,6 +215,10 @@ int main(int argc, char* argv[])
run_parts(runparts, NULL);
}
/* Convenient SysV compat for when you just don't care ... */
if (!access(FINIT_RC_LOCAL, X_OK))
run_interactive(FINIT_RC_LOCAL, "Calling SysV style rc.local: %s", FINIT_RC_LOCAL);
/* Hooks that should run at the very end */
plugin_run_hooks(HOOK_SYSTEM_UP);
+17
View File
@@ -0,0 +1,17 @@
# From https://github.com/kakaroto/e17/blob/master/BINDINGS/javascript/elixir/m4/ac_expand_dir.m4
# By Alexandre Oliva <oliva@dcc.unicamp.br>
# AC_EXPAND_DIR(VARNAME, DIR)
# ------------------------------------------------------------
# Expands occurrences of ${prefix} and ${exec_prefix} in the
# given DIR, and assigns the resulting string to VARNAME
#
# Example: AC_DEFINE_DIR(DATADIR, "$datadir")
AC_DEFUN([AC_EXPAND_DIR], [
$1=$2
$1=`(
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
eval echo \""[$]$1"\"
)`
])