diff options
Diffstat (limited to 'package/network/services/samba36/files/samba.hotplug')
-rw-r--r-- | package/network/services/samba36/files/samba.hotplug | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/package/network/services/samba36/files/samba.hotplug b/package/network/services/samba36/files/samba.hotplug deleted file mode 100644 index abb4346af0..0000000000 --- a/package/network/services/samba36/files/samba.hotplug +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh - -. /usr/share/libubox/jshn.sh - -device_get_vars() { - json_init - json_load "$(ubus call block info)" - - json_select devices || return 1 - - json_get_keys keys - for key in $keys - do - json_select $key - - json_get_var device device - [ "$device" = "$1" ] && { - shift - json_get_vars $@ - json_select .. - json_select .. - return 0 - } - - json_select .. - done - - json_select .. - - return 2 -} - -[ -f /var/run/config/samba ] || { - mkdir -p /var/run/config && touch /var/run/config/samba -} - -[ "$ACTION" = "add" ] && { - device_get_vars $DEVICE label mount || { - logger -t samba-hotplug "Failed to get $DEVICE info" - exit 1 - } - [ -n "$mount" ] && { - uci -c /var/run/config batch <<-EOF - set samba.$DEVICE="sambashare" - set samba.$DEVICE.name="$label" - set samba.$DEVICE.path="$mount" - set samba.$DEVICE.browseable="yes" - set samba.$DEVICE.read_only="yes" - set samba.$DEVICE.guest_ok="yes" - commit samba - EOF - /etc/init.d/samba reload - } -} - -[ "$ACTION" = "remove" ] && { - uci -c /var/run/config batch <<-EOF - delete samba.$DEVICE - commit samba - EOF - /etc/init.d/samba reload -} |