blob: dde219a1f4ce7dc67dbdc08aa2bd64834f0fc629 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#!/bin/bash
build() {
local fsck= added=0
add_fsck() {
if [[ $1 = ext[234] ]]; then
add_binary fsck.ext4
add_symlink /usr/bin/fsck.ext2 fsck.ext4
add_symlink /usr/bin/fsck.ext3 fsck.ext4
else
add_binary "fsck.$1"
fi
}
if (( ! fs_autodetect_failed )) && [[ $rootfstype$usrfstype ]]; then
if [[ $rootfstype ]]; then
add_fsck $rootfstype && (( ++added ))
fi
if [[ $usrfstype && $usrfstype != $rootfstype ]]; then
add_fsck $usrfstype && (( ++added ))
fi
else
for fsck in /{usr/,}{s,}bin/fsck.*; do
[[ -f $fsck ]] || continue
add_binary "$fsck" && (( ++added ))
done
fi
if (( added )); then
add_binary fsck
else
warning "No fsck helpers found. fsck will not be run on boot."
fi
}
help() {
cat <<HELPEOF
This hook provides fsck and filesystem specific helpers to perform an fsck
operation on the root device prior to mounting. If the autodetect hook is used,
only the fsck helper specific to your filesystem will be added to the image. It
is highly recommended that if you include this hook that you also include any
necessary modules to ensure your keyboard will work in early userspace.
To control the behavior of fsck on bootup, fsck.mode=force can be passed on
the kernel command line to insist on running a full filesystem check. Similarly
fsck.mode=skip can be passed to cause fsck not to run at all.
HELPEOF
}
# vim: set ft=sh ts=4 sw=4 et:
|