source: trunk/package/e2fsprogs/files/e2fsck.sh @ 31377

Last change on this file since 31377 was 31377, checked in by jow, 5 years ago

[package] e2fsprogs: fix status reaping with fsck piped to logger, based on patch by Lukasz Golec-Biernat <mojedokumenty+openwrt@…>

File size: 784 bytes
Line 
1#!/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"
Note: See TracBrowser for help on using the repository browser.