Commit Graph

55 Commits

Author SHA1 Message Date
Mike Yuan
becff9f3e3
tree-wide: add SPDX headers and shebang 2024-04-07 00:30:43 +08:00
Mike Yuan
3561b8fe2a
tree-wide: remove vim config
Nowadays we've got a proper .editorconfig,
let's make it the only source of truth and
avoid the burden of keeping everything in sync.
2024-04-07 00:30:43 +08:00
Morten Linderud
a5b772db02
genfstab: ensure swap devices adhere to -f
Signed-off-by: Morten Linderud <morten@linderud.pw>
2023-05-26 17:01:25 +02:00
Emil Velikov
0c848b83b5 common: split genfstab only helpers
v2: drop warning and msg from fstab-helpers

v3: drop m4 -> sed conversion

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-05-03 13:46:15 +01:00
Emil Velikov
b07a1578d9 genfstab: reshuffle while read loop
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-03-26 19:03:33 +01:00
Mike Yuan
ad778b6f74
genfstab: remove atgc mount option
This is not changeable during remount,
so let's not include it automatically.
Users who want this feature should turn
to ArchWiki for help[1].

[1] https://wiki.archlinux.org/title/F2FS#Recommended_mount_options

See also: https://github.com/systemd/systemd/issues/26763
2023-03-12 06:42:45 +08:00
Morten Linderud
4802e1197e
Merge branch 'pr-36' 2022-11-20 14:59:40 +01:00
Mike Yuan
added92801
genfstab: remove subvolid= from btrfs options if subvol= is set
Having only one of subvol= and subvolid= is enough for mounting a btrfs subvolume
And having subvolid= set prevents things like 'snapper rollback' to work, as it
updates the subvolume in-place, leaving subvol= unchanged with a different subvolid.
2022-11-20 18:08:23 +08:00
Mike Yuan
c04c43a6ce
genfstab: fix src of bind mounts
Sources of bind mounts in fstab should be relative to the target's root
instead of the host one.
2022-10-27 13:18:01 +08:00
Takeshi Suzuki
ca8e8f63ec
genfstab: disable appending subvol onto options
Options parsed from findmnt may already have the subvol option, so
appending the subvol option is unnecessary.

Fixes FS#65003

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
2021-03-10 21:33:50 -05:00
Eli Schwartz
4eb54af72a
genfstab: correctly trim root prefix on swapfiles
We remove the root prefix for all other devices by design, but omitted
doing so for swapfiles.

Fixes FS#63069
2019-07-02 11:20:33 -04:00
Eli Schwartz
8652c5a724
consistently use -v <val> for help text descriptions 2019-06-05 15:26:59 -04:00
Dave Reisner
dad0ee7266 Only use explicitly set swap priorities
A priority of -2 seems to indicate "not defined" and we should simply
leave this alone.
2019-01-05 11:21:09 -05:00
Dave Reisner
c07baac985 genfstab: give examples of valid values for -t
This is non-exhaustive, but it's representative of the popular options
in 2018.
2018-10-15 12:58:46 -04:00
Dave Reisner
4b929ea03a genfstab: add support for prefix matching
this allows genfstab to used on running systems to generate entries for
newly added mount points.
2018-05-18 17:18:03 -04:00
Dave Reisner
4b781af21f prune relatime option for psuedofs 2017-06-29 08:23:30 -04:00
Dave Reisner
daa2fac5b2 genfstab: canonicalize root dir
Avoids problems with users passing weird inputs (such as including a
trailing slash).

ref: https://bugs.archlinux.org/task/45753
2016-06-12 10:48:26 -04:00
Dave Reisner
ae6a0a00ec genfstab: strip seclabel from optstring
People seem to suffer from this, so let's just fix it.

https://www.marshut.net/krqsrn/genfstab-fstab-seclabel-uuid-vs-partuuid-and-arch-wiki.html
https://bbs.archlinux.org/viewtopic.php?pid=1360580
2014-12-26 12:04:05 -05:00
Dave Reisner
67dcb08f4b genfstab: make -p default behavior, add -P as inverse
This should be the default, as you generally don't want to include
pseudofs mounts in your /etc/fstab.
2014-12-26 11:54:24 -05:00
Dave Reisner
f726f8c22c genfstab: add vfat quirk 2014-04-06 10:48:15 -04:00
Dave Reisner
03121cb504 genfstab: add option quirks for f2fs
FS#38019.
2014-04-06 10:48:15 -04:00
Dave Reisner
756e831bd5 genfstab: mangle tag values when needed 2013-12-08 22:42:49 -05:00
Dave Reisner
a93aab3f43 genfstab: fix deleted file parsing
backslashes in single quotes don't need escaping. We need to match the
literal string \040deleted.
2013-12-08 22:42:49 -05:00
Dave Reisner
1f2a6b9b71 genfstab: check sooner for pseudofs types 2013-07-14 12:24:34 -04:00
Dave Reisner
026f54428d genfstab: remove obsolete check for overlapping modes
1f03775f4f introduced arbitrary tag identification which removed the
variables this conditional checks.
2013-07-14 12:21:41 -04:00
Dave Reisner
c6af176666 genfstab: be more careful about assigning passno 2013-05-26 11:41:53 -04:00
Dave Reisner
56e438869c genfstab: prefer lsblk over blkid
lsblk has a far nicer interface and is capable of doing its work
without the need for extra privileges to read superblocks (assuming
udev is behaving properly).
2013-05-23 13:23:48 -04:00
Dave Reisner
99e6b07ab3 genfstab: derive the real type of fuseblk filesystems 2013-05-02 14:09:52 -04:00
Dave Reisner
e4b4e30213 genfstab: correctly specify bind as option
'bind' is an option, not an fstype. In the case of a bind mount, the
fstype is ignored.
2012-12-09 14:05:41 -05:00
Dave Reisner
2179b43b0f genfstab: skip deleted swap files 2012-12-09 13:59:27 -05:00
Dave Reisner
d7624977d3 genfstab: fix typo in comment 2012-11-24 12:38:18 -05:00
Dave Reisner
326e62284c genfstab: trim leading slash from btrfs subvol 2012-11-14 19:38:27 -05:00
Dave Reisner
04c137cfae genfstab: fix root passno assignment
leverage findmnt to match the source device to the root partition. I
wonder how long until btrfs invalidates this approach.
2012-11-14 19:36:13 -05:00
Dave Reisner
cf84170321 add the -h option to the usage 2012-11-12 21:00:09 -05:00
Dave Reisner
5897694194 genfstab: always upcase the requested tag
lowercase tags do not exist, so case shouldn't be a user-facing concern.
2012-11-11 23:45:49 -05:00
Dave Reisner
73016da72f genfstab: avoid re-printing kernel name
Without a specified tag, the devnode should not be printed.
2012-11-11 23:43:51 -05:00
Dave Reisner
e62b6bb560 genfstab: remove dead code
This shouldn't have been added with the previous patch.
2012-11-11 17:31:26 -05:00
Dave Reisner
1f03775f4f genfstab: allow identification by arbitrary tag
Add a -t option which accepts an arbitrary tag to lookup for source
device identification. If the lookup fails, fallback on the kernel
naming. With this change, -L and -U become synonyms for -t LABEL and
-t UUID, respectively.
2012-11-11 17:27:41 -05:00
Dave Reisner
3a7eb157d1 genfstab: provide DM names for swap
We're kind enough to provide DM names for non-swap devices, but simply
use the /dev/dm-X nodes for swap, since that's what /proc/swaps provides
us with. Resolve the DM name out of sysfs and use this instead.

Fixes FS#32609.
2012-11-11 17:04:14 -05:00
Dave Reisner
65b689bda9 genfstab: specify proper grammar in usage
bash getopts stops parsing options at the first non-option argument.
Rather than import some overblown option parser such as the one used in
makepkg or mkinitcpio, just correct the usage.

FS#31862.
2012-10-09 12:06:48 -04:00
Dave Reisner
4f3ef5bfa7 genfstab: ignore suspected bind mounts from the host 2012-10-03 22:46:39 -04:00
Dave Reisner
108735a148 genfstab: use findmnt FSROOT column
I added this for util-linux 2.22 so I could avoid parsing out the
subvolume from the target. Might as well make use of it.
2012-10-02 22:17:16 -04:00
Dave Reisner
e5790dd5e9 genfstab: fix invalid paths when run against / 2012-10-02 22:17:16 -04:00
Dave Reisner
09772d0f38 genfstab: use a more innocuous name than 'source' 2012-08-08 23:15:57 -04:00
Dave Reisner
c8b3d5e8d8 genfstab: handle btrfs subvolumes correctly 2012-08-08 23:12:27 -04:00
Dave Reisner
2dda000a86 genfstab: avoid mangling root parameter 2012-07-22 20:16:09 -04:00
Dave Reisner
b7c75786b0 genfstab: avoid reference to uninitialized var
Rename this, too, so it doesn't share a name with a reserved word.

Fixes FS#30808
2012-07-22 20:11:54 -04:00
Dave Reisner
1d9c98c5ee enforce user-specified root directory
Remove the -r option, forcing the user to explicitly pass a root
directory. This removes some confusion wherein we set defaults, but
wouldn't allow all the defaults to be accepted.

This also adds some mild documentation to the help output for genfstab
and pacstrap.
2012-07-15 10:07:11 -04:00
Dave Reisner
0537563148 use blkid for uuid/label instead of lsblk
This works around something that seems might be a bug in lsblk where-in
detection of UUIDs fails for certain devices when invoked as non-root.
2012-06-22 20:28:37 -04:00
Dave Reisner
60f20d8fc4 avoid fsck'ing bind mounts 2012-06-18 14:25:01 -04:00