summaryrefslogtreecommitdiff
path: root/package/base-files/src/etc/init.d/fs
blob: e995422ee209b29e44ae2372188c9c32f19aab75 (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
#!/bin/sh
#INIT 20
[[ $1 = autostart ]] || exit 0

# activate swap
[ -x /sbin/swapon ] && { swapon -a; }

# activate any logical volumes
[ -x /usr/sbin/lvm ] && { lvm vgscan; lvm vgchange -ay; }

fstypes="ext2 ext3 ext4 xfs"

# filesystem checks
for fs in $fstypes; do
	[ -x /usr/sbin/fsck.$fs ] && {
		for i in $(grep -v "^#" /etc/fstab|grep $fs|awk '{ print $1}');do 
			echo "Checking filesystem on $i with $fs"
			fsck -p -t $fs $i
		done
	}
done

# mount local filesystems
for fs in $fstypes; do
	grep $fs /proc/filesystems >/dev/null 2>&1
	if [ $? -eq 0 ];then
		grep -v "^#" /etc/fstab |grep $fs >/dev/null 2>&1
		if [ $? -eq 0 ];then
			mount -a -t $fs
		fi
	fi
done
exit 0