Refactor: Move HAVE_DBUS and CONSOLE to configure script.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2015-06-22 15:12:20 +02:00
1 parent 36c59e77b4
commit 70af5d7f8d
3 files changed
+174 -152

No files matched your search

Vendored
+171 -149
View File
@@ -13,46 +13,49 @@
# Setup defaults if undefined # Setup defaults if undefined
defaults() defaults()
{ {
heading=${heading:='"Finit v" VERSION'} heading=${heading:='"Finit v" VERSION'}
prefix=${prefix:="/usr"} prefix=${prefix:="/usr"}
sysconfdir=${sysconfdir:="/etc"} sysconfdir=${sysconfdir:="/etc"}
sbindir=${sbindir:="/sbin"} sbindir=${sbindir:="/sbin"}
libdir=${libdir:="/lib"} libdir=${libdir:="/lib"}
pdir="finit/plugins" pdir="finit/plugins"
plugindir=${plugindir:="$libdir/$pdir"} plugindir=${plugindir:="$libdir/$pdir"}
# The initctl FIFO, should probably be in /run, not /dev # The initctl FIFO, should probably be in /run, not /dev
fifo=${fifo:="/dev/initctl"} fifo=${fifo:="/dev/initctl"}
conf="finit.conf" conf="finit.conf"
config=${config:="$sysconfdir/$conf"} config=${config:="$sysconfdir/$conf"}
confdir=${confdir:="finit.d"} confdir=${confdir:="finit.d"}
rcsd=${rcsd:="$sysconfdir/$confdir"} rcsd=${rcsd:="$sysconfdir/$confdir"}
console=${console:='_PATH_CONSOLE'}
defuser=${defuser:="root"} defuser=${defuser:="root"}
defhost=${defhost:="noname"} defhost=${defhost:="noname"}
runlevel=${runlevel:=2} runlevel=${runlevel:=2}
debug=${debug:=0} debug=${debug:=0}
embedded=${embedded:=0} embedded=${embedded:=0}
remount=${remount:=0} dbus=${dbus:=0}
inetd=${inetd:=1} remount=${remount:=0}
verbose=${verbose:=1} inetd=${inetd:=1}
kernel_quiet=${kernel_quiet:=1} verbose=${verbose:=1}
static=${static:=0} kernel_quiet=${kernel_quiet:=1}
disable_plugins=${disable_plugins:=0} static=${static:=0}
disable_plugins=${disable_plugins:=0}
} }
result() result()
{ {
echo echo
echo "Finit configuration" echo "Finit configuration"
echo "========================================================================" echo "========================================================================"
echo "Heading : $heading" echo "Heading : $heading"
echo "Install prefix : $prefix" echo "Install prefix : $prefix"
echo "System config dir : $sysconfdir" echo "System config dir : $sysconfdir"
echo "Super user bindir : $sbindir" echo "Super user bindir : $sbindir"
echo "Shared libs dir : $libdir" echo "Shared libs dir : $libdir"
echo "Plugins dir : $plugindir" echo "Plugins dir : $plugindir"
echo "FIFO : $fifo" echo "FIFO : $fifo"
echo "Config file : $config" echo "Config file : $config"
echo "rcs.d/ directory : $rcsd" echo "rcs.d/ directory : $rcsd"
echo "Default console : $console"
if [ x"$sysroot" != x"" ]; then if [ x"$sysroot" != x"" ]; then
echo "Swap rootfs to : $sysroot" echo "Swap rootfs to : $sysroot"
fi fi
@@ -60,101 +63,108 @@ result()
echo "Default hostname : $defhost" echo "Default hostname : $defhost"
echo "Default runlevel : $runlevel" echo "Default runlevel : $runlevel"
if [ $debug -ne 0 ]; then if [ $debug -ne 0 ]; then
echo "Debug : ENABLED" echo "Debug : ENABLED"
fi fi
if [ $embedded -ne 0 ]; then if [ $embedded -ne 0 ]; then
echo "Embedded target : YES (BusyBox getty, and mdev instead of udev)" echo "Embedded target : YES (BusyBox getty, and mdev instead of udev)"
fi fi
if [ $dbus -ne 0 ]; then
echo "D-Bus : YES, remember to install dbus.so plugin as well!"
fi
if [ $remount -ne 0 ]; then if [ $remount -ne 0 ]; then
echo "Remount ROOT fs : YES, / will be remounted as read-write at bootstrap" echo "Remount ROOT fs : YES, / will be remounted as read-write at bootstrap"
fi fi
if [ x"$random" != x"" ]; then if [ x"$random" != x"" ]; then
echo "Random seed : $random" echo "Random seed : $random"
fi fi
if [ $inetd -ne 0 ]; then if [ $inetd -ne 0 ]; then
echo "Inetd : Built-in" echo "Inetd : Built-in"
else
echo "Inetd : DISABLED"
fi
if [ $verbose -ne 1 ]; then
echo "Quiet Finit : YES"
else else
echo "Quiet Finit : NO, verbose output (default)" echo "Inetd : DISABLED"
fi fi
if [ $kernel_quiet -eq 1 ]; then if [ $verbose -ne 1 ]; then
echo "Kernel Quiet : YES, silent after inital boot (default)" echo "Quiet Finit : YES"
else else
echo "Kernel Quiet : NO" echo "Quiet Finit : NO, verbose output (default)"
fi fi
if [ $static -ne 0 ]; then if [ $kernel_quiet -eq 1 ]; then
echo "Static Finit : YES" echo "Kernel Quiet : YES, silent after inital boot (default)"
fi else
echo "Kernel Quiet : NO"
fi
if [ $disable_plugins -eq 1 ]; then if [ $static -ne 0 ]; then
echo "Plugins : DISABLED" echo "Static Finit : YES"
else fi
if [ x"$plugins" = x"" ]; then
echo "Plugins : ALL" if [ $disable_plugins -eq 1 ]; then
else echo "Plugins : DISABLED"
echo "Plugins : $plugins" else
fi if [ x"$plugins" = x"" ]; then
fi echo "Plugins : ALL"
echo else
echo "Plugins : $plugins"
fi
fi
echo
} }
usage() usage()
{ {
defaults defaults
echo "Run this script to configure finit for your operating system." echo "Run this script to configure finit for your operating system."
echo echo
echo "Usage: $0 [ARG]" echo "Usage: $0 [ARG]"
echo
echo " --prefix=PREFIX Set installation prefix, default '$prefix'"
echo " --sysconfdir=CONF Set conf dir, default '$sysconfdir'"
echo " --sbindir=SBIN Set sbin dir, default '$sbindir'"
echo " --libdir=LIB Set lib dir, default '$libdir'"
echo " --plugindir=DIR Set plugin dir, default '\$libdir/$pdir'"
echo echo
echo " --with-fifo=FIFO FIFO for initctl plugin, default '$fifo'" echo " --help This help text"
echo " --with-config=CONFIG Finit CONFIG file, default '\$sysconfdir/$conf'" echo " --prefix=PREFIX Set installation prefix, default '$prefix'"
echo " --with-heading=GREET Display GREET instead of Finit version at boot" echo " --sysconfdir=CONF Set conf dir, default '$sysconfdir'"
echo " --with-randomseed=SEED Seed /dev/urandom from file SEED. On Debian/Ubuntu" echo " --sbindir=SBIN Set sbin dir, default '$sbindir'"
echo " systems, set this to /var/lib/urandom/random-seed" echo " --libdir=LIB Set lib dir, default '$libdir'"
echo " Default: none" echo " --plugindir=DIR Set plugin dir, default '\$libdir/$pdir'"
echo
echo " --with-fifo=FIFO FIFO for initctl plugin, default '$fifo'"
echo " --with-config=CONFIG Finit CONFIG file, default '\$sysconfdir/$conf'"
echo " --with-heading=GREET Display GREET instead of Finit version at boot"
echo " --with-randomseed=SEED Seed /dev/urandom from file SEED. On Debian/Ubuntu"
echo " systems, set this to /var/lib/urandom/random-seed"
echo " Default: none"
echo " --with-plugins=\"a b c\" Build plugins 'a', 'b' and 'c', either as dynamic .so" echo " --with-plugins=\"a b c\" Build plugins 'a', 'b' and 'c', either as dynamic .so"
echo " files, or as built-in if --enable-static is given," echo " files, or as built-in if --enable-static is given,"
echo " defaults to all plugins. Exclude extension!" echo " defaults to all plugins. Exclude extension!"
echo " --with-rcsd=RCSD Finit RCSD directory, default '\$sysconfdir/$confdir'" echo " --with-rcsd=RCSD Finit RCSD directory, default '\$sysconfdir/$confdir'"
echo " --with-console=DEV Console to use, default: /dev/console"
echo " --with-sysroot=PATH Some distributions keep a different (writable) rootfs" echo " --with-sysroot=PATH Some distributions keep a different (writable) rootfs"
echo " that is used at runtime, usually /sysroot or /mnt" echo " that is used at runtime, usually /sysroot or /mnt"
echo " --with-username=USER User for 'startx' .conf option, default: root" echo " --with-username=USER User for 'startx' .conf option, default: root"
echo " --with-hostname=NAME Hostname, if /etc/hostname is missing, default: noname" echo " --with-hostname=NAME Hostname, if /etc/hostname is missing, default: noname"
echo " --with-runlevel=LEVEL Runlevel to switch to after bootstrap (S), default: 2" echo " --with-runlevel=LEVEL Runlevel to switch to after bootstrap (S), default: 2"
echo echo
echo " --enable-embedded Embedded defaults, BusBox getty, mdev etc." echo " --enable-embedded Embedded defaults, BusBox getty, mdev etc."
echo " --enable-dbus Enable D-Bus plugin. Note: install plugin as well!"
echo " --enable-rw-rootfs Remount / as read-write at bootstrap, not for embedded" echo " --enable-rw-rootfs Remount / as read-write at bootstrap, not for embedded"
echo " --enable-debug Enable debug flags, '-O0, -g'" echo " --enable-debug Enable debug flags, '-O0, -g'"
echo " --enable-quiet Quiet mode, reduce screen output to absolute minimum" echo " --enable-quiet Quiet mode, reduce screen output to absolute minimum"
echo " --enable-static Link statically. This disables a few features." echo " --enable-static Link statically. This disables a few features."
echo " --disable-inetd Disable inetd support if not needed." echo " --disable-inetd Disable inetd support if not needed."
echo " --disable-kernel-quiet Disable kernel cmdline quiet, default enabled." echo " --disable-kernel-quiet Disable kernel cmdline quiet, default enabled."
echo " --disable-plugins Disable plugins" echo " --disable-plugins Disable plugins"
echo
echo "The build system also supports external CFLAGS, CPPFLAGS, LDFLAGS, LDLIBS,"
echo "and DESTDIR, useful for packaging or cross-compiling."
echo echo
echo "The build system also supports external CFLAGS, CPPFLAGS, LDFLAGS, LDLIBS,"
echo "and DESTDIR, useful for packaging or cross-compiling."
echo
echo "Example:" echo "Example:"
echo " ./configure --enable-embedded --with-plugins=\"initctl tty\"" echo " ./configure --enable-embedded --with-plugins=\"initctl tty\""
echo echo
echo "Report bugs to https://github.com/troglobit/finit/issues" echo "Report bugs to https://github.com/troglobit/finit/issues"
echo echo
@@ -170,24 +180,24 @@ while [ "$*" != "" ]; do
shift shift
case $opt in case $opt in
prefix) prefix)
prefix="$arg" prefix="$arg"
;; ;;
sysconfdir) sysconfdir)
sysconfdir="$arg" sysconfdir="$arg"
;; ;;
sbindir) sbindir)
sbindir="$arg" sbindir="$arg"
;; ;;
libdir) libdir)
libdir="$arg" libdir="$arg"
;; ;;
plugindir) plugindir)
plugindir="$arg" plugindir="$arg"
;; ;;
with-fifo) with-fifo)
@@ -198,13 +208,13 @@ while [ "$*" != "" ]; do
config="$arg" config="$arg"
;; ;;
with-heading) with-heading)
heading="\"$arg\"" heading="\"$arg\""
;; ;;
with-randomseed) with-randomseed)
random="$arg" random="$arg"
;; ;;
with-plugins) with-plugins)
plugins="$arg" plugins="$arg"
@@ -214,6 +224,10 @@ while [ "$*" != "" ]; do
rcsd="$arg" rcsd="$arg"
;; ;;
with-console)
console="\"$arg\""
;;
with-sysroot) with-sysroot)
sysroot="$arg" sysroot="$arg"
;; ;;
@@ -231,11 +245,15 @@ while [ "$*" != "" ]; do
;; ;;
enable-debug) enable-debug)
debug=1 debug=1
;; ;;
enable-embedded) enable-embedded)
embedded=1 embedded=1
;;
enable-dbus)
dbus=1
;; ;;
enable-rw-rootfs) enable-rw-rootfs)
@@ -243,24 +261,24 @@ while [ "$*" != "" ]; do
;; ;;
enable-quiet) enable-quiet)
verbose=0 verbose=0
;; ;;
enable-static) enable-static)
static=1 static=1
;; ;;
disable-inetd) disable-inetd)
inetd=0 inetd=0
;; ;;
disable-kernel-quiet) disable-kernel-quiet)
kernel_quiet=0 kernel_quiet=0
;; ;;
disable-plugins) disable-plugins)
disable_plugins=1 disable_plugins=1
;; ;;
help) help)
usage usage
@@ -290,38 +308,38 @@ echo "mandir = \$(prefix)/share/man/man8" >> config.mk
echo "FINIT_RCSD = $rcsd" >> config.mk echo "FINIT_RCSD = $rcsd" >> config.mk
if [ $inetd -eq 0 ]; then if [ $inetd -eq 0 ]; then
echo >> config.mk echo >> config.mk
echo "OBJS := \$(filter-out inetd.o, \$(OBJS))" >> config.mk echo "OBJS := \$(filter-out inetd.o, \$(OBJS))" >> config.mk
fi fi
echo >> config.mk echo >> config.mk
if [ $debug -eq 1 ]; then if [ $debug -eq 1 ]; then
echo "CPPFLAGS += -O0 -g" >> config.mk echo "CPPFLAGS += -O0 -g" >> config.mk
else else
echo "CPPFLAGS += -Os" >> config.mk echo "CPPFLAGS += -Os" >> config.mk
fi fi
echo >> config.mk echo >> config.mk
if [ $static -ne 0 ]; then if [ $static -ne 0 ]; then
echo "STATIC = 1" >> config.mk echo "STATIC = 1" >> config.mk
echo "LDFLAGS += -static" >> config.mk echo "LDFLAGS += -static" >> config.mk
echo "CPPFLAGS += -DENABLE_STATIC" >> config.mk echo "CPPFLAGS += -DENABLE_STATIC" >> config.mk
echo "PLUGINS = \"\"" >> config.mk echo "PLUGINS = \"\"" >> config.mk
if [ $disable_plugins -ne 1 ]; then if [ $disable_plugins -ne 1 ]; then
if [ x"$plugins" != x"" ]; then if [ x"$plugins" != x"" ]; then
echo "OBJS += \$(addsuffix .o, \$(addprefix plugins/, $plugins))" >> config.mk echo "OBJS += \$(addsuffix .o, \$(addprefix plugins/, $plugins))" >> config.mk
else else
echo "tmp += \$(wildcard plugins/*.c)" >> config.mk echo "tmp += \$(wildcard plugins/*.c)" >> config.mk
echo "OBJS += \$(tmp:.c=.o)" >> config.mk echo "OBJS += \$(tmp:.c=.o)" >> config.mk
fi fi
fi fi
else else
echo "STATIC = 0" >> config.mk echo "STATIC = 0" >> config.mk
echo "LDFLAGS += -rdynamic" >> config.mk echo "LDFLAGS += -rdynamic" >> config.mk
echo "LDLIBS += -ldl" >> config.mk echo "LDLIBS += -ldl" >> config.mk
if [ x"$plugins" != x"" ]; then if [ x"$plugins" != x"" ]; then
echo "PLUGINS = \$(addsuffix .so, $plugins)" >> config.mk echo "PLUGINS = \$(addsuffix .so, $plugins)" >> config.mk
fi fi
fi fi
echo >> config.mk echo >> config.mk
@@ -334,24 +352,28 @@ echo "#define INIT_HEADING $heading" >> config.h
echo "#define VERBOSE_MODE $verbose" >> config.h echo "#define VERBOSE_MODE $verbose" >> config.h
echo "#define KERNEL_QUIET $kernel_quiet" >> config.h echo "#define KERNEL_QUIET $kernel_quiet" >> config.h
if [ $embedded -eq 1 ]; then if [ $embedded -eq 1 ]; then
echo "#define EMBEDDED_SYSTEM 1" >> config.h echo "#define EMBEDDED_SYSTEM 1" >> config.h
fi fi
if [ $remount -eq 1 ]; then if [ $remount -eq 1 ]; then
echo "#define REMOUNT_ROOTFS 1" >> config.h echo "#define REMOUNT_ROOTFS 1" >> config.h
fi
if [ $dbus -eq 1 ]; then
echo "#define HAVE_DBUS 1" >> config.h
fi fi
if [ $inetd -eq 0 ]; then if [ $inetd -eq 0 ]; then
echo "#define INETD_DISABLED" >> config.h echo "#define INETD_DISABLED" >> config.h
fi fi
echo "#define FINIT_FIFO \"$fifo\"" >> config.h echo "#define FINIT_FIFO \"$fifo\"" >> config.h
echo "#define FINIT_CONF \"$config\"" >> config.h echo "#define FINIT_CONF \"$config\"" >> config.h
echo "#define FINIT_RCSD \"$rcsd\"" >> config.h echo "#define FINIT_RCSD \"$rcsd\"" >> config.h
echo "#define CONSOLE $console" >> config.h
if [ x"$sysroot" != x"" ]; then if [ x"$sysroot" != x"" ]; then
echo "#define SYSROOT \"$sysroot\"" >> config.h echo "#define SYSROOT \"$sysroot\"" >> config.h
fi fi
echo "#define PLUGIN_PATH \"$plugindir\"" >> config.h echo "#define PLUGIN_PATH \"$plugindir\"" >> config.h
if [ x"$random" != x"" ]; then if [ x"$random" != x"" ]; then
echo "#define RANDOMSEED \"$random\"" >> config.h echo "#define RANDOMSEED \"$random\"" >> config.h
fi fi
echo "#define DEFUSER \"$defuser\"" >> config.h echo "#define DEFUSER \"$defuser\"" >> config.h
echo "#define DEFHOST \"$defhost\"" >> config.h echo "#define DEFHOST \"$defhost\"" >> config.h
-3
View File
@@ -38,18 +38,15 @@
/* Distribution specific configuration */ /* Distribution specific configuration */
#if defined EMBEDDED_SYSTEM #if defined EMBEDDED_SYSTEM
# define CONSOLE _PATH_CONSOLE
# define SETUP_DEVFS "/sbin/mdev -s" # define SETUP_DEVFS "/sbin/mdev -s"
# define GETTY "/sbin/getty -L" # define GETTY "/sbin/getty -L"
# define GETTY_BUSYBOX /* Tell tty.c about the getty argument order */ # define GETTY_BUSYBOX /* Tell tty.c about the getty argument order */
# define BAUDRATE 115200 # define BAUDRATE 115200
#else /* Debian/Ubuntu based distributions */ #else /* Debian/Ubuntu based distributions */
# define CONSOLE "/dev/tty1"
# define SETUP_DEVFS "/sbin/udevd --daemon" # define SETUP_DEVFS "/sbin/udevd --daemon"
# define GETTY "/sbin/getty -8" # define GETTY "/sbin/getty -8"
# define GETTY_AGETTY /* Tell tty.c about the getty argument order */ # define GETTY_AGETTY /* Tell tty.c about the getty argument order */
# define BAUDRATE 38400 # define BAUDRATE 38400
# define HAVE_DBUS
#endif #endif
/* If the user configures us to not know about any getty use the system /* If the user configures us to not know about any getty use the system
+3
View File
@@ -21,7 +21,10 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include <sys/types.h>
#include "../finit.h" #include "../finit.h"
#include "../config.h"
#include "../helpers.h" #include "../helpers.h"
#include "../plugin.h" #include "../plugin.h"
#include "libite/lite.h" #include "libite/lite.h"