mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-02-03 13:47:04 +03:00
fstab-generator: Support root on tmpfs (or other deviceless FS)
This allows for stateless systems.
This commit is contained in:
parent
ea342a99fd
commit
b043846208
@ -397,15 +397,20 @@ static int add_root_mount(void) {
|
||||
_cleanup_free_ char *what = NULL;
|
||||
const char *opts;
|
||||
|
||||
if (isempty(arg_root_what)) {
|
||||
log_debug("Could not find a root= entry on the kernel command line.");
|
||||
return 0;
|
||||
}
|
||||
if (fstype_is_deviceless(arg_root_fstype)) {
|
||||
if (free_and_strdup(&what, arg_root_what) < 0)
|
||||
return log_oom();
|
||||
} else {
|
||||
if (isempty(arg_root_what)) {
|
||||
log_debug("Could not find a root= entry on the kernel command line.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
what = fstab_node_to_udev_node(arg_root_what);
|
||||
if (!path_is_absolute(what)) {
|
||||
log_debug("Skipping entry what=%s where=/sysroot type=%s", what, strna(arg_root_fstype));
|
||||
return 0;
|
||||
what = fstab_node_to_udev_node(arg_root_what);
|
||||
if (!path_is_absolute(what)) {
|
||||
log_debug("Skipping entry what=%s where=/sysroot type=%s", what, strna(arg_root_fstype));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!arg_root_options)
|
||||
|
@ -1713,6 +1713,35 @@ bool fstype_is_network(const char *fstype) {
|
||||
return nulstr_contains(table, fstype);
|
||||
}
|
||||
|
||||
bool fstype_is_deviceless(const char *fstype) {
|
||||
static const char table[] =
|
||||
"autofs\0"
|
||||
"bdev\0"
|
||||
"cgroup\0"
|
||||
"configfs\0"
|
||||
"cpuset\0"
|
||||
"debugfs\0"
|
||||
"devpts\0"
|
||||
"devtmpfs\0"
|
||||
"efivarfs\0"
|
||||
"hugetlbfs\0"
|
||||
"mqueue\0"
|
||||
"overlayfs\0"
|
||||
"pipefs\0"
|
||||
"proc\0"
|
||||
"pstore\0"
|
||||
"ramfs\0"
|
||||
"rootfs\0"
|
||||
"rpc_pipefs\0"
|
||||
"securityfs\0"
|
||||
"sockfs\0"
|
||||
"sysfs\0"
|
||||
"tmpfs\0";
|
||||
|
||||
return !isempty(fstype) && (
|
||||
nulstr_contains(table, fstype) || fstype_is_network(fstype));
|
||||
}
|
||||
|
||||
int chvt(int vt) {
|
||||
_cleanup_close_ int fd;
|
||||
|
||||
|
@ -409,6 +409,7 @@ int fd_cloexec(int fd, bool cloexec);
|
||||
int close_all_fds(const int except[], unsigned n_except);
|
||||
|
||||
bool fstype_is_network(const char *fstype);
|
||||
bool fstype_is_deviceless(const char *fstype);
|
||||
|
||||
int chvt(int vt);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user