summaryrefslogtreecommitdiffstats
path: root/hooks
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-04-22 22:00:09 +0200
committerDave Reisner <dreisner@archlinux.org>2013-04-24 16:25:25 +0200
commit1a09a8632481ca5ee184ecb379476d2fdcd82fdd (patch)
treec467b6c2724497d637e5193ede82e0fae35a9cbc /hooks
parent45d340c154b7c956822e0c1a5ff4b956851e2cd6 (diff)
downloadmkinitcpio-1a09a8632481ca5ee184ecb379476d2fdcd82fdd.tar.gz
mkinitcpio-1a09a8632481ca5ee184ecb379476d2fdcd82fdd.tar.xz
hooks/usr: conditionally fsck /usr based on fstab
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'hooks')
-rw-r--r--hooks/usr10
1 files changed, 8 insertions, 2 deletions
diff --git a/hooks/usr b/hooks/usr
index 389e14c..f45ca7f 100644
--- a/hooks/usr
+++ b/hooks/usr
@@ -1,12 +1,18 @@
#!/usr/bin/ash
run_latehook() {
- local realtab=/new_root/etc/fstab
+ local usr_source mountopts passno realtab=/new_root/etc/fstab
if [ -f "$realtab" ]; then
if usr_source=$(findmnt -snero source --tab-file="$realtab" /usr); then
mountopts=$(findmnt -snero options --tab-file="$realtab" /usr)
- fsck_device "$usr_source"
+
+ # returning the passno column requires util-linux >= 2.23. for
+ # older versions which do not support this column, always fsck.
+ passno=$(findmnt -snero passno --tab-file="$realtab" /usr 2>/dev/null)
+ if [ -z "$passno" ] || [ "$passno" -gt 0 ]; then
+ fsck_device "$usr_source"
+ fi
msg ":: mounting '$usr_source' on /usr"
mount "$usr_source" /new_root/usr -o "$mountopts"
fi