mirror of
https://github.com/troglobit/finit.git
synced 2026-10-04 06:44:12 +07:00
Write runlevel to utmp
This is needed by Printerdrake (by Pascal Terjan) Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
+15
@@ -37,6 +37,7 @@ THE SOFTWARE.
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/wait.h>
|
||||
#include <linux/fs.h>
|
||||
#include <utmp.h>
|
||||
|
||||
#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");
|
||||
|
||||
Reference in New Issue
Block a user