diff --git a/packages/network/samba/scripts/samba-config b/packages/network/samba/scripts/samba-config index 63187d1fcc..914e9a134e 100755 --- a/packages/network/samba/scripts/samba-config +++ b/packages/network/samba/scripts/samba-config @@ -19,14 +19,12 @@ # http://www.gnu.org/copyleft/gpl.html ################################################################################ -. /etc/profile - SMB_USERCONF="/storage/.config/samba.conf" SMB_DEFCONF="/etc/samba/smb.conf" SMB_CONF="/run/samba/smb.conf" -if [ -f $CONFIG_CACHE/services/samba.conf ]; then - . $CONFIG_CACHE/services/samba.conf +if [ -f /storage/.cache/services/samba.conf ]; then + . /storage/.cache/services/samba.conf mkdir -p /run/samba if [ -f $SMB_USERCONF ]; then @@ -47,24 +45,12 @@ if [ -f $CONFIG_CACHE/services/samba.conf ]; then echo -e "$SAMBA_PASSWORD\n$SAMBA_PASSWORD" | smbpasswd -s -a root >/dev/null 2>&1 echo -e "nobody = root\nroot = $SAMBA_USERNAME" > /var/run/samba.map - # set public = no - sed -e 's|^.[ \t]*.public.=.*| public = no |' $SMB_CONF > $SMB_CONF.tmp && \ - mv $SMB_CONF.tmp $SMB_CONF - # remove username map (if any in userconfig) - sed -e 's|^.[ \t]*.username map.=.*||' $SMB_CONF > $SMB_CONF.tmp && \ - mv $SMB_CONF.tmp $SMB_CONF - # set security = share, add username map - sed -e 's|^.[ \t]*.security.=.*| security = user\n username map = /var/run/samba.map|' $SMB_CONF > $SMB_CONF.tmp && \ - mv $SMB_CONF.tmp $SMB_CONF + sed -e 's|^.[ \t]*.public.=.*| public = no |' -i $SMB_CONF + sed -e 's|^.[ \t]*.username map.=.*||' -i $SMB_CONF + sed -e 's|^.[ \t]*.security.=.*| security = user\n username map = /var/run/samba.map|' -i $SMB_CONF else - # set public = yes - sed -e 's|^.[ \t]*.public.=.*| public = yes |' $SMB_CONF > $SMB_CONF.tmp && \ - mv $SMB_CONF.tmp $SMB_CONF - # remove username map (if any in userconfig) - sed -e 's|^.[ \t]*.username map.=.*||' $SMB_CONF > $SMB_CONF.tmp && \ - mv $SMB_CONF.tmp $SMB_CONF - # set security = share - sed -e 's|^.[ \t]*.security.=.*| security = share|' $SMB_CONF > $SMB_CONF.tmp && \ - mv $SMB_CONF.tmp $SMB_CONF + sed -e 's|^.[ \t]*.public.=.*| public = yes |' -i $SMB_CONF + sed -e 's|^.[ \t]*.username map.=.*||' -i $SMB_CONF + sed -e 's|^.[ \t]*.security.=.*| security = share|' -i $SMB_CONF fi fi