block-mount: Reverting 26503. Was already fixed in a better way in commit 26474.
[openwrt/staging/yousong.git] / package / block-mount / files / fsck.sh
1 #!/bin/sh
2 # Copyright 2010 Vertical Communications
3 # This is free software, licensed under the GNU General Public License v2.
4 # See /LICENSE for more information.
5 #
6
7 libmount_fsck() {
8 local device="$1"
9 local fsck_fstype="$2"
10 local fsck_enabled="$3"
11 local known_type
12 local found_fsck=0
13
14
15 grep -q "$device" /proc/swaps || grep -q "$device" /proc/mounts || {
16 [ -e "$device" ] && [ "$fsck_enabled" -eq 1 ] && {
17 for known_type in $libmount_known_fsck; do
18 if [ "$known_type" = "$fsck_fstype" ]; then
19 fsck_${known_type} "$device"
20 found_fsck=1
21 break
22 fi
23 done
24 if [ "$found_fsck" -ne 1 ]; then
25 logger -t 'fstab' "Unable to check/repair $device; no known fsck for filesystem type $fstype"
26 fi
27 }
28 }
29 }
30
31 libmount_known_fsck=""
32
33 pi_include /lib/functions/fsck
34