diff --git a/src-ES/easy-samba-gtk b/src-ES/easy-samba-gtk index 58e2eba..ea58413 100755 --- a/src-ES/easy-samba-gtk +++ b/src-ES/easy-samba-gtk @@ -476,7 +476,32 @@ function removeFolder() { zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=450 --text "Error: No se ha podido borrar la carpeta '${folder}'" fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=400 --text "Error: La carpeta '${folder}' no existe!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=410 --text "Error: La carpeta '${folder}' no existe o el enlace esta roto!" + rm -rfv ${linuxSambaFolder}/${folder} + readLine=$(cat ${sambaConfig} | grep "# Folder to ${linuxSambaFolder}/${folder} # 00bc00" -n | cut -d ":" -f 1) + if [ -z ${readLine} ] ; then + echo "disabled" > /dev/null + else + initLine=$(expr ${readLine} - 1) + endLine=$(expr ${readLine} + 7) + totalLines=$(cat /etc/samba/smb.conf | wc -l) + count=1 + mkdir -p /tmp/easy-samba/ + echo > /tmp/easy-samba/smb.conf + while [ ${count} -lt $initLine ] ; do + cat /etc/samba/smb.conf | head -${count} | tail -1 >> /tmp/easy-samba/smb.conf + count=$(expr ${count} + 1) + done + count=$(expr ${endLine} + 1) + while [ ${count} -le ${totalLines} ] ; do + cat ${sambaConfig} | head -${count} | tail -1 >> /tmp/easy-samba/smb.conf + count=$(expr ${count} + 1) + done + cp -rf /tmp/easy-samba/smb.conf ${sambaConfig} + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=460 --text "La carpeta '${folder}' ha sido borrada del smb.conf!" + deleteFolderLink ${folder} + restartSamba + fi fi else zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=350 --text "No hay carpetas disponibles para borrar!" diff --git a/src/easy-samba-gtk b/src/easy-samba-gtk index d40bc45..c594d20 100755 --- a/src/easy-samba-gtk +++ b/src/easy-samba-gtk @@ -479,7 +479,32 @@ function removeFolder() { zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=450 --text "Error: Could not delete folder '${folder}'" fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=400 --text "Error: The folder '${folder}' does not exist!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=410 --text "Error: The folder '${folder}' does not exist or the link is broken!" + rm -rfv ${linuxSambaFolder}/${folder} + readLine=$(cat ${sambaConfig} | grep "# Folder to ${linuxSambaFolder}/${folder} # 00bc00" -n | cut -d ":" -f 1) + if [ -z ${readLine} ] ; then + echo "disabled" > /dev/null + else + initLine=$(expr ${readLine} - 1) + endLine=$(expr ${readLine} + 7) + totalLines=$(cat /etc/samba/smb.conf | wc -l) + count=1 + mkdir -p /tmp/easy-samba/ + echo > /tmp/easy-samba/smb.conf + while [ ${count} -lt $initLine ] ; do + cat /etc/samba/smb.conf | head -${count} | tail -1 >> /tmp/easy-samba/smb.conf + count=$(expr ${count} + 1) + done + count=$(expr ${endLine} + 1) + while [ ${count} -le ${totalLines} ] ; do + cat ${sambaConfig} | head -${count} | tail -1 >> /tmp/easy-samba/smb.conf + count=$(expr ${count} + 1) + done + cp -rf /tmp/easy-samba/smb.conf ${sambaConfig} + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=460 --text "The folder '${folder}' has been deleted from smb.conf!" + deleteFolderLink ${folder} + restartSamba + fi fi else zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=350 --text "There are no folders available to delete!"