busybox-initramfs: init: add support for CIFS mounts

Example usage:
 disk=CIFS=//192.168.1.1/share,user=name,password=secret
 disk=SMB=//192.168.1.1/public,user=guest

Note: comma's ',' are not allowed in
CIFS options (for example in usernames or passwords) because they are used
to separate options.
Note: SMB is an alias for CIFS, for people who are more used to that name.

Signed-off-by: Alain Kalker <a.c.kalker@gmail.com>
This commit is contained in:
Alain Kalker 2012-03-20 04:43:52 +01:00
parent b68c832489
commit 4f0052a875

View File

@ -128,6 +128,15 @@ NBD_DEVS="0"
[ "$ERR_ENV" -ne "0" ] && error "mount_common" "Could not mount $1"
}
mount_cifs() {
# Mount CIFS (Samba) share
CIFS_SHARE="${1%%,*}"
CIFS_OPTIONS="${1#*,}"
[ "$CIFS_OPTIONS" = "$1" ] && CIFS_OPTIONS=
mount_common "$CIFS_SHARE" "$2" "$3,$CIFS_OPTIONS" "cifs"
}
mount_nbd() {
# Mount NBD device
NBD_SERVER="${1%%:*}"
@ -160,6 +169,9 @@ NBD_DEVS="0"
MOUNT_CMD="mount_common"
MOUNT_TARGET="$1"
;;
CIFS=*|SMB=*)
MOUNT_CMD="mount_cifs"
;;
NBD=*)
MOUNT_CMD="mount_nbd"
;;