mirror of
https://github.com/troglobit/finit.git
synced 2026-11-01 13:10:32 +00: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:
1 parent
ebb0d03034
commit
9da079fc67
1 file changed
+21
-22
@@ -158,33 +158,33 @@ int main()
|
|||||||
mount("proc", "/proc", "proc", 0, NULL);
|
mount("proc", "/proc", "proc", 0, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse kernel parameters
|
* Parse conf file
|
||||||
*/
|
*/
|
||||||
if ((f = fopen("/proc/cmdline", "r")) != NULL) {
|
if ((f = fopen("/etc/finit.conf", "r")) != NULL) {
|
||||||
char *t;
|
while(!feof(f)) {
|
||||||
|
fgets(line, 2095, f);
|
||||||
fgets(line, 2095, f);
|
if (!strncmp(line, "home=", 5)) {
|
||||||
debug("cmdline = %s", line);
|
strncpy(homedev, line + 5, 64);
|
||||||
|
} else if (!strncmp(line, "user=", 5)) {
|
||||||
t = strtok(line, " ");
|
strncpy(defuser, line + 5, 64);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
t = strtok(NULL, " ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
}
|
}
|
||||||
debug("home = %s", homedev);
|
debug("home = %s", homedev);
|
||||||
debug("user = %s", defuser);
|
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();
|
setsid();
|
||||||
|
|
||||||
@@ -376,7 +376,6 @@ void shutdown(int sig)
|
|||||||
system("/bin/echo -e \"\033[?25l\033[30;40m\"; "
|
system("/bin/echo -e \"\033[?25l\033[30;40m\"; "
|
||||||
"/bin/cp /boot/shutdown.b /dev/fb/0");
|
"/bin/cp /boot/shutdown.b /dev/fb/0");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
sleep(1);
|
|
||||||
|
|
||||||
system("/usr/sbin/alsactl store > /dev/null 2>&1");
|
system("/usr/sbin/alsactl store > /dev/null 2>&1");
|
||||||
system("/sbin/hwclock --systohc --localtime");
|
system("/sbin/hwclock --systohc --localtime");
|
||||||
|
|||||||
Reference in new issue
Block a user