summaryrefslogtreecommitdiff
path: root/package/base-files/src/etc
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2016-11-01 12:21:16 +0100
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-11-01 12:21:28 +0100
commit1f72454eaa2db8da293679feac10396ce396fd1c (patch)
treeaa878a27bb63e24064625aa3fab3cc6ef64cd3f8 /package/base-files/src/etc
parentf5e92fa1beae18fff0476616978a01326887550d (diff)
base-files: fix a possible race condition when trying to mount usb sticks and the usb-storage is included in the kernel, problem reported by Oliver
Diffstat (limited to 'package/base-files/src/etc')
-rwxr-xr-xpackage/base-files/src/etc/init.d/fs21
-rwxr-xr-xpackage/base-files/src/etc/init.d/kmod2
2 files changed, 17 insertions, 6 deletions
diff --git a/package/base-files/src/etc/init.d/fs b/package/base-files/src/etc/init.d/fs
index 202854acc..0e6401351 100755
--- a/package/base-files/src/etc/init.d/fs
+++ b/package/base-files/src/etc/init.d/fs
@@ -1,5 +1,5 @@
#!/bin/sh
-#INIT 20
+#INIT 10
[[ $1 = autostart ]] || exit 0
# activate swap
@@ -21,11 +21,15 @@
# mount local filesystems
fstypes="ext2 ext3 ext4 xfs vfat ntfs ntfs-3g"
for fs in $fstypes; do
- disks=$(grep -v "^#" /etc/fstab|grep $fs|awk '{ print $1 }')
+ procfs=$fs
+ if [ $fs = "ntfs-3g" ];then
+ procfs=fuse
+ fi
+ disks=$(grep -v "^#" /etc/fstab|grep "${fs}[[:blank:]]"|awk '{ print $1 }')
for disk in $disks; do
logger -t 'Filesystem' "Found $disk with filesystem $fs"
mnt=$(grep -v "^#" /etc/fstab|grep "${disk}[[:blank:]]"|awk '{ print $2 }')
- grep $fs /proc/filesystems >/dev/null 2>&1
+ grep $procfs /proc/filesystems >/dev/null 2>&1
if [ $? -eq 0 ];then
[ -x /usr/sbin/fsck.$fs ] && {
logger -t 'Filesystem' "checking $fs filesystem on $disk"
@@ -33,9 +37,16 @@ for fs in $fstypes; do
}
logger -t 'Filesystem' "Mounting $disk to $mnt"
mkdir -p $mnt > /dev/null 2>&1
- mount $disk > /dev/null 2>&1
+ if [ -b $disk ]; then
+ mount $disk > /dev/null 2>&1
+ else
+ logger -s -t 'Filesystem' "Skipping mounting $disk, device file missing"
+ fi
+ if [ $? -ne 0 ];then
+ logger -s -t 'Filesystem' "Mounting $disk failed with $?"
+ fi
else
- logger -s -t 'Filesystem' "No $fs filesystem in kernel"
+ logger -s -t 'Filesystem' "No $procfs filesystem in kernel"
fi
done
done
diff --git a/package/base-files/src/etc/init.d/kmod b/package/base-files/src/etc/init.d/kmod
index 18aeedb42..509496a9e 100755
--- a/package/base-files/src/etc/init.d/kmod
+++ b/package/base-files/src/etc/init.d/kmod
@@ -1,5 +1,5 @@
#!/bin/sh
-#INIT 10
+#INIT 15
[[ $1 = autostart ]] || exit 0
. /etc/functions.sh