diff options
author | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-11-01 12:21:16 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-11-01 12:21:28 +0100 |
commit | 1f72454eaa2db8da293679feac10396ce396fd1c (patch) | |
tree | aa878a27bb63e24064625aa3fab3cc6ef64cd3f8 /package/base-files | |
parent | f5e92fa1beae18fff0476616978a01326887550d (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')
-rw-r--r-- | package/base-files/Makefile | 2 | ||||
-rwxr-xr-x | package/base-files/src/etc/init.d/fs | 21 | ||||
-rwxr-xr-x | package/base-files/src/etc/init.d/kmod | 2 |
3 files changed, 18 insertions, 7 deletions
diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 9d932ac26..7d7df3366 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -6,7 +6,7 @@ include $(ADK_TOPDIR)/mk/rootfs.mk PKG_NAME:= base-files PKG_VERSION:= 1.1 -PKG_RELEASE:= 20 +PKG_RELEASE:= 21 PKG_SECTION:= base/apps PKG_DESCR:= basic files and scripts 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 |