netmount: add nfs mount support

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2010-12-06 19:56:58 +01:00
parent 50019f8e26
commit f443527cb4
3 changed files with 23 additions and 25 deletions

View File

@ -1,18 +1,22 @@
# netmount.conf # netmount.conf
# #
# This configuration file allows you to setup network mounts via # This configuration file allows you to setup network mounts via
# CIFS (Samba) while the system is booting # CIFS (Samba) or NFS while the system is booting
# #
# This is an sample file, please rename or copy this file to # This is an sample file, please rename or copy this file to
# netmount.conf in the samba share "Configfiles" (or /storage/.config/) # netmount.conf in the samba share "Configfiles" (or /storage/.config/)
# #
# Usage: # Usage:
# service | share on server | local mountpoint | mount options # service | share on server | local mountpoint <| mount options>
# #
# - "service" can be "nfs" for NFS mounts or "cifs" for CIFS (Samba) mounts
# - Please use an "|" as delimiter # - Please use an "|" as delimiter
# - Don't use spaces in usernames, passwords and options # - Don't use spaces in usernames, passwords and options
# - for NFS mounts there is no support for options
# - be aware of the different syntax for NFS shares
# - Local mountpoints should only be on /storage # - Local mountpoints should only be on /storage
# #
# Examples: # Examples:
# cifs | //192.168.1.44/videos | /storage/mount/videos | username=user,password=secret # cifs | //192.168.1.44/videos | /storage/mount/videos | username=user,password=secret
# cifs | //192.168.1.44/tv shows | /storage/mount/tvshows | username=user,password=secret # cifs | //192.168.1.44/tv shows | /storage/mount/tvshows | username=user,password=secret
# nfs | 192.168.1.44:/videos | /storage/mount/videos

View File

@ -30,31 +30,25 @@
if [ -f $NETMOUNT_USERCONF ]; then if [ -f $NETMOUNT_USERCONF ]; then
progress "Mounting Network shares"
if [ -f /usr/bin/mount.cifs ]; then
IFS=" IFS="
" "
for i in `cat $NETMOUNT_USERCONF |grep -v "^#"`; do for i in `cat $NETMOUNT_USERCONF |grep -v "^#"`; do
SERVICE=`echo $i | awk -F\| '{print $1}' | sed 's/^[ \t]*//;s/[ \t]*$//'` SERVICE=`echo $i | awk -F\| '{print $1}' | sed 's/^[ \t]*//;s/[ \t]*$//'`
SHARE=`echo $i | awk -F\| '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//'` SHARE=`echo $i | awk -F\| '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//'`
MOUNTPOINT=`echo $i | awk -F\| '{print $3}' | sed 's/^[ \t]*//;s/[ \t]*$//'` MOUNTPOINT=`echo $i | awk -F\| '{print $3}' | sed 's/^[ \t]*//;s/[ \t]*$//'`
OPTIONS=`echo $i | awk -F\| '{print $4}' | sed 's/^[ \t]*//;s/[ \t]*$//'` OPTIONS=`echo $i | awk -F\| '{print $4}' | sed 's/^[ \t]*//;s/[ \t]*$//'`
progress "... mounting $SHARE to $MOUNTPOINT via $SERVICE ..."
progress "... mounting $SHARE to $MOUNTPOINT ..." mkdir -p $MOUNTPOINT
mkdir -p $MOUNTPOINT case "$SERVICE" in
cifs|smb|samba)
case "$SERVICE" in mount.cifs "$SHARE" "$MOUNTPOINT" "$OPTIONS" > /dev/null 2>&1
cifs|smb|samba) ;;
mount.cifs "$SHARE" "$MOUNTPOINT" -o "$OPTIONS" > /dev/null 2>&1 nfs)
;; mount.nfs "$SHARE" "$MOUNTPOINT" > /dev/null 2>&1
# nfs) ;;
# mount.nfs $SHARE $MOUNTPOINT -o $OPTIONS esac
# ;; done
esac
done
fi
fi fi

View File

@ -5,7 +5,7 @@ PKG_ARCH="any"
PKG_LICENSE="GPL" PKG_LICENSE="GPL"
PKG_SITE="http://www.openelec.tv" PKG_SITE="http://www.openelec.tv"
PKG_URL="" PKG_URL=""
PKG_DEPENDS="samba connman" PKG_DEPENDS="samba nfs-utils connman"
PKG_BUILD_DEPENDS="toolchain" PKG_BUILD_DEPENDS="toolchain"
PKG_PRIORITY="optional" PKG_PRIORITY="optional"
PKG_SECTION="tools" PKG_SECTION="tools"