mirror of
https://github.com/troglobit/finit.git
synced 2026-10-04 23:04:12 +07:00
Check if /sys exists and only mount if /sys isn't already mounted
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+13
-5
@@ -290,7 +290,7 @@ int main(int argc, char *argv[])
|
|||||||
uev_ctx_t loop;
|
uev_ctx_t loop;
|
||||||
char cmd[256];
|
char cmd[256];
|
||||||
char *path;
|
char *path;
|
||||||
int rc;
|
int rc = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* finit/init/telinit client tool uses /dev/initctl pipe
|
* finit/init/telinit client tool uses /dev/initctl pipe
|
||||||
@@ -352,8 +352,6 @@ int main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
if (mount("none", "/proc", "proc", 0, NULL))
|
if (mount("none", "/proc", "proc", 0, NULL))
|
||||||
_pe("Failed mounting /proc");
|
_pe("Failed mounting /proc");
|
||||||
if (mount("none", "/sys", "sysfs", 0, NULL))
|
|
||||||
_pe("Failed mounting /sys");
|
|
||||||
if (fisdir("/proc/bus/usb"))
|
if (fisdir("/proc/bus/usb"))
|
||||||
mount("none", "/proc/bus/usb", "usbfs", 0, NULL);
|
mount("none", "/proc/bus/usb", "usbfs", 0, NULL);
|
||||||
|
|
||||||
@@ -404,7 +402,7 @@ int main(int argc, char *argv[])
|
|||||||
if (!rc)
|
if (!rc)
|
||||||
print(1, "Cannot remount / as read-write, fsck failed before");
|
print(1, "Cannot remount / as read-write, fsck failed before");
|
||||||
else
|
else
|
||||||
run_interactive("mount -n -o remount,rw /", "Remounting / as read-write");
|
rc = run_interactive("mount -n -o remount,rw /", "Remounting / as read-write");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -416,10 +414,20 @@ int main(int argc, char *argv[])
|
|||||||
* XXX: Untested, in the initramfs age we should
|
* XXX: Untested, in the initramfs age we should
|
||||||
* probably use switch_root instead.
|
* probably use switch_root instead.
|
||||||
*/
|
*/
|
||||||
mount(SYSROOT, "/", NULL, MS_MOVE, NULL);
|
rc = mount(SYSROOT, "/", NULL, MS_MOVE, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create /sys if missing, some systems don't include it in their rootfs skeleton */
|
||||||
|
if (!rc && !fisdir("/sys"))
|
||||||
|
mkdir("/sys", 0755);
|
||||||
|
|
||||||
|
/* Only mount /sys if it's not already mounted */
|
||||||
|
if (!fismnt("/sys") && mount("none", "/sys", "sysfs", 0, NULL)) {
|
||||||
|
print(1, "Cannot mount /sys, your system may behave unusually");
|
||||||
|
_pe("Failed mounting /sys");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize .conf system and load static /etc/finit.conf
|
* Initialize .conf system and load static /etc/finit.conf
|
||||||
* Also initializes global_rlimit[] for udevd, below.
|
* Also initializes global_rlimit[] for udevd, below.
|
||||||
|
|||||||
Reference in New Issue
Block a user