mirror of
https://github.com/systemd/systemd.git
synced 2025-02-04 21:47:31 +03:00
fstab-generator: use DefaultDependencies=yes
This removes some redundancy between the generator and the core mount handling.
This commit is contained in:
parent
40f862e3ae
commit
80c3b720bf
2
TODO
2
TODO
@ -220,8 +220,6 @@ Features:
|
|||||||
/etc should always override /run+/usr and also any symlink
|
/etc should always override /run+/usr and also any symlink
|
||||||
destination.
|
destination.
|
||||||
|
|
||||||
* remove duplicate default deps logic from fstab-generator vs. mount.c
|
|
||||||
|
|
||||||
* when isolating, try to figure out a way how we implicitly can order
|
* when isolating, try to figure out a way how we implicitly can order
|
||||||
all units we stop before the isolating unit...
|
all units we stop before the isolating unit...
|
||||||
|
|
||||||
|
@ -116,10 +116,7 @@ static int add_swap(const char *what, struct mntent *me) {
|
|||||||
|
|
||||||
fputs("# Automatically generated by systemd-fstab-generator\n\n"
|
fputs("# Automatically generated by systemd-fstab-generator\n\n"
|
||||||
"[Unit]\n"
|
"[Unit]\n"
|
||||||
"SourcePath=/etc/fstab\n"
|
"SourcePath=/etc/fstab\n", f);
|
||||||
"DefaultDependencies=no\n"
|
|
||||||
"Conflicts=" SPECIAL_UMOUNT_TARGET "\n"
|
|
||||||
"Before=" SPECIAL_UMOUNT_TARGET "\n", f);
|
|
||||||
|
|
||||||
if (!noauto && !nofail)
|
if (!noauto && !nofail)
|
||||||
fputs("Before=" SPECIAL_SWAP_TARGET "\n", f);
|
fputs("Before=" SPECIAL_SWAP_TARGET "\n", f);
|
||||||
@ -209,9 +206,6 @@ static int add_mount(
|
|||||||
bool nofail,
|
bool nofail,
|
||||||
bool automount,
|
bool automount,
|
||||||
bool isbind,
|
bool isbind,
|
||||||
const char *pre,
|
|
||||||
const char *pre2,
|
|
||||||
const char *online,
|
|
||||||
const char *post,
|
const char *post,
|
||||||
const char *source) {
|
const char *source) {
|
||||||
_cleanup_free_ char
|
_cleanup_free_ char
|
||||||
@ -258,33 +252,9 @@ static int add_mount(
|
|||||||
fprintf(f,
|
fprintf(f,
|
||||||
"# Automatically generated by systemd-fstab-generator\n\n"
|
"# Automatically generated by systemd-fstab-generator\n\n"
|
||||||
"[Unit]\n"
|
"[Unit]\n"
|
||||||
"SourcePath=%s\n"
|
"SourcePath=%s\n",
|
||||||
"DefaultDependencies=no\n",
|
|
||||||
source);
|
source);
|
||||||
|
|
||||||
if (!path_equal(where, "/")) {
|
|
||||||
if (pre)
|
|
||||||
fprintf(f,
|
|
||||||
"After=%s\n",
|
|
||||||
pre);
|
|
||||||
|
|
||||||
if (pre2)
|
|
||||||
fprintf(f,
|
|
||||||
"After=%s\n",
|
|
||||||
pre2);
|
|
||||||
|
|
||||||
if (online)
|
|
||||||
fprintf(f,
|
|
||||||
"After=%s\n"
|
|
||||||
"Wants=%s\n",
|
|
||||||
online,
|
|
||||||
online);
|
|
||||||
|
|
||||||
fprintf(f,
|
|
||||||
"Conflicts=" SPECIAL_UMOUNT_TARGET "\n"
|
|
||||||
"Before=" SPECIAL_UMOUNT_TARGET "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (post && !noauto && !nofail && !automount)
|
if (post && !noauto && !nofail && !automount)
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"Before=%s\n",
|
"Before=%s\n",
|
||||||
@ -368,10 +338,7 @@ static int add_mount(
|
|||||||
fprintf(f,
|
fprintf(f,
|
||||||
"# Automatically generated by systemd-fstab-generator\n\n"
|
"# Automatically generated by systemd-fstab-generator\n\n"
|
||||||
"[Unit]\n"
|
"[Unit]\n"
|
||||||
"SourcePath=%s\n"
|
"SourcePath=%s\n",
|
||||||
"DefaultDependencies=no\n"
|
|
||||||
"Conflicts=" SPECIAL_UMOUNT_TARGET "\n"
|
|
||||||
"Before=" SPECIAL_UMOUNT_TARGET "\n",
|
|
||||||
source);
|
source);
|
||||||
|
|
||||||
if (post)
|
if (post)
|
||||||
@ -447,7 +414,7 @@ static int parse_fstab(const char *prefix, bool initrd) {
|
|||||||
k = add_swap(what, me);
|
k = add_swap(what, me);
|
||||||
else {
|
else {
|
||||||
bool noauto, nofail, automount, isbind;
|
bool noauto, nofail, automount, isbind;
|
||||||
const char *pre, *pre2, *post, *online;
|
const char *post;
|
||||||
|
|
||||||
noauto = !!hasmntopt(me, "noauto");
|
noauto = !!hasmntopt(me, "noauto");
|
||||||
nofail = !!hasmntopt(me, "nofail");
|
nofail = !!hasmntopt(me, "nofail");
|
||||||
@ -457,25 +424,18 @@ static int parse_fstab(const char *prefix, bool initrd) {
|
|||||||
isbind = mount_is_bind(me);
|
isbind = mount_is_bind(me);
|
||||||
|
|
||||||
if (initrd) {
|
if (initrd) {
|
||||||
pre = pre2 = online = NULL;
|
|
||||||
post = SPECIAL_INITRD_FS_TARGET;
|
post = SPECIAL_INITRD_FS_TARGET;
|
||||||
} else if (mount_in_initrd(me)) {
|
} else if (mount_in_initrd(me)) {
|
||||||
pre = pre2 = online = NULL;
|
|
||||||
post = SPECIAL_INITRD_ROOT_FS_TARGET;
|
post = SPECIAL_INITRD_ROOT_FS_TARGET;
|
||||||
} else if (mount_is_network(me)) {
|
} else if (mount_is_network(me)) {
|
||||||
pre = SPECIAL_REMOTE_FS_PRE_TARGET;
|
|
||||||
pre2 = SPECIAL_NETWORK_TARGET;
|
|
||||||
online = SPECIAL_NETWORK_ONLINE_TARGET;
|
|
||||||
post = SPECIAL_REMOTE_FS_TARGET;
|
post = SPECIAL_REMOTE_FS_TARGET;
|
||||||
} else {
|
} else {
|
||||||
pre = SPECIAL_LOCAL_FS_PRE_TARGET;
|
|
||||||
pre2 = online = NULL;
|
|
||||||
post = SPECIAL_LOCAL_FS_TARGET;
|
post = SPECIAL_LOCAL_FS_TARGET;
|
||||||
}
|
}
|
||||||
|
|
||||||
k = add_mount(what, where, me->mnt_type, me->mnt_opts,
|
k = add_mount(what, where, me->mnt_type, me->mnt_opts,
|
||||||
me->mnt_passno, noauto, nofail, automount,
|
me->mnt_passno, noauto, nofail, automount,
|
||||||
isbind, pre, pre2, online, post, fstab_path);
|
isbind, post, fstab_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k < 0)
|
if (k < 0)
|
||||||
@ -563,7 +523,7 @@ static int parse_new_root_from_proc_cmdline(void) {
|
|||||||
|
|
||||||
log_debug("Found entry what=%s where=/sysroot type=%s", what, type);
|
log_debug("Found entry what=%s where=/sysroot type=%s", what, type);
|
||||||
r = add_mount(what, "/sysroot", type, opts, 0, noauto, nofail, false,
|
r = add_mount(what, "/sysroot", type, opts, 0, noauto, nofail, false,
|
||||||
false, NULL, NULL, NULL, SPECIAL_INITRD_ROOT_FS_TARGET, "/proc/cmdline");
|
false, SPECIAL_INITRD_ROOT_FS_TARGET, "/proc/cmdline");
|
||||||
|
|
||||||
return (r < 0) ? r : 0;
|
return (r < 0) ? r : 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user