Refactor --with-sysconfig, default to /etc/default and /etc/conf.d

Both Debian and Builroot based systems use /etc/default and
Alpine Linux use /etc/conf.d, so let's just put both in by
default.  If the directories exist we monitor them.

The --with-syconfig configure option is now disabled by default.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-02-28 09:53:48 +01:00
parent 7e3b18a38d
commit 6862d7cd5f
5 changed files with 18 additions and 17 deletions
+7 -8
View File
@@ -110,8 +110,8 @@ AC_ARG_WITH(rc-local,
[rclocal=$withval], [rclocal=yes])
AC_ARG_WITH(sysconfig,
AS_HELP_STRING([--with-sysconfig=DIR], [Enviroment config directory, default /etc/default]),
[sysconfig=$withval], [sysconfig=yes])
AS_HELP_STRING([--with-sysconfig=DIR], [System environment, default /etc/default & /etc/conf.d]),
[sysconfig=$withval], [sysconfig=default])
AC_ARG_WITH(hostname,
AS_HELP_STRING([--with-hostname=NAME], [If /etc/hostname is missing, default: noname]),
@@ -170,11 +170,10 @@ AC_EXPAND_DIR(rclocal_path, "$rclocal")
AC_DEFINE_UNQUOTED(FINIT_RC_LOCAL, "$rclocal_path", [Compat SysV /etc/rc.local file to run last at boot.])
AS_IF([test "x$with_sysconfig" != "xno"], [
AS_IF([test "x$sysconfig" = "xyes"], [
sysconfig=$sysconfdir/default])
AC_EXPAND_DIR(sysconfig_path, "$sysconfig")
AC_DEFINE_UNQUOTED(FINIT_SYSCONFIG, "$sysconfig_path",
[System environment, default /etc/default])])
AS_IF([test "x$sysconfig" != "xdefault"], [
AC_EXPAND_DIR(sysconfig_path, "$sysconfig")
AC_DEFINE_UNQUOTED(FINIT_SYSCONFIG, "$sysconfig_path",
[System environment, default /etc/default & /etc/conf.d])])])
AS_IF([test "x$with_heading" != "xno"], [
AS_IF([test "x$heading" = "xyes"], [
@@ -233,7 +232,7 @@ cat <<EOF
Finit config.d path...: $rcsd_path
Finit plugin path.....: $plugin_path
Compat rc.local path..: $rclocal_path
System environment....: $sysconfig_path
System environment....: ${sysconfig_path:-${sysconfig}}
Random seed path......: $random_path
C Compiler............: $CC $CFLAGS $CPPFLAGS $LDFLAGS $LIBS
Linker................: $LD $LLDP_LDFLAGS $LLDP_BIN_LDFLAGS $LDFLAGS $LIBS
-1
View File
@@ -18,7 +18,6 @@ PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig ./configure \
--sysconfdir=/etc --localstatedir=/var \
--enable-dbus-plugin --enable-x11-common-plugin \
--enable-alsa-utils-plugin --enable-watchdog \
--with-sysconfig=/etc/conf.d --with-hostname=alpine \
--with-heading="Alpine Linux 3.13"
echo
+1 -1
View File
@@ -27,7 +27,7 @@ echo
--enable-dbus-plugin --enable-x11-common-plugin \
--enable-alsa-utils-plugin \
--with-random-seed=/var/lib/urandom/random-seed \
--with-heading="Debian GNU/Linux" --with-hostname="stretch"
--with-heading="Debian GNU/Linux"
if [ $? -ne 0 ]; then
echo
+5 -5
View File
@@ -14,11 +14,11 @@ fi
# The plugins are optional, but you may need D-Bus and X11 if you want
# to run X-Window, the other configure flags are however required.
PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig ./configure \
--prefix=/usr --exec-prefix= \
--sysconfdir=/etc --localstatedir=/var \
--enable-dbus-plugin --enable-x11-common-plugin \
--enable-alsa-utils-plugin \
--with-heading="Void Linux" --with-hostname=void
--prefix=/usr --exec-prefix= \
--sysconfdir=/etc --localstatedir=/var \
--enable-dbus-plugin --enable-x11-common-plugin \
--enable-alsa-utils-plugin --enable-watchdog \
--with-heading="Void Linux"
echo
echo "*** Building ..."
+5 -2
View File
@@ -855,9 +855,12 @@ int conf_monitor(void)
rc += iwatch_add(&iw_conf, FINIT_CONF, 0);
/*
* Systems with /etc/default, or similar, can also monitor changes
* in env files sourced by .conf files (above)
* Systems with /etc/default, /etc/conf.d, or similar, can also
* monitor changes in env files sourced by .conf files (above)
* define your own with --with-sysconfig=/path/to/envfiles
*/
rc += iwatch_add(&iw_conf, "/etc/default/", IN_ONLYDIR);
rc += iwatch_add(&iw_conf, "/etc/conf.d/", IN_ONLYDIR);
#ifdef FINIT_SYSCONFIG
rc += iwatch_add(&iw_conf, FINIT_SYSCONFIG, IN_ONLYDIR);
#endif