Add quick single-user login tool
This commit is contained in:
parent
1d5a834991
commit
de4900f426
4
Makefile
4
Makefile
@ -118,7 +118,7 @@ WITH_LOGS = logtoserial=1
|
||||
.PHONY: all system install test toolchain userspace modules cdrom toaruos.iso cdrom-big toaruos-big.iso
|
||||
.PHONY: clean clean-soft clean-hard clean-user clean-mods clean-core clean-disk clean-once
|
||||
.PHONY: run vga term headless
|
||||
.PHONY: kvm vga-kvm term-kvm headless-kvm
|
||||
.PHONY: kvm vga-kvm term-kvm headless-kvm quick
|
||||
.PHONY: debug debug-kvm debug-term debug-term-kvm
|
||||
|
||||
# Prevents Make from removing intermediary files on failure
|
||||
@ -137,6 +137,8 @@ run: system
|
||||
${EMU} ${EMUARGS} -append "$(VID_QEMU) $(DISK_ROOT)"
|
||||
kvm: system
|
||||
${EMU} ${EMUARGS} ${EMUKVM} -append "$(VID_QEMU) $(DISK_ROOT)"
|
||||
quick: system
|
||||
${EMU} ${EMUARGS} ${EMUKVM} -append "$(VID_QEMU) $(DISK_ROOT) start=quick-launch"
|
||||
debug: system
|
||||
${EMU} ${EMUARGS} -append "$(VID_QEMU) $(WITH_LOGS) $(DISK_ROOT)"
|
||||
debug-kvm: system
|
||||
|
32
userspace/extra/quick-launch.c
Normal file
32
userspace/extra/quick-launch.c
Normal file
@ -0,0 +1,32 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include "lib/toaru_auth.h"
|
||||
|
||||
#include "lib/trace.h"
|
||||
#define TRACE_APP_NAME "quick-launch"
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
TRACE("Starting session manager...");
|
||||
|
||||
int _session_pid = fork();
|
||||
if (!_session_pid) {
|
||||
setuid(1000);
|
||||
toaru_auth_set_vars();
|
||||
|
||||
char * args[] = {"/bin/gsession", NULL};
|
||||
execvp(args[0], args);
|
||||
TRACE("gsession start failed?");
|
||||
}
|
||||
|
||||
int pid = 0;
|
||||
do {
|
||||
pid = wait(NULL);
|
||||
} while ((pid > 0 && pid != _session_pid) || (pid == -1 && errno == EINTR));
|
||||
|
||||
system("reboot");
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user