summaryrefslogtreecommitdiff
path: root/package/e2fsprogs/files/e2fsck.init
blob: e66750c910b8545382612e2ab8df24bc42d5a236 (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
#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org
# Vasilis Tsiligiannis <acinonyxs@yahoo.gr>

START=15

e2fsck() {
	local args
	local cfg="$1"

	config_get device "$cfg" device
	[ -b "$device" ] || return 0

	config_get fstype "$cfg" fstype
	case "$fstype" in
		ext2|ext3)
			/usr/sbin/e2fsck -p "$device"
			local status="$?"
			case "$status" in
				0|1) continue;;
				2) reboot;;
				4) echo "e2fsck ($device): Warning! Uncorrected errors.";;
				*) echo "e2fsck ($device): Error $status. Check not complete.";;
			esac
			;;
		*)
			;;
	esac
}

start() {
	config_load fstab
	config_foreach e2fsck mount
}