summaryrefslogtreecommitdiffstats
path: root/hooks/usr
blob: f45ca7f12502296f6a01f028f0b760d0f2ceb169 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/ash

run_latehook() {
    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)

            # 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
    fi
}

# vim: set ft=sh ts=4 sw=4 et: