From f94504ad9670a78198e87cc4e177bcd8b11b4ca2 Mon Sep 17 00:00:00 2001 From: Claudio Matsuoka Date: Wed, 28 May 2008 12:51:30 -0300 Subject: [PATCH] Write runlevel to utmp This is needed by Printerdrake (by Pascal Terjan) Signed-off-by: Claudio Matsuoka --- Changelog | 1 + Makefile | 3 --- finit-alt.c | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index b241bac1..6fa98a08 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,6 @@ 0.5 () - finit-alt listens to /dev/initctl to work with reboot(8) + - write runlevel to utmp, needed by Printerdrake (by Pascal Terjan) O.4 (20080516) - default username for finit-alt configurable in Makefile diff --git a/Makefile b/Makefile index e3dc1c14..5aeb2370 100644 --- a/Makefile +++ b/Makefile @@ -30,9 +30,6 @@ CFLAGS += -march=pentium-m # Use built-in run-parts instead of /bin/run-parts CFLAGS += -DBUILTIN_RUNPARTS -# Listen to /dev/initctl to handle reboot requests -CFLAGS += -DLISTEN_INITCTL - #### End of configurable parameters diff --git a/finit-alt.c b/finit-alt.c index c2f15887..c8942218 100644 --- a/finit-alt.c +++ b/finit-alt.c @@ -37,6 +37,7 @@ THE SOFTWARE. #include #include #include +#include #include "helpers.h" @@ -54,6 +55,8 @@ THE SOFTWARE. #define REMOUNT_ROOTFS_RW #define MAKE_DEVICES #define PAM_CONSOLE +#define LISTEN_INITCTL +#define RUNLEVEL 5 #else /* original Eeepc distribution */ #define RANDOMSEED "/var/lib/urandom/random-seed" #define SYSROOT "/mnt" @@ -145,6 +148,9 @@ int main() struct init_request req; struct timespec timeout; #endif +#ifdef RUNLEVEL + struct utmp entry; +#endif puts("finit-alt " VERSION " (built " __DATE__ " by " WHOAMI ")"); @@ -304,6 +310,15 @@ int main() } touch("/var/run/utmp"); +#ifdef RUNLEVEL + memset(&entry, 0, sizeof(struct utmp)); + entry.ut_type = RUN_LVL; + entry.ut_pid = '0' + RUNLEVEL; + setutent(); + pututline(&entry); + endutent(); +#endif + touch("/etc/resolvconf/run/enable-updates"); chdir("/etc/resolvconf/run/interface");