diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2014-05-06 12:36:57 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2014-05-06 12:37:21 +0200 |
commit | 498bfde15d0a9212ee3935bfe76076b7de69444c (patch) | |
tree | 455488bc596125568e9039dc552e4da4040cc825 | |
parent | e8d7893e45ad4f9ef306f11920ddee086c2c8897 (diff) |
fix automounting of usb sticks
-rw-r--r-- | package/base-files/Makefile | 4 | ||||
-rw-r--r-- | package/base-files/src/etc/fstab | 16 | ||||
-rw-r--r-- | package/base-files/src/etc/init.d/fs | 22 | ||||
-rw-r--r-- | package/base-files/src/etc/inittab | 2 | ||||
-rw-r--r-- | package/base-files/src/etc/mdev.conf | 1 | ||||
-rwxr-xr-x | package/base-files/src/etc/mdev/fs | 46 | ||||
-rw-r--r-- | package/ntfs-3g/files/ntfs3g.init | 13 |
7 files changed, 58 insertions, 46 deletions
diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 2b26175b8..9377f83d1 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/mk/rootfs.mk PKG_NAME:= base-files PKG_VERSION:= 1.0 -PKG_RELEASE:= 84 +PKG_RELEASE:= 85 PKG_SECTION:= base PKG_DESCR:= basic files and scripts @@ -51,7 +51,7 @@ ifneq (${ADK_PACKAGE_ZSH},) echo /bin/zsh >>${IDIR_BASE_FILES}/etc/shells endif mkdir -p $(IDIR_BASE_FILES)/etc/crontabs - mkdir -p $(IDIR_BASE_FILES)/{dev,boot,root,sys,proc,tmp,mnt} + mkdir -p $(IDIR_BASE_FILES)/{dev,boot,root,sys,proc,tmp,mnt,media} mkdir -p $(IDIR_BASE_FILES)/etc/network/{if-pre-up.d,if-up.d,if-down.d,if-post-down.d} mkdir -p $(IDIR_BASE_FILES)/usr/{lib,bin} chmod 600 $(IDIR_BASE_FILES)/etc/shadow diff --git a/package/base-files/src/etc/fstab b/package/base-files/src/etc/fstab index d5f900202..c34fe64f7 100644 --- a/package/base-files/src/etc/fstab +++ b/package/base-files/src/etc/fstab @@ -1,10 +1,10 @@ # /etc/fstab: static file system information. -# -# <file system> <mount pt> <type> <options> <dump> <pass> -proc /proc proc defaults 0 0 -devpts /dev/pts devpts defaults,gid=5,mode=620 0 0 -tmpfs /dev/shm tmpfs mode=0777 0 0 -tmpfs /tmp tmpfs mode=1777 0 0 -sysfs /sys sysfs defaults 0 0 +#<fs> <mount point> <type> <options> <dump> <pass> +proc /proc proc defaults 0 0 +devpts /dev/pts devpts defaults,gid=5,mode=620 0 0 +tmpfs /dev/shm tmpfs mode=0777 0 0 +tmpfs /tmp tmpfs mode=1777 0 0 +sysfs /sys sysfs defaults 0 0 +tmpfs /media tmpfs defaults 0 0 # example for cifs -#//192.168.1.1/music /music/test cifs ro,password=linux123,username=adk,iocharset=utf8,sec=ntlm 0 0 +#//192.168.1.1/music /music/test cifs ro,password=linux123,username=adk,iocharset=utf8,sec=ntlm 0 0 diff --git a/package/base-files/src/etc/init.d/fs b/package/base-files/src/etc/init.d/fs index c524a089f..cfa7d5689 100644 --- a/package/base-files/src/etc/init.d/fs +++ b/package/base-files/src/etc/init.d/fs @@ -8,26 +8,4 @@ # activate any logical volumes [ -x /usr/sbin/lvm ] && { lvm vgscan; lvm vgchange -ay; } -fstypes="ext2 ext3 ext4 xfs vfat" - -# 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 diff --git a/package/base-files/src/etc/inittab b/package/base-files/src/etc/inittab index e2ad18156..f1fd8b126 100644 --- a/package/base-files/src/etc/inittab +++ b/package/base-files/src/etc/inittab @@ -6,5 +6,5 @@ null::sysinit:/bin/mount -a -t devpts null::sysinit:/bin/mount -a -t tmpfs ::sysinit:/etc/init.d/rcS ::shutdown:/etc/init.d/rcK -null::shutdown:/bin/umount -a -t ext4 +null::shutdown:/bin/umount -a null::shutdown:/sbin/swapoff -a diff --git a/package/base-files/src/etc/mdev.conf b/package/base-files/src/etc/mdev.conf index 0a24ef04b..804a87d06 100644 --- a/package/base-files/src/etc/mdev.conf +++ b/package/base-files/src/etc/mdev.conf @@ -15,3 +15,4 @@ snd/controlC0 root:audio 660 snd/pcmC0D0c root:audio 660 snd/pcmC0D0p root:audio 660 msr0 root:root 660 @(mkdir -p /dev/cpu/0 && ln -sf /dev/msr0 /dev/cpu/0/msr) +sd[a-z][1-9] root:root 660 */etc/mdev/fs diff --git a/package/base-files/src/etc/mdev/fs b/package/base-files/src/etc/mdev/fs new file mode 100755 index 000000000..afbcaffff --- /dev/null +++ b/package/base-files/src/etc/mdev/fs @@ -0,0 +1,46 @@ +#!/bin/sh +fs=$(grep -v "^#" /etc/fstab | grep "^/dev/${MDEV}[[:blank:]]"|awk '{ print $3}') +mnt=$(grep -v "^#" /etc/fstab | grep "^/dev/${MDEV}[[:blank:]]"|awk '{ print $2}') +procfs=$fs +if [ $fs = "ntfs-3g" ];then + procfs=fuse +fi + +# fstab check +adk_check() { + grep -v "^#" /etc/fstab | grep -q "^/dev/${1}[[:blank:]]" + if [ $? -ne 0 ];then + logger -t fs -s "Disk ${1} not registered in /etc/fstab" + exit 1 + fi +} + +# filesystem check +adk_fsck() { + [ -x /usr/sbin/fsck.$2 ] && { + logger -t fs -s "Checking filesystem on ${1} with ${2}" + fsck -p -t ${2} ${1} + } +} + +# mount filesystem +adk_mount() { + mkdir -p $3 >/dev/null 2>&1 + grep $2 /proc/filesystems >/dev/null 2>&1 + if [ $? -eq 0 ];then + logger -t fs -s "Mounting /dev/${1} to $mnt" + mount $mnt + else + logger -t fs -s "Required filesystem $2 not available" + fi +} + +case "${ACTION}" in +add) + logger -t fs -s "Device ${MDEV} added to the system" + adk_check ${MDEV} + adk_fsck ${MDEV} $fs + adk_mount ${MDEV} $procfs $mnt + ;; +esac +exit 0 diff --git a/package/ntfs-3g/files/ntfs3g.init b/package/ntfs-3g/files/ntfs3g.init deleted file mode 100644 index 5f9164036..000000000 --- a/package/ntfs-3g/files/ntfs3g.init +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -#INIT 20 -[[ $1 = autostart ]] || exit 0 - -# mount ntfs-3g filesystems -grep fuse /proc/filesystems >/dev/null 2>&1 -if [ $? -eq 0 ];then - grep -v "^#" /etc/fstab |grep ntfs-3g >/dev/null 2>&1 - if [ $? -eq 0 ];then - mount -a -t ntfs-3g - fi -fi -exit 0 |