Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Place this file on /etc/hotplug.d/iface. Example entry (on /etc/config/fstab):
- #------------------------------------------------------------
- #config netmount
- # option target '/mnt'
- # option src '//ADDRESS/RESOURCE'
- # option fstype 'cifs' #or nfs
- ## don't use qoutes inside the string, else the qoutes, they will not be removed
- # option options 'user=USER,password=PASSWORD'
- # option enabled '1'
- # option network 'br-lan'
- #------------------------------------------------------------
- # Delete these comments if you want to preserve space on /overlay
- . /lib/functions.sh
- network_mount() {
- local config="$1"
- local enabled
- local target
- local src
- local options
- local network
- local fstype
- config_get_bool enabled "$config" enabled 0
- for opt in target src options network fstype
- do
- config_get "$opt" "$config" "$opt"
- done
- if [ "$enabled" = 1 -a "$INTERFACE" = "$network" ]
- then
- if [ "$ACTION" = "ifup" ]
- then
- logger "NetMount: $ACTION: Mounting $src in $target"
- mount -t $fstype $src $target -o "$options"
- elif [ "$ACTION" = "ifdown" ]
- then
- logger "NetMount: $ACTION: Umounting $src from $target"
- umount $target
- elif [ "$ACTION" = "ifupdate" ]
- then
- logger "NetMount: $ACTION: DHCP renew. Leaving $src mounted in $target"
- else
- logger "NetMount: Unknown action $ACTION: Leaving $src mounted in $target"
- fi
- fi
- }
- config_load fstab
- config_foreach network_mount netmount
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement