mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
Don't specify user and home from kernel cmd line, use conf file instead
And the command file is /etc/finit.conf Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
@@ -158,33 +158,33 @@ int main()
|
||||
mount("proc", "/proc", "proc", 0, NULL);
|
||||
|
||||
/*
|
||||
* Parse kernel parameters
|
||||
* Parse conf file
|
||||
*/
|
||||
if ((f = fopen("/proc/cmdline", "r")) != NULL) {
|
||||
char *t;
|
||||
|
||||
fgets(line, 2095, f);
|
||||
debug("cmdline = %s", line);
|
||||
|
||||
t = strtok(line, " ");
|
||||
while (t) {
|
||||
debug("t = %s", t);
|
||||
if (!strcmp(t, "quiet")) {
|
||||
close(0);
|
||||
close(1);
|
||||
close(2);
|
||||
} else if (!strncmp(t, "home=", 5)) {
|
||||
strncpy(homedev, t + 5, 64);
|
||||
} else if (!strncmp(t, "user=", 5)) {
|
||||
strncpy(defuser, t + 5, 64);
|
||||
if ((f = fopen("/etc/finit.conf", "r")) != NULL) {
|
||||
while(!feof(f)) {
|
||||
fgets(line, 2095, f);
|
||||
if (!strncmp(line, "home=", 5)) {
|
||||
strncpy(homedev, line + 5, 64);
|
||||
} else if (!strncmp(line, "user=", 5)) {
|
||||
strncpy(defuser, line + 5, 64);
|
||||
}
|
||||
t = strtok(NULL, " ");
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
debug("home = %s", homedev);
|
||||
debug("user = %s", defuser);
|
||||
|
||||
/*
|
||||
* Parse kernel parameters
|
||||
*/
|
||||
if ((f = fopen("/proc/cmdline", "r")) != NULL) {
|
||||
fgets(line, 2095, f);
|
||||
if (strstr(line, "quiet")) {
|
||||
close(0);
|
||||
close(1);
|
||||
close(2);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
setsid();
|
||||
|
||||
@@ -376,7 +376,6 @@ void shutdown(int sig)
|
||||
system("/bin/echo -e \"\033[?25l\033[30;40m\"; "
|
||||
"/bin/cp /boot/shutdown.b /dev/fb/0");
|
||||
sleep(1);
|
||||
sleep(1);
|
||||
|
||||
system("/usr/sbin/alsactl store > /dev/null 2>&1");
|
||||
system("/sbin/hwclock --systohc --localtime");
|
||||
|
||||
Reference in New Issue
Block a user