#!/bin/sh # reads AVM's smbd settings CFGCTL=$(which usbcfgctl) if [ -z "$CFGCTL" ]; then CFGCTL=ar7cfgctl else # usbcfgctl needs environment [ -r /var/env.cache ] && . /var/env.cache fi MODLIBSAMBA_ENABLED="$(echo usbhost.samba_server_enabled | $CFGCTL -s)" # AVM moved with 04.86 "password" to usbhost.users section if cat /var/flash/usb.cfg 2>/dev/null \ | sed -n '/^usbhost {/,/^}/p' \ | sed -n '/^ *users {/,/^ *}/p' \ | grep -q "^ *password = \".*\";$" \ ; then password_location="usbhost.users.password" else password_location="usbhost.password" fi MODLIBSAMBA_PASSWORD="$(echo $password_location | $CFGCTL -s)" # AVM moved with 04.86 "readonly/local_write" to usbhost.acl_directories.access section if cat /var/flash/usb.cfg 2>/dev/null \ | sed -n '/^usbhost {/,/^}/p' \ | sed -n '/^ *acl_directories {/,/^ *}/p' \ | sed -n '/^ *access {/,/^ *}/p' \ | grep -q "^ *local_write = .*;$" \ ; then if [ "$(echo usbhost.acl_directories.access.local_write | $CFGCTL -s)" == "yes" ]; then MODLIBSAMBA_READONLY="no" else MODLIBSAMBA_READONLY="yes" fi else if [ "$(echo usbhost.readonly | $CFGCTL -s)" == "yes" ]; then MODLIBSAMBA_READONLY="yes" else MODLIBSAMBA_READONLY="no" fi fi