diff --git a/src-ES/easy-samba b/src-ES/easy-samba index ba042ee..e1b37b7 100755 --- a/src-ES/easy-samba +++ b/src-ES/easy-samba @@ -2,13 +2,13 @@ ############################################################## # Crear carpetas compartidas en Linux # -# U. Modificacion: 28-03-2021 # +# U. Modificacion: 03-08-2021 # # Autor: q3aql # # Contacto: q3aql@protonmail.ch # # Licencia: GPL v2.0 # ############################################################## VERSION="1.6.2" -M_DATE="280321" +M_DATE="030821" # Parametros globales linuxSambaFolder="/opt/easy-samba" diff --git a/src-ES/easy-samba-gtk b/src-ES/easy-samba-gtk index 7e97cc9..58e2eba 100755 --- a/src-ES/easy-samba-gtk +++ b/src-ES/easy-samba-gtk @@ -2,13 +2,17 @@ ############################################################## # Crear carpetas compartidas en Linux (GTK) # -# U. Modificacion: 28-03-2021 # +# U. Modificacion: 03-08-2021 # # Autor: q3aql # # Contacto: q3aql@protonmail.ch # # Licencia: GPL v2.0 # ############################################################## VERSION="1.6.2 (GTK)" -M_DATE="280321" +M_DATE="030821" + +# Variables +iconPath="/usr/share/icons/easy-samba/easy-samba.png" +imagesPath="/usr/share/icons/easy-samba/img" # Parametros globales linuxSambaFolder="/opt/easy-samba" @@ -26,7 +30,7 @@ function rootMessage() { if [ ${administrador} -eq 0 ] ; then rm -rf /etc/root else - zenity --title "easy-samba-gtk ${VERSION} (${M_DATE})" --warning --width=340 --text "Son necesarios permisos de administrador" + zenity --title "easy-samba-gtk ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=340 --text "Son necesarios permisos de administrador" echo "" echo "* easy-samba-gtk ${VERSION} (${M_DATE}) (GPL v2.0)" echo "" @@ -97,7 +101,7 @@ function extractFolder() { # Sintaxis: createFolderLink [carpeta] function createFolderLink() { - zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --cancel-label="No" --ok-label="Si" --width=530 \ + zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --cancel-label="No" --ok-label="Si" --width=530 \ --text "Deseas crear un enlace en el escritorio/home para los usuarios locales?" createLink=$? if [ ${createLink} -eq 1 ] ; then @@ -125,12 +129,12 @@ function createFolderLink() { fi done if [ ${output} -eq 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=280 --text "Enlaces creados correctamente!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=280 --text "Enlaces creados correctamente!" else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=280 --text "Error: Fallo al crear los enlaces!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=280 --text "Error: Fallo al crear los enlaces!" fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=310 --text "Usuarios no encontrados en ${homeUsers}" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=310 --text "Usuarios no encontrados en ${homeUsers}" fi fi } @@ -138,7 +142,7 @@ function createFolderLink() { # Funcion para borrar los enlaces en el escritorio/home de los usuarios # Sintaxis: deleteFolderLink [carpeta] function deleteFolderLink() { - zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --cancel-label="No" --ok-label="Si" --width=530 \ + zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --cancel-label="No" --ok-label="Si" --width=530 \ --text "Deseas borrar los enlaces en el escritorio/home de los usuarios locales?" deleteLink=$? if [ ${deleteLink} -eq 1 ] ; then @@ -166,12 +170,12 @@ function deleteFolderLink() { fi done if [ ${output} -eq 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=280 --text "Enlaces borrados correctamente!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=280 --text "Enlaces borrados correctamente!" else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=290 --text "Error: Fallo al borrar los enlaces!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=290 --text "Error: Fallo al borrar los enlaces!" fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=310 --text "Usuarios no encontrados en ${homeUsers}" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=310 --text "Usuarios no encontrados en ${homeUsers}" fi fi } @@ -191,20 +195,20 @@ function fixHomePermissions() { # Funcion para agregar una carpeta a Samba function addNewFolder() { - folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --text "Introduce la ruta absoluta de la carpeta a agregar:") + folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --text "Introduce la ruta absoluta de la carpeta a agregar:") pathExtracted=$(extractFolder "${folder}") endFolder=$(convertText "${pathExtracted}") if [ -z ${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=410 --text "Debes introducir la ruta absoluta de una carpeta!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=410 --text "Debes introducir la ruta absoluta de una carpeta!" elif [ -d "${folder}" ] ; then if [ -d ${linuxSambaFolder}/${endFolder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=530 --text "Una carpeta con el mismo nombre ya se encuentra agregada o creada!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=530 --text "Una carpeta con el mismo nombre ya se encuentra agregada o creada!" else fixHomePermissions "${folder}" ln -s "${folder}" ${linuxSambaFolder}/${endFolder} 2> /dev/null output=$? if [ ${output} -ne 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Fallo al agregar la carpeta '${folder}'" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=520 --text "Error: Fallo al agregar la carpeta '${folder}'" else echo "[${endFolder}]" >> ${sambaConfig} echo "# Folder to ${linuxSambaFolder}/${endFolder} # 00bc00" >> ${sambaConfig} @@ -215,29 +219,29 @@ function addNewFolder() { echo "read only = no" >> ${sambaConfig} echo "guest ok = yes" >> ${sambaConfig} echo "" >> ${sambaConfig} - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=390 --text "Carpeta '${folder}' agregada con exito!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=390 --text "Carpeta '${folder}' agregada con exito!" createFolderLink ${endFolder} fi fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=300 --text "La carpeta introducida no existe!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=300 --text "La carpeta introducida no existe!" fi } # Funcion para crear carpeta compartida con acceso para todos function newFolderEveryone() { - folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --text "Introduce el nombre de la carpeta que deseas crear (sin acentos):") + folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --text "Introduce el nombre de la carpeta que deseas crear (sin acentos):") formatText=$(convertText "${folder}") folder=${formatText} if [ -z ${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=350 --text "Debes introducir un nombre de carpeta!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=350 --text "Debes introducir un nombre de carpeta!" elif [ -d ${linuxSambaFolder}/${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=530 --text "La carpeta '${folder}' ya esta creada, elige otro nombre" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=530 --text "La carpeta '${folder}' ya esta creada, elige otro nombre" else mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null output=$? if [ ${output} -ne 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Fallo al crear la carpeta compartida '${folder}'" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=520 --text "Error: Fallo al crear la carpeta compartida '${folder}'" else chmod 777 -R ${linuxSambaFolder}/${folder} echo "[${folder}]" >> ${sambaConfig} @@ -249,7 +253,7 @@ function newFolderEveryone() { echo "read only = no" >> ${sambaConfig} echo "guest ok = yes" >> ${sambaConfig} echo "" >> ${sambaConfig} - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=530 --text "Carpeta compartida '${folder}' creada con exito!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=530 --text "Carpeta compartida '${folder}' creada con exito!" createFolderLink ${folder} fi fi @@ -257,18 +261,18 @@ function newFolderEveryone() { # Funcion para crear carpeta compartida de solo lectura function newFolderReadOnly() { - folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --text "Introduce el nombre de la carpeta que deseas crear (sin acentos):") + folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --text "Introduce el nombre de la carpeta que deseas crear (sin acentos):") formatText=$(convertText "${folder}") folder=${formatText} if [ -z ${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=350 --text "Debes introducir un nombre de carpeta!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=350 --text "Debes introducir un nombre de carpeta!" elif [ -d ${linuxSambaFolder}/${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=530 --text "La carpeta '${folder}' ya esta creada, elige otro nombre" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=530 --text "La carpeta '${folder}' ya esta creada, elige otro nombre" else mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null output=$? if [ ${output} -ne 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Fallo al crear la carpeta compartida '${folder}'" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=520 --text "Error: Fallo al crear la carpeta compartida '${folder}'" else chmod 777 -R ${linuxSambaFolder}/${folder} echo "[${folder}]" >> ${sambaConfig} @@ -280,7 +284,7 @@ function newFolderReadOnly() { echo "read only = yes" >> ${sambaConfig} echo "guest ok = yes" >> ${sambaConfig} echo "" >> ${sambaConfig} - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=530 --text "Carpeta compartida '${folder}' (solo lectura) creada con exito!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=530 --text "Carpeta compartida '${folder}' (solo lectura) creada con exito!" createFolderLink ${folder} fi fi @@ -288,27 +292,27 @@ function newFolderReadOnly() { # Crear carpeta compartida para un usuario function newFolderForUser() { - folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --text "Introduce el nombre de la carpeta que deseas crear (sin acentos):") + folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --text "Introduce el nombre de la carpeta que deseas crear (sin acentos):") formatText=$(convertText "${folder}") folder=${formatText} if [ -z ${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=350 --text "Debes introducir un nombre de carpeta!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=350 --text "Debes introducir un nombre de carpeta!" elif [ -d ${linuxSambaFolder}/${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=530 --text "La carpeta '${folder}' ya esta creada, elige otro nombre" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=530 --text "La carpeta '${folder}' ya esta creada, elige otro nombre" else mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null output=$? if [ ${output} -ne 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Fallo al crear la carpeta compartida '${folder}'" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=520 --text "Error: Fallo al crear la carpeta compartida '${folder}'" else - forUser=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --text "Introduce el nombre del usuario:") + forUser=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --text "Introduce el nombre del usuario:") randomFolder=/tmp/easy-samba/${RANDOM}-${RANDOM} mkdir -p ${randomFolder} chown ${forUser} ${randomFolder} 2> /dev/null output=$? if [ ${output} -ne 0 ] ; then rm -rf ${linuxSambaFolder}/${folder} - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=330 --text "Error: No existe el usuario especificado!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=330 --text "Error: No existe el usuario especificado!" else chmod 755 -R ${linuxSambaFolder}/${folder} chown ${forUser} -R ${linuxSambaFolder}/${folder} @@ -321,7 +325,7 @@ function newFolderForUser() { echo "read only = no" >> ${sambaConfig} echo "guest ok = yes" >> ${sambaConfig} echo "" >> ${sambaConfig} - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=530 --text "Carpeta compartida '${folder}' (para ${forUser}) creada con exito!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=530 --text "Carpeta compartida '${folder}' (para ${forUser}) creada con exito!" createFolderLink ${folder} fi fi @@ -330,18 +334,18 @@ function newFolderForUser() { # Crear carpeta compartida para imprimir function newFolderPrintable() { - folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --text "Introduce el nombre de la carpeta que deseas crear (sin acentos):") + folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --text "Introduce el nombre de la carpeta que deseas crear (sin acentos):") formatText=$(convertText "${folder}") folder=${formatText} if [ -z ${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=350 --text "Debes introducir un nombre de carpeta!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=350 --text "Debes introducir un nombre de carpeta!" elif [ -d ${linuxSambaFolder}/${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=530 --text "La carpeta '${folder}' ya esta creada, elige otro nombre" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=530 --text "La carpeta '${folder}' ya esta creada, elige otro nombre" else mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null output=$? if [ ${output} -ne 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Fallo al crear la carpeta compartida '${folder}'" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=520 --text "Error: Fallo al crear la carpeta compartida '${folder}'" else chmod 777 -R ${linuxSambaFolder}/${folder} echo "[${folder}]" >> ${sambaConfig} @@ -353,7 +357,7 @@ function newFolderPrintable() { echo "printable = yes" >> ${sambaConfig} echo "guest ok = yes" >> ${sambaConfig} echo "" >> ${sambaConfig} - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=530 --text "Carpeta compartida '${folder}' (printable) creada con exito!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=530 --text "Carpeta compartida '${folder}' (printable) creada con exito!" createFolderLink ${folder} fi fi @@ -370,36 +374,36 @@ function reiniciandoSamba() { # Funcion para reiniciar el servicio de Samba function restartSamba() { - zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --cancel-label="No" --ok-label="Si" --width=320 --text "Deseas reiniciar los servicios de Samba?" + zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --cancel-label="No" --ok-label="Si" --width=320 --text "Deseas reiniciar los servicios de Samba?" sambaSN=$? if [ "${sambaSN}" == "1" ] ; then echo "nule" > /dev/null else - reiniciandoSamba | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --auto-close --text "Reiniciando servicios de Samba" - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=300 --text "Servicios de Samba reiniciados" + reiniciandoSamba | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --auto-close --text "Reiniciando servicios de Samba" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=300 --text "Servicios de Samba reiniciados" fi } # Funcion para borrar todas las carpetas compartidas function restoreSmb() { echo "" - zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --cancel-label="No" --ok-label="Si" --width=530 \ + zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --cancel-label="No" --ok-label="Si" --width=530 \ --text "Nota: Se van a eliminar todas las carpetas compartidas y su contenido\n\nImportante: Se volvera al estado inicial del fichero 'smb.conf' antes de\nejecutar 'easy-samba' por primera vez\n\nDeseas continuar?" deleteFolder=$? if [ ${deleteFolder} -eq 0 ] ; then - sleep 2 | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --auto-close --text "Borrando carpetas" - rm -rf ${linuxSambaFolder}/* | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --auto-close --text "Finalizando proceso de borrado" + sleep 2 | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --auto-close --text "Borrando carpetas" + rm -rf ${linuxSambaFolder}/* | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --auto-close --text "Finalizando proceso de borrado" output=$? if [ ${output} -eq 0 ] ; then cp -rf ${sambaBackup} ${sambaConfig} 2> /dev/null #rm -rf ${sambaBackup} 2> /dev/null - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=350 --text "Carpetas borradas con exito!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=350 --text "Carpetas borradas con exito!" restartSamba else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=360 --text "Error al borrar las carpetas compartidas" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=360 --text "Error al borrar las carpetas compartidas" fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=360 --text "Se ha anulado el proceso de restauracion" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=360 --text "Se ha anulado el proceso de restauracion" fi } @@ -413,16 +417,16 @@ function viewFolders() { folderList="${folderList} ${folderDetected}" done folder=$(zenity --width=390 --height=300 --list --title "easy-samba ${VERSION} ($M_DATE)" \ - --column "Lista de carpetas compartidas disponibles:" ${folderList}) + --window-icon=${iconPath} --column "Lista de carpetas compartidas disponibles:" ${folderList}) if [ -z ${folder} ] ; then echo "nule" > /dev/null elif [ -d ${linuxSambaFolder}/${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=350 --text "Nombre de carpeta: ${folder}\n\nRuta: ${linuxSambaFolder}/${folder}" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=350 --text "Nombre de carpeta: ${folder}\n\nRuta: ${linuxSambaFolder}/${folder}" else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=400 --text "Error: La carpeta '${folder}' no existe!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=400 --text "Error: La carpeta '${folder}' no existe!" fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=370 --text "Actualmente no hay carpetas compartidas!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=370 --text "Actualmente no hay carpetas compartidas!" fi } @@ -436,17 +440,17 @@ function removeFolder() { folderList="${folderList} ${folderDetected}" done folder=$(zenity --width=390 --height=300 --list --title "easy-samba ${VERSION} ($M_DATE)" \ - --column "Selecciona una carpeta para borrar:" ${folderList}) + --window-icon=${iconPath} --column "Selecciona una carpeta para borrar:" ${folderList}) if [ -z ${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=350 --text "Debes seleccionar una carpeta de la lista" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=350 --text "Debes seleccionar una carpeta de la lista" elif [ -d ${linuxSambaFolder}/${folder} ] ; then - sleep 2 | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --auto-close --text "Borrando carpeta..." + sleep 2 | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --auto-close --text "Borrando carpeta..." rm -rf ${linuxSambaFolder}/${folder} 2> /dev/null output=$? if [ ${output} -eq 0 ] ; then readLine=$(cat ${sambaConfig} | grep "# Folder to ${linuxSambaFolder}/${folder} # 00bc00" -n | cut -d ":" -f 1) if [ -z ${readLine} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=530 --text "La carpeta '${folder}' ha sido borrada pero no se ha encontrado en 'smb.conf'" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=530 --text "La carpeta '${folder}' ha sido borrada pero no se ha encontrado en 'smb.conf'" else initLine=$(expr ${readLine} - 1) endLine=$(expr ${readLine} + 7) @@ -464,24 +468,24 @@ function removeFolder() { count=$(expr ${count} + 1) done cp -rf /tmp/easy-samba/smb.conf ${sambaConfig} - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=460 --text "La carpeta '${folder}' ha sido borrada con exito!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=460 --text "La carpeta '${folder}' ha sido borrada con exito!" deleteFolderLink ${folder} restartSamba fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=450 --text "Error: No se ha podido borrar la carpeta '${folder}'" + 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})" --error --width=400 --text "Error: La carpeta '${folder}' no existe!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=400 --text "Error: La carpeta '${folder}' no existe!" fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=350 --text "No hay carpetas disponibles para borrar!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=350 --text "No hay carpetas disponibles para borrar!" fi } # Funcion para mostrar el "acerca" del programa function mostrarAcerca() { - zenity --title "Acerca" --info --width=330 \ + zenity --title "Acerca" --window-icon=${iconPath} --info --width=330 \ --text "Software: easy-samba ${VERSION} (${M_DATE})\nAutor: q3aql\nContacto: q3aql@protonmail.ch\nLicencia: GPL v2.0" } @@ -491,40 +495,45 @@ rootMessage backupSmbConf while [ ${mostrarMenu} -eq 0 ] ; do clear - opcion=$(zenity --width=390 --height=400 --list --title "easy-samba ${VERSION} ($M_DATE)" \ - --column "Selecciona una opcion:" "Agregar carpeta a Samba" "Crear carpeta compartida" \ - "Crear carpeta compartida (solo lectura)" "Crear carpeta compartida (para un usuario)" \ - "Crear carpeta compartida (printable)" "Reiniciar servicios de Samba" \ - "Ver carpetas compartidas disponibles" "Borrar carpeta compartida" "Restaurar smb.conf" \ - "Acerca" "Salir") - if [ "${opcion}" == "Agregar carpeta a Samba" ] ; then + opcion=$(zenity --width=380 --height=440 --list --title "easy-samba ${VERSION} ($M_DATE)" \ + --window-icon=${iconPath} --imagelist --column "Icono" --column "Opcion" \ + ${imagesPath}/add-folder-samba.png "Agregar carpeta a Samba" \ + ${imagesPath}/create-shared-folder.png "Crear carpeta compartida" \ + ${imagesPath}/create-shared-folder-read-only.png "Crear carpeta compartida (solo lectura)" \ + ${imagesPath}/create-shared-folder-user.png "Crear carpeta compartida (para un usuario)" \ + ${imagesPath}/create-shared-folder-printable.png "Crear carpeta compartida (printable)" \ + ${imagesPath}/restart-samba-services.png "Reiniciar servicios de Samba" \ + ${imagesPath}/view-shared-folders.png "Ver carpetas compartidas disponibles" ${imagesPath}/delete-shared-folder.png "Borrar carpeta compartida" \ + ${imagesPath}/restore-smb-conf.png "Restaurar smb.conf" ${imagesPath}/about.png "Acerca" \ + ${imagesPath}/exit.png "Salir") + if [ "${opcion}" == "${imagesPath}/add-folder-samba.png" ] ; then addNewFolder restartSamba - elif [ "${opcion}" == "Crear carpeta compartida" ] ; then + elif [ "${opcion}" == "${imagesPath}/create-shared-folder.png" ] ; then newFolderEveryone restartSamba - elif [ "${opcion}" == "Crear carpeta compartida (solo lectura)" ] ; then + elif [ "${opcion}" == "${imagesPath}/create-shared-folder-read-only.png" ] ; then newFolderReadOnly restartSamba - elif [ "${opcion}" == "Crear carpeta compartida (para un usuario)" ] ; then + elif [ "${opcion}" == "${imagesPath}/create-shared-folder-user.png" ] ; then newFolderForUser restartSamba - elif [ "${opcion}" == "Crear carpeta compartida (printable)" ] ; then + elif [ "${opcion}" == "${imagesPath}/create-shared-folder-printable.png" ] ; then newFolderPrintable restartSamba - elif [ "${opcion}" == "Reiniciar servicios de Samba" ] ; then + elif [ "${opcion}" == "${imagesPath}/restart-samba-services.png" ] ; then restartSamba - elif [ "${opcion}" == "Ver carpetas compartidas disponibles" ] ; then + elif [ "${opcion}" == "${imagesPath}/view-shared-folders.png" ] ; then viewFolders - elif [ "${opcion}" == "Borrar carpeta compartida" ] ; then + elif [ "${opcion}" == "${imagesPath}/delete-shared-folder.png" ] ; then removeFolder - elif [ "${opcion}" == "Restaurar smb.conf" ] ; then + elif [ "${opcion}" == "${imagesPath}/restore-smb-conf.png" ] ; then restoreSmb - elif [ "${opcion}" == "Acerca" ] ; then + elif [ "${opcion}" == "${imagesPath}/about.png" ] ; then mostrarAcerca - elif [ "${opcion}" == "Salir" ] ; then + elif [ "${opcion}" == "${imagesPath}/exit.png" ] ; then mostrarMenu=1 else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=300 --text "Elige una de las opciones del menu" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=300 --text "Elige una de las opciones del menu" fi done diff --git a/src-ES/easy-samba-gtk-admin b/src-ES/easy-samba-gtk-admin index 1687ef7..c3e0aa6 100755 --- a/src-ES/easy-samba-gtk-admin +++ b/src-ES/easy-samba-gtk-admin @@ -2,13 +2,16 @@ ############################################################## # Crear carpetas compartidas en Linux (GTK) # -# U. Modificacion: 28-03-2021 # +# U. Modificacion: 03-08-2021 # # Autor: q3aql # # Contacto: q3aql@protonmail.ch # # Licencia: GPL v2.0 # ############################################################## VERSION="1.6.2 (GTK)" -M_DATE="280321" +M_DATE="030821" + +# Variables +iconPath="/usr/share/icons/easy-samba/easy-samba.png" # Enlace con gksudo,gksu o bessu a easy-samba-gtk function showRootMessage() { @@ -46,7 +49,7 @@ function showRootMessage() { zenity -h &> /dev/null output=$? if [ ${output} -eq 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info \ + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --width 450 --info \ --text "El programa 'easy-samba-gtk' no ha podido ser ejecutado como administrador\n\nPorfavor, ejecuta el comando 'easy-samba-gtk' como usuario root en la terminal" else xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "easy-samba-gtk-admin --error" diff --git a/src/easy-samba b/src/easy-samba index a8d98df..da8326a 100755 --- a/src/easy-samba +++ b/src/easy-samba @@ -2,13 +2,13 @@ ############################################################## # Crear carpetas compartidas en Linux # -# U. Modificacion: 28-03-2021 # +# U. Modificacion: 03-08-2021 # # Autor: q3aql # # Contacto: q3aql@protonmail.ch # # Licencia: GPL v2.0 # ############################################################## VERSION="1.6.2" -M_DATE="280321" +M_DATE="030821" # Parametros globales linuxSambaFolder="/opt/easy-samba" diff --git a/src/easy-samba-gtk b/src/easy-samba-gtk index 02983e8..d40bc45 100755 --- a/src/easy-samba-gtk +++ b/src/easy-samba-gtk @@ -2,13 +2,17 @@ ############################################################## # Crear carpetas compartidas en Linux (GTK) # -# U. Modificacion: 28-03-2021 # +# U. Modificacion: 03-08-2021 # # Autor: q3aql # # Contacto: q3aql@protonmail.ch # # Licencia: GPL v2.0 # ############################################################## VERSION="1.6.2 (GTK)" -M_DATE="280321" +M_DATE="030821" + +# Variables +iconPath="/usr/share/icons/easy-samba/easy-samba.png" +imagesPath="/usr/share/icons/easy-samba/img" # Parametros globales linuxSambaFolder="/opt/easy-samba" @@ -26,7 +30,8 @@ function rootMessage() { if [ ${administrador} -eq 0 ] ; then rm -rf /etc/root else - zenity --title "easy-samba-gtk ${VERSION} (${M_DATE})" --warning --width=340 --text "Administrator permissions are required" + zenity --title "easy-samba-gtk ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=340 \ + --text "Administrator permissions are required" echo "" echo "* easy-samba-gtk ${VERSION} (${M_DATE}) (GPL v2.0)" echo "" @@ -97,7 +102,8 @@ function extractFolder() { # Sintaxis: createFolderLink [carpeta] function createFolderLink() { - zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --cancel-label="No" --ok-label="Yes" --width=530 \ + zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --cancel-label="No" \ + --ok-label="Yes" --width=530 \ --text "Do you want to create a link on the desktop/home for local users?" createLink=$? if [ ${createLink} -eq 1 ] ; then @@ -125,12 +131,12 @@ function createFolderLink() { fi done if [ ${output} -eq 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=280 --text "Links created successfully!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=280 --text "Links created successfully!" else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=280 --text "Error: Failed to create links!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=280 --text "Error: Failed to create links!" fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=310 --text "Users not found in ${homeUsers}" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=310 --text "Users not found in ${homeUsers}" fi fi } @@ -138,7 +144,8 @@ function createFolderLink() { # Funcion para borrar los enlaces en el escritorio/home de los usuarios # Sintaxis: deleteFolderLink [carpeta] function deleteFolderLink() { - zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --cancel-label="No" --ok-label="Yes" --width=530 \ + zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --cancel-label="No" \ + --ok-label="Yes" --width=530 \ --text "Do you want to delete the links on the desktop/home of the local users?" deleteLink=$? if [ ${deleteLink} -eq 1 ] ; then @@ -166,12 +173,12 @@ function deleteFolderLink() { fi done if [ ${output} -eq 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=280 --text "Links deleted successfully!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=280 --text "Links deleted successfully!" else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=290 --text "Error: Failed to delete links!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=290 --text "Error: Failed to delete links!" fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=310 --text "Users not found in ${homeUsers}" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=310 --text "Users not found in ${homeUsers}" fi fi } @@ -191,20 +198,20 @@ function fixHomePermissions() { # Funcion para agregar una carpeta a Samba function addNewFolder() { - folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --text "Enter the absolute path of the folder to add:") + folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --text "Enter the absolute path of the folder to add:") pathExtracted=$(extractFolder "${folder}") endFolder=$(convertText "${pathExtracted}") if [ -z ${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=410 --text "You must enter the absolute path of a folder!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=410 --text "You must enter the absolute path of a folder!" elif [ -d "${folder}" ] ; then if [ -d ${linuxSambaFolder}/${endFolder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=530 --text "A folder with the same name is already added or created!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=530 --text "A folder with the same name is already added or created!" else fixHomePermissions "${folder}" ln -s "${folder}" ${linuxSambaFolder}/${endFolder} 2> /dev/null output=$? if [ ${output} -ne 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Failed to add folder '${folder}'" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=520 --text "Error: Failed to add folder '${folder}'" else echo "[${endFolder}]" >> ${sambaConfig} echo "# Folder to ${linuxSambaFolder}/${endFolder} # 00bc00" >> ${sambaConfig} @@ -215,29 +222,29 @@ function addNewFolder() { echo "read only = no" >> ${sambaConfig} echo "guest ok = yes" >> ${sambaConfig} echo "" >> ${sambaConfig} - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=390 --text "Carpeta '${folder}' agregada con exito!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=390 --text "Carpeta '${folder}' agregada con exito!" createFolderLink ${endFolder} fi fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=300 --text "The inserted folder does not exist!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=300 --text "The inserted folder does not exist!" fi } # Funcion para Create shared folder con acceso para todos function newFolderEveryone() { - folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --text "Enter the name of the folder you want to create (without accents):") + folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --text "Enter the name of the folder you want to create (without accents):") formatText=$(convertText "${folder}") folder=${formatText} if [ -z ${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=350 --text "You must enter a folder name!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=350 --text "You must enter a folder name!" elif [ -d ${linuxSambaFolder}/${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=530 --text "The folder '${folder}' is already created, choose another name" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=530 --text "The folder '${folder}' is already created, choose another name" else mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null output=$? if [ ${output} -ne 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Failed to create shared folder '${folder}'" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=520 --text "Error: Failed to create shared folder '${folder}'" else chmod 777 -R ${linuxSambaFolder}/${folder} echo "[${folder}]" >> ${sambaConfig} @@ -257,18 +264,18 @@ function newFolderEveryone() { # Funcion para Create shared folder de solo lectura function newFolderReadOnly() { - folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --text "Enter the name of the folder you want to create (without accents):") + folder=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --text "Enter the name of the folder you want to create (without accents):") formatText=$(convertText "${folder}") folder=${formatText} if [ -z ${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=350 --text "You must enter a folder name!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=350 --text "You must enter a folder name!" elif [ -d ${linuxSambaFolder}/${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=530 --text "The folder '${folder}' is already created, choose another name" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=530 --text "The folder '${folder}' is already created, choose another name" else mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null output=$? if [ ${output} -ne 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Failed to create shared folder '${folder}'" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=520 --text "Error: Failed to create shared folder '${folder}'" else chmod 777 -R ${linuxSambaFolder}/${folder} echo "[${folder}]" >> ${sambaConfig} @@ -280,7 +287,7 @@ function newFolderReadOnly() { echo "read only = yes" >> ${sambaConfig} echo "guest ok = yes" >> ${sambaConfig} echo "" >> ${sambaConfig} - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=530 --text "Shared folder '${folder}' (solo lectura) created sucessfully!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=530 --text "Shared folder '${folder}' (solo lectura) created sucessfully!" createFolderLink ${folder} fi fi @@ -292,23 +299,23 @@ function newFolderForUser() { formatText=$(convertText "${folder}") folder=${formatText} if [ -z ${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=350 --text "You must enter a folder name!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=350 --text "You must enter a folder name!" elif [ -d ${linuxSambaFolder}/${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=530 --text "The folder '${folder}' is already created, choose another name" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=530 --text "The folder '${folder}' is already created, choose another name" else mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null output=$? if [ ${output} -ne 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Failed to create shared folder '${folder}'" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=520 --text "Error: Failed to create shared folder '${folder}'" else - forUser=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --text "Enter the username:") + forUser=$(zenity --entry --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --text "Enter the username:") randomFolder=/tmp/easy-samba/${RANDOM}-${RANDOM} mkdir -p ${randomFolder} chown ${forUser} ${randomFolder} 2> /dev/null output=$? if [ ${output} -ne 0 ] ; then rm -rf ${linuxSambaFolder}/${folder} - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=330 --text "Error: The specified user does not exist!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=330 --text "Error: The specified user does not exist!" else chmod 755 -R ${linuxSambaFolder}/${folder} chown ${forUser} -R ${linuxSambaFolder}/${folder} @@ -334,14 +341,14 @@ function newFolderPrintable() { formatText=$(convertText "${folder}") folder=${formatText} if [ -z ${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=350 --text "You must enter a folder name!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=350 --text "You must enter a folder name!" elif [ -d ${linuxSambaFolder}/${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=530 --text "The folder '${folder}' is already created, choose another name" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=530 --text "The folder '${folder}' is already created, choose another name" else mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null output=$? if [ ${output} -ne 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Failed to create shared folder '${folder}'" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=520 --text "Error: Failed to create shared folder '${folder}'" else chmod 777 -R ${linuxSambaFolder}/${folder} echo "[${folder}]" >> ${sambaConfig} @@ -353,7 +360,7 @@ function newFolderPrintable() { echo "printable = yes" >> ${sambaConfig} echo "guest ok = yes" >> ${sambaConfig} echo "" >> ${sambaConfig} - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=530 --text "Shared folder '${folder}' (printable) created sucessfully!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=530 --text "Shared folder '${folder}' (printable) created sucessfully!" createFolderLink ${folder} fi fi @@ -370,36 +377,36 @@ function reiniciandoSamba() { # Funcion para reiniciar el servicio de Samba function restartSamba() { - zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --cancel-label="No" --ok-label="Yes" --width=320 --text "Do you want to restart the Samba services?" + zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --cancel-label="No" --ok-label="Yes" --width=320 --text "Do you want to restart the Samba services?" sambaSN=$? if [ "${sambaSN}" == "1" ] ; then echo "nule" > /dev/null else - reiniciandoSamba | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --auto-close --text "Restarting Samba services" - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=300 --text "Samba services restarted" + reiniciandoSamba | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --auto-close --text "Restarting Samba services" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=300 --text "Samba services restarted" fi } # Funcion para borrar todas las carpetas compartidas function restoreSmb() { echo "" - zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --cancel-label="No" --ok-label="Yes" --width=530 \ + zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --cancel-label="No" --ok-label="Yes" --width=530 \ --text "Note: All shared folders and their content will be deleted \n\nImportant: It will return to the initial state of the file 'smb.conf' before\nexecuting 'easy-samba' for the first time\n\nDo you want continue?" deleteFolder=$? if [ ${deleteFolder} -eq 0 ] ; then - sleep 2 | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --auto-close --text "Deleting folders" + sleep 2 | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --auto-close --text "Deleting folders" rm -rf ${linuxSambaFolder}/* | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --auto-close --text "Finalizing the deletion process" output=$? if [ ${output} -eq 0 ] ; then cp -rf ${sambaBackup} ${sambaConfig} 2> /dev/null #rm -rf ${sambaBackup} 2> /dev/null - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=350 --text "Folders deleted successfully!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=350 --text "Folders deleted successfully!" restartSamba else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=360 --text "Failed to delete shared folders" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=360 --text "Failed to delete shared folders" fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=360 --text "The restore process has been aborted" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=360 --text "The restore process has been aborted" fi } @@ -413,16 +420,16 @@ function viewFolders() { folderList="${folderList} ${folderDetected}" done folder=$(zenity --width=390 --height=300 --list --title "easy-samba ${VERSION} ($M_DATE)" \ - --column "List of available shared folders:" ${folderList}) + --window-icon=${iconPath} --column "List of available shared folders:" ${folderList}) if [ -z ${folder} ] ; then echo "nule" > /dev/null elif [ -d ${linuxSambaFolder}/${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=350 --text "Folder name: ${folder}\n\nPath: ${linuxSambaFolder}/${folder}" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=350 --text "Folder name: ${folder}\n\nPath: ${linuxSambaFolder}/${folder}" else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=400 --text "Error: The folder '${folder}' does not exist!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=400 --text "Error: The folder '${folder}' does not exist!" fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=370 --text "There are currently no shared folders!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=370 --text "There are currently no shared folders!" fi } @@ -436,17 +443,17 @@ function removeFolder() { folderList="${folderList} ${folderDetected}" done folder=$(zenity --width=390 --height=300 --list --title "easy-samba ${VERSION} ($M_DATE)" \ - --column "Select folder to delete:" ${folderList}) + --window-icon=${iconPath} --column "Select folder to delete:" ${folderList}) if [ -z ${folder} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=350 --text "You must select a folder from the list" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=350 --text "You must select a folder from the list" elif [ -d ${linuxSambaFolder}/${folder} ] ; then - sleep 2 | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --auto-close --text "Deleting folder..." + sleep 2 | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --auto-close --text "Deleting folder..." rm -rf ${linuxSambaFolder}/${folder} 2> /dev/null output=$? if [ ${output} -eq 0 ] ; then readLine=$(cat ${sambaConfig} | grep "# Folder to ${linuxSambaFolder}/${folder} # 00bc00" -n | cut -d ":" -f 1) if [ -z ${readLine} ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=530 --text "The folder '${folder}' has been deleted but not found in 'smb.conf'" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=530 --text "The folder '${folder}' has been deleted but not found in 'smb.conf'" else initLine=$(expr ${readLine} - 1) endLine=$(expr ${readLine} + 7) @@ -464,24 +471,24 @@ function removeFolder() { count=$(expr ${count} + 1) done cp -rf /tmp/easy-samba/smb.conf ${sambaConfig} - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=460 --text "The folder '${folder}' has been deleted successfully!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=460 --text "The folder '${folder}' has been deleted successfully!" deleteFolderLink ${folder} restartSamba fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=450 --text "Error: Could not delete folder '${folder}'" + 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})" --error --width=400 --text "Error: The folder '${folder}' does not exist!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=400 --text "Error: The folder '${folder}' does not exist!" fi else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=350 --text "There are no folders available to delete!" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=350 --text "There are no folders available to delete!" fi } # Funcion para mostrar el "About" del programa function mostrarAbout() { - zenity --title "About" --info --width=330 \ + zenity --title "About" --window-icon=${iconPath} --info --width=330 \ --text "Software: easy-samba ${VERSION} (${M_DATE})\nAuthor: q3aql\nContact: q3aql@protonmail.ch\nLicense: GPL v2.0" } @@ -491,40 +498,42 @@ rootMessage backupSmbConf while [ ${mostrarMenu} -eq 0 ] ; do clear - opcion=$(zenity --width=390 --height=400 --list --title "easy-samba ${VERSION} ($M_DATE)" \ - --column "Select an option :" "Add folder to Samba" "Create shared folder" \ - "Create shared folder (read only)" "Create shared folder (for a user)" \ - "Create shared folder (printable)" "Restart Samba services" \ - "View available shared folders" "Delete shared folder" "Restore smb.conf" \ - "About" "Exit") - if [ "${opcion}" == "Add folder to Samba" ] ; then + opcion=$(zenity --width=350 --height=440 --list --title "easy-samba ${VERSION} ($M_DATE)" \ + --window-icon=${iconPath} --imagelist --column "Icon" --column "Option" ${imagesPath}/add-folder-samba.png "Add folder to Samba" \ + ${imagesPath}/create-shared-folder.png "Create shared folder" ${imagesPath}/create-shared-folder-read-only.png "Create shared folder (read only)" \ + ${imagesPath}/create-shared-folder-user.png "Create shared folder (for a user)" \ + ${imagesPath}/create-shared-folder-printable.png "Create shared folder (printable)" \ + ${imagesPath}/restart-samba-services.png "Restart Samba services" \ + ${imagesPath}/view-shared-folders.png "View available shared folders" ${imagesPath}/delete-shared-folder.png "Delete shared folder" ${imagesPath}/restore-smb-conf.png "Restore smb.conf" \ + ${imagesPath}/about.png "About" ${imagesPath}/exit.png "Exit") + if [ "${opcion}" == "${imagesPath}/add-folder-samba.png" ] ; then addNewFolder restartSamba - elif [ "${opcion}" == "Create shared folder" ] ; then + elif [ "${opcion}" == "${imagesPath}/create-shared-folder.png" ] ; then newFolderEveryone restartSamba - elif [ "${opcion}" == "Create shared folder (read only)" ] ; then + elif [ "${opcion}" == "${imagesPath}/create-shared-folder-read-only.png" ] ; then newFolderReadOnly restartSamba - elif [ "${opcion}" == "Create shared folder (for a user)" ] ; then + elif [ "${opcion}" == "${imagesPath}/create-shared-folder-user.png" ] ; then newFolderForUser restartSamba - elif [ "${opcion}" == "Create shared folder (printable)" ] ; then + elif [ "${opcion}" == "${imagesPath}/create-shared-folder-printable.png" ] ; then newFolderPrintable restartSamba - elif [ "${opcion}" == "Restart Samba services" ] ; then + elif [ "${opcion}" == "${imagesPath}/restart-samba-services.png" ] ; then restartSamba - elif [ "${opcion}" == "View available shared folders" ] ; then + elif [ "${opcion}" == "${imagesPath}/view-shared-folders.png" ] ; then viewFolders - elif [ "${opcion}" == "Delete shared folder" ] ; then + elif [ "${opcion}" == "${imagesPath}/delete-shared-folder.png" ] ; then removeFolder - elif [ "${opcion}" == "Restore smb.conf" ] ; then + elif [ "${opcion}" == "${imagesPath}/restore-smb-conf.png" ] ; then restoreSmb - elif [ "${opcion}" == "About" ] ; then + elif [ "${opcion}" == "${imagesPath}/about.png" ] ; then mostrarAbout - elif [ "${opcion}" == "Exit" ] ; then + elif [ "${opcion}" == "${imagesPath}/exit.png" ] ; then mostrarMenu=1 else - zenity --title "easy-samba ${VERSION} (${M_DATE})" --warning --width=300 --text "Choose one of the menu options" + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=300 --text "Choose one of the menu options" fi done diff --git a/src/easy-samba-gtk-admin b/src/easy-samba-gtk-admin index d7e3400..fe81d8f 100755 --- a/src/easy-samba-gtk-admin +++ b/src/easy-samba-gtk-admin @@ -2,13 +2,16 @@ ############################################################## # Crear carpetas compartidas en Linux (GTK) # -# U. Modificacion: 28-03-2021 # +# U. Modificacion: 03-08-2021 # # Autor: q3aql # # Contacto: q3aql@protonmail.ch # # Licencia: GPL v2.0 # ############################################################## VERSION="1.6.2 (GTK)" -M_DATE="280321" +M_DATE="030821" + +# Variables +iconPath="/usr/share/icons/easy-samba/easy-samba.png" # Enlace con gksudo,gksu o bessu a easy-samba-gtk function showRootMessage() { @@ -46,7 +49,7 @@ function showRootMessage() { zenity -h &> /dev/null output=$? if [ ${output} -eq 0 ] ; then - zenity --title "easy-samba ${VERSION} (${M_DATE})" --info \ + zenity --title "easy-samba ${VERSION} (${M_DATE})" --window-icon=${iconPath} --width 450 --info \ --text "The 'easy-samba-gtk' program could not be run as administrator\n\nPlease run the command 'easy-samba-gtk' as root user in terminal" else xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "easy-samba-gtk-admin --error"