mirror of
https://github.com/troglobit/finit.git
synced 2026-11-06 15:51:03 +00:00
Delay mount of /proc & /sys to *after* emergency_shell()
In case we run into problems mounting /sys or /proc we should have signals and the optional emergency shell available for recovery. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
dc99d8637b
commit
e3884597a5
1 file changed
+16
-15
+16
-15
@@ -318,27 +318,13 @@ int main(int argc, char *argv[])
|
|||||||
ctx = &loop;
|
ctx = &loop;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set PATH and SHELL early to something sane
|
* Set PATH, SHELL, PWD and umask early to something sane
|
||||||
*/
|
*/
|
||||||
setenv("PATH", _PATH_STDPATH, 1);
|
setenv("PATH", _PATH_STDPATH, 1);
|
||||||
setenv("SHELL", _PATH_BSHELL, 1);
|
setenv("SHELL", _PATH_BSHELL, 1);
|
||||||
|
|
||||||
/*
|
|
||||||
* Mount base file system, kernel is assumed to run devtmpfs for /dev
|
|
||||||
*/
|
|
||||||
chdir("/");
|
chdir("/");
|
||||||
umask(0);
|
umask(0);
|
||||||
if (mount("none", "/proc", "proc", 0, NULL))
|
|
||||||
_pe("Failed mounting /proc");
|
|
||||||
if (mount("none", "/sys", "sysfs", 0, NULL))
|
|
||||||
_pe("Failed mounting /sysfs");
|
|
||||||
if (fisdir("/proc/bus/usb"))
|
|
||||||
mount("none", "/proc/bus/usb", "usbfs", 0, NULL);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize default control groups, if available
|
|
||||||
*/
|
|
||||||
cgroup_init();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse kernel command line (debug, rescue, splash, etc.)
|
* Parse kernel command line (debug, rescue, splash, etc.)
|
||||||
@@ -360,6 +346,21 @@ int main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
sig_init();
|
sig_init();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mount base file system
|
||||||
|
*/
|
||||||
|
if (mount("none", "/proc", "proc", 0, NULL))
|
||||||
|
_pe("Failed mounting /proc");
|
||||||
|
if (mount("none", "/sys", "sysfs", 0, NULL))
|
||||||
|
_pe("Failed mounting /sys");
|
||||||
|
if (fisdir("/proc/bus/usb"))
|
||||||
|
mount("none", "/proc/bus/usb", "usbfs", 0, NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize default control groups, if available
|
||||||
|
*/
|
||||||
|
cgroup_init();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load plugins early, finit.conf may contain references to
|
* Load plugins early, finit.conf may contain references to
|
||||||
* features implemented by plugins.
|
* features implemented by plugins.
|
||||||
|
|||||||
Reference in new issue
Block a user