mirror of
https://github.com/troglobit/finit.git
synced 2026-11-01 13:10:32 +00:00
User, modules and checkfs configurable from /etc/finit.conf
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
1 parent
ccd49f2024
commit
c55afaadb3
4 files changed
+47
-24
No files matched your search
@@ -66,10 +66,3 @@ automounting may not work correctly. That happens because the session
|
|||||||
is started before the system message bus, so add a "dcop kded mediamanager
|
is started before the system message bus, so add a "dcop kded mediamanager
|
||||||
reloadBackends" call in the user AutoStart to restart the client.
|
reloadBackends" call in the user AutoStart to restart the client.
|
||||||
|
|
||||||
|
|
||||||
finit-alt parameters
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
CHECKFS=<dev> run fsck on the specified device
|
|
||||||
DEBUG enable runtime debug (drops to shell after X session)
|
|
||||||
|
|
||||||
+2
-1
@@ -21,7 +21,8 @@ Mandriva 2008
|
|||||||
|
|
||||||
4 - Set the pointer device in the X server configuration to /dev/input/mice
|
4 - Set the pointer device in the X server configuration to /dev/input/mice
|
||||||
|
|
||||||
5 - Have a user named "user", or change the default in Makefile
|
5 - Have a user named "user", change the default in Makefile or configure
|
||||||
|
in /etc/finit.conf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+41
-16
@@ -137,38 +137,63 @@ int main()
|
|||||||
|
|
||||||
mount("proc", "/proc", "proc", 0, NULL);
|
mount("proc", "/proc", "proc", 0, NULL);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse kernel parameters
|
* Parse kernel parameters
|
||||||
*/
|
*/
|
||||||
if ((f = fopen("/proc/cmdline", "r")) != NULL) {
|
if ((f = fopen("/proc/cmdline", "r")) != NULL) {
|
||||||
char *x;
|
|
||||||
fgets(line, LINE_SIZE, f);
|
fgets(line, LINE_SIZE, f);
|
||||||
if (strstr(line, "quiet")) {
|
if (strstr(line, "quiet")) {
|
||||||
close(0);
|
close(0);
|
||||||
close(1);
|
close(1);
|
||||||
close(2);
|
close(2);
|
||||||
}
|
}
|
||||||
if ((x = strstr(line, "CHECKFS="))) {
|
|
||||||
x += 8;
|
|
||||||
strcpy(cmd, "e2fsck -C -p ");
|
|
||||||
c = cmd + strlen(cmd);
|
|
||||||
while (x && *x != ' ') *c++ = *x++;
|
|
||||||
system(cmd);
|
|
||||||
sync();
|
|
||||||
sync();
|
|
||||||
reboot(RB_AUTOBOOT);
|
|
||||||
}
|
|
||||||
if ((x = strstr(line, "USERNAME="))) {
|
|
||||||
x += 9;
|
|
||||||
c = cmd + strlen(cmd);
|
|
||||||
while (x && *x != ' ') *c++ = *x++;
|
|
||||||
}
|
|
||||||
if ((strstr(line, "DEBUG"))) {
|
if ((strstr(line, "DEBUG"))) {
|
||||||
debug = 1;
|
debug = 1;
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Parse configuration file
|
||||||
|
*/
|
||||||
|
if ((f = fopen("/etc/finit.conf", "r")) != NULL) {
|
||||||
|
char *x;
|
||||||
|
while (!feof(f)) {
|
||||||
|
fgets(line, LINE_SIZE, f);
|
||||||
|
|
||||||
|
if (debug) {
|
||||||
|
printf("conf: %s", line);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((x = strstr(line, "check ")) == line) {
|
||||||
|
x += 6;
|
||||||
|
strcpy(cmd, "/sbin/e2fsck -C -p ");
|
||||||
|
c = cmd + strlen(cmd);
|
||||||
|
while (x && *x != ' ') *c++ = *x++;
|
||||||
|
system(cmd);
|
||||||
|
sync();
|
||||||
|
sync();
|
||||||
|
reboot(RB_AUTOBOOT);
|
||||||
|
}
|
||||||
|
if ((x = strstr(line, "user ")) == line) {
|
||||||
|
x += 5;
|
||||||
|
c = username;
|
||||||
|
while (x && *x != ' ') *c++ = *x++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((x = strstr(line, "module ")) == line) {
|
||||||
|
x += 7;
|
||||||
|
strcpy(cmd, "/sbin/insmod ");
|
||||||
|
c = cmd + strlen(cmd);
|
||||||
|
while (x && *x != ' ') *c++ = *x++;
|
||||||
|
system(cmd);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
setsid();
|
setsid();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
user fred
|
||||||
|
module agp-intel
|
||||||
|
module p4-clockmod
|
||||||
|
check /dev/sda3
|
||||||
Reference in new issue
Block a user