summaryrefslogtreecommitdiff
path: root/package/base-files/src/etc/init.d/fs
blob: 8f4397897634441376050178846f9c55a96d234e (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/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; }

# filesystem checks
[ -x /sbin/fsck.ext2 ] && {
	for i in $(grep -v "^#" /etc/fstab|grep ext2|awk '{ print $1}');do fsck.ext2 $i;done;
}
[ -x /sbin/fsck.ext3 ] && {
	for i in $(grep -v "^#" /etc/fstab|grep ext3|awk '{ print $1}');do fsck.ext3 $i;done;
}
[ -x /sbin/fsck.ext4 ] && {
	for i in $(grep -v "^#" /etc/fstab|grep ext4|awk '{ print $1}');do fsck.ext4 $i;done;
}
[ -x /sbin/fsck.xfs ] && {
	for i in $(grep -v "^#" /etc/fstab|grep xfs|awk '{ print $1}');do xfs_repair $i;done;
}
# local filesystems
grep ext2 /proc/filesystems  >/dev/null 2>&1
if [ $? -eq 0 ];then
	grep -v "^#" /etc/fstab |grep ext2 >/dev/null 2>&1
	if [ $? -eq 0 ];then
		mount -a -t ext2
	fi
fi
grep ext3 /proc/filesystems  >/dev/null 2>&1
if [ $? -eq 0 ];then
	grep -v "^#" /etc/fstab |grep ext3 >/dev/null 2>&1
	if [ $? -eq 0 ];then
		mount -a -t ext3
	fi
fi
grep ext4 /proc/filesystems  >/dev/null 2>&1
if [ $? -eq 0 ];then
	grep -v "^#" /etc/fstab |grep ext4 >/dev/null 2>&1
	if [ $? -eq 0 ];then
		mount -a -t ext4
	fi
fi
grep xfs /proc/filesystems  >/dev/null 2>&1
if [ $? -eq 0 ];then
	grep -v "^#" /etc/fstab |grep xfs >/dev/null 2>&1
	if [ $? -eq 0 ];then
		mount -a -t xfs
	fi
fi
exit 0