summaryrefslogtreecommitdiff
path: root/src/fstab-generator
diff options
context:
space:
mode:
Diffstat (limited to 'src/fstab-generator')
-rw-r--r--src/fstab-generator/fstab-generator.c59
1 files changed, 3 insertions, 56 deletions
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index e78001829b..6ebe8aa673 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -38,22 +38,6 @@
static const char *arg_dest = "/tmp";
static bool arg_enabled = true;
-static int device_name(const char *path, char **unit) {
- char *p;
-
- assert(path);
-
- if (!is_device_path(path))
- return 0;
-
- p = unit_name_from_path(path, ".device");
- if (!p)
- return log_oom();
-
- *unit = p;
- return 1;
-}
-
static int mount_find_pri(struct mntent *me, int *ret) {
char *end, *pri;
unsigned long r;
@@ -82,7 +66,6 @@ static int mount_find_pri(struct mntent *me, int *ret) {
static int add_swap(const char *what, struct mntent *me) {
_cleanup_free_ char *name = NULL, *unit = NULL, *lnk = NULL, *device = NULL;
_cleanup_fclose_ FILE *f = NULL;
- bool noauto, nofail;
int r, pri = -1;
assert(what);
@@ -94,9 +77,6 @@ static int add_swap(const char *what, struct mntent *me) {
return pri;
}
- noauto = !!hasmntopt(me, "noauto");
- nofail = !!hasmntopt(me, "nofail");
-
name = unit_name_from_path(what, ".swap");
if (!name)
return log_oom();
@@ -114,14 +94,10 @@ static int add_swap(const char *what, struct mntent *me) {
return -errno;
}
- fputs("# Automatically generated by systemd-fstab-generator\n\n"
- "[Unit]\n"
- "SourcePath=/etc/fstab\n", f);
-
- if (!noauto && !nofail)
- fputs("Before=" SPECIAL_SWAP_TARGET "\n", f);
-
fprintf(f,
+ "# Automatically generated by systemd-fstab-generator\n\n"
+ "[Unit]\n"
+ "SourcePath=/etc/fstab\n"
"\n"
"[Swap]\n"
"What=%s\n",
@@ -138,35 +114,6 @@ static int add_swap(const char *what, struct mntent *me) {
return -errno;
}
- if (!noauto) {
- lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name, NULL);
- if (!lnk)
- return log_oom();
-
- mkdir_parents_label(lnk, 0755);
- if (symlink(unit, lnk) < 0) {
- log_error("Failed to create symlink %s: %m", lnk);
- return -errno;
- }
-
- r = device_name(what, &device);
- if (r < 0)
- return r;
-
- if (r > 0) {
- free(lnk);
- lnk = strjoin(arg_dest, "/", device, ".wants/", name, NULL);
- if (!lnk)
- return log_oom();
-
- mkdir_parents_label(lnk, 0755);
- if (symlink(unit, lnk) < 0) {
- log_error("Failed to create symlink %s: %m", lnk);
- return -errno;
- }
- }
- }
-
return 0;
}