#!/bin/sh echo "### global" cat << EOF [global] netbios name = $SAMBA_NETBIOS_NAME workgroup = $SAMBA_WORKGROUP server string = $SAMBA_SERVER_STRING syslog = 1 syslog only = yes encrypt passwords = true passdb backend = smbpasswd obey pam restrictions = yes socket options = TCP_NODELAY unix charset = ISO-8859-1 preferred master = $SAMBA_MASTER os level = $SAMBA_OS_LEVEL security = $SAMBA_SMBD_SECURITY guest account = $SAMBA_SYSTEMUSER username map = /mod/etc/samba/users.map EOF if [ -n "$SAMBA_INTERFACES" ]; then cat << EOF interfaces = $SAMBA_INTERFACES bind interfaces only = yes EOF fi echo "### expert" [ -r "/tmp/flash/samba/sharesx" ] && cat /tmp/flash/samba/sharesx echo "### default" if [ "$SAMBA_AVMSHARES" == "yes" ]; then for SHARE in /var/media/ftp/*; do if [ -d "$SHARE" ]; then SHORTNAME=$(basename "$SHARE" | sed s/-Partition-/-/) [ "$SHORTNAME" == "lost+found" ] && continue echo "[$SHORTNAME]" echo " path = $SHARE" echo " user = $SAMBA_SYSTEMUSER" echo " read only = $SAMBA_READONLY" [ -z "$SAMBA_PASS" ] && echo " guest ok = yes" fi done fi echo "### shares" if [ -r "/tmp/flash/samba/shares" ]; then cat /tmp/flash/samba/shares | grep -v "^#" | while read -r path name gk ro options comment; do if [ -n "$path" -a -n "$name" -a -d "$path" ]; then case $gk in 1|y|yes|Y|YES) gk="yes" ;; 0|n|no|N|NO|"") gk="no" ;; esac case $ro in 1|y|yes|Y|YES) ro="yes" ;; 0|n|no|N|NO|"") ro="no" ;; esac if [ "$options" != "-" ]; then options=$(echo "$options" | sed -r -e 's,=, = ,g;s,(%20| )+, ,g;') else options="" fi echo "$options" | grep -q "user =" >/dev/null 2>&1 || options="$options,user = $SAMBA_SYSTEMUSER" options=$(echo -e "${options//,/\\n }") cat << EOF [${name//%20/ }] comment = $comment path = $path guest ok = $gk read only = $ro $options EOF fi done fi echo "### fin"