diff --git a/configure.ac b/configure.ac index 84061bd6..7b1dfdec 100644 --- a/configure.ac +++ b/configure.ac @@ -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])]) diff --git a/finit.c b/finit.c index c5ca858f..535f1227 100644 --- a/finit.c +++ b/finit.c @@ -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); diff --git a/m4/expand.m4 b/m4/expand.m4 new file mode 100644 index 00000000..4186ded0 --- /dev/null +++ b/m4/expand.m4 @@ -0,0 +1,17 @@ +# From https://github.com/kakaroto/e17/blob/master/BINDINGS/javascript/elixir/m4/ac_expand_dir.m4 +# By Alexandre Oliva + +# 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"\" + )` +])