mirror of
https://github.com/troglobit/finit.git
synced 2026-11-28 20:58:24 +00: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 parent
698c5a1852
commit
f94504ad96
3 files changed
+16
-3
No files matched your search
@@ -1,5 +1,6 @@
|
|||||||
0.5 ()
|
0.5 ()
|
||||||
- finit-alt listens to /dev/initctl to work with reboot(8)
|
- finit-alt listens to /dev/initctl to work with reboot(8)
|
||||||
|
- write runlevel to utmp, needed by Printerdrake (by Pascal Terjan)
|
||||||
|
|
||||||
O.4 (20080516)
|
O.4 (20080516)
|
||||||
- default username for finit-alt configurable in Makefile
|
- 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
|
# Use built-in run-parts instead of /bin/run-parts
|
||||||
CFLAGS += -DBUILTIN_RUNPARTS
|
CFLAGS += -DBUILTIN_RUNPARTS
|
||||||
|
|
||||||
# Listen to /dev/initctl to handle reboot requests
|
|
||||||
CFLAGS += -DLISTEN_INITCTL
|
|
||||||
|
|
||||||
#### End of configurable parameters
|
#### End of configurable parameters
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+15
@@ -37,6 +37,7 @@ THE SOFTWARE.
|
|||||||
#include <sys/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
|
#include <utmp.h>
|
||||||
|
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
@@ -54,6 +55,8 @@ THE SOFTWARE.
|
|||||||
#define REMOUNT_ROOTFS_RW
|
#define REMOUNT_ROOTFS_RW
|
||||||
#define MAKE_DEVICES
|
#define MAKE_DEVICES
|
||||||
#define PAM_CONSOLE
|
#define PAM_CONSOLE
|
||||||
|
#define LISTEN_INITCTL
|
||||||
|
#define RUNLEVEL 5
|
||||||
#else /* original Eeepc distribution */
|
#else /* original Eeepc distribution */
|
||||||
#define RANDOMSEED "/var/lib/urandom/random-seed"
|
#define RANDOMSEED "/var/lib/urandom/random-seed"
|
||||||
#define SYSROOT "/mnt"
|
#define SYSROOT "/mnt"
|
||||||
@@ -145,6 +148,9 @@ int main()
|
|||||||
struct init_request req;
|
struct init_request req;
|
||||||
struct timespec timeout;
|
struct timespec timeout;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef RUNLEVEL
|
||||||
|
struct utmp entry;
|
||||||
|
#endif
|
||||||
|
|
||||||
puts("finit-alt " VERSION " (built " __DATE__ " by " WHOAMI ")");
|
puts("finit-alt " VERSION " (built " __DATE__ " by " WHOAMI ")");
|
||||||
|
|
||||||
@@ -304,6 +310,15 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
touch("/var/run/utmp");
|
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");
|
touch("/etc/resolvconf/run/enable-updates");
|
||||||
|
|
||||||
chdir("/etc/resolvconf/run/interface");
|
chdir("/etc/resolvconf/run/interface");
|
||||||
|
|||||||
Reference in new issue
Block a user