blob: 22031edb676876b2b777f2a69d6e76447621da95 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#!/bin/sh
2# Copyright 2010 Vertical Communications
3# Copyright 2012 OpenWrt.org
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8fsck_e2fsck() {
9 set -o pipefail
10 e2fsck -p "$device" 2>&1 | logger -t "fstab: e2fsck ($device)"
11 local status="$?"
12 set +o pipefail
13 case "$status" in
14 0|1) ;; #success
15 2) reboot;;
16 4) echo "e2fsck ($device): Warning! Uncorrected errors."| logger -t fstab
17 return 1
18 ;;
19 *) echo "e2fsck ($device): Error $status. Check not complete."| logger -t fstab;;
20 esac
21 return 0
22}
23
24fsck_ext2() {
25 fsck_e2fsck "$@"
26}
27
28fsck_ext3() {
29 fsck_e2fsck "$@"
30}
31
32fsck_ext4() {
33 fsck_e2fsck "$@"
34}
35
36append libmount_known_fsck "ext2"
37append libmount_known_fsck "ext3"
38append libmount_known_fsck "ext4"