easy-samba (v1.6.2 - English version)

This commit is contained in:
q3aql 2021-03-28 22:16:51 +02:00
parent 8178f1b515
commit 5e8d329fa1
3 changed files with 248 additions and 248 deletions

View File

@ -2,13 +2,13 @@
##############################################################
# Crear carpetas compartidas en Linux #
# U. Modificacion: 27-12-2018 #
# U. Modificacion: 28-03-2021 #
# Autor: q3aql #
# Contacto: q3aql@protonmail.ch #
# Licencia: GPL v2.0 #
##############################################################
VERSION="1.6.2"
M_DATE="271218"
M_DATE="280321"
# Parametros globales
linuxSambaFolder="/opt/easy-samba"
@ -29,7 +29,7 @@ function rootMessage() {
echo ""
echo "* easy-samba ${VERSION} (${M_DATE}) (GPL v2.0)"
echo ""
echo "* Son necesarios permisos de administrador"
echo "* Administrator permissions are required"
echo ""
exit
fi
@ -95,7 +95,7 @@ function extractFolder() {
# Funcion para crear enlace en el escritorio/home de los usuarios
# Sintaxis: createFolderLink [carpeta]
function createFolderLink() {
echo -n "* Deseas crear un enlace en el escritorio/home para los usuarios locales (s[*]/n): " ; read createLink
echo -n "* Do you want to create a link on the desktop/home for local users (y[*]/n): " ; read createLink
if [ "${createLink}" == "n" ] ; then
echo "nule" > /dev/null
else
@ -121,12 +121,12 @@ function createFolderLink() {
fi
done
if [ ${output} -eq 0 ] ; then
echo "* Enlaces creados correctamente!"
echo "* Links created successfully!"
else
echo "* Error: Fallo al crear los enlaces!"
echo "* Error: Failed to create links!"
fi
else
echo "* Usuarios no encontrados en ${homeUsers}"
echo "* Users not found in ${homeUsers}"
fi
fi
}
@ -134,7 +134,7 @@ function createFolderLink() {
# Funcion para borrar los enlaces en el escritorio/home de los usuarios
# Sintaxis: deleteFolderLink [carpeta]
function deleteFolderLink() {
echo -n "* Deseas borrar los enlaces en el escritorio/home de los usuarios locales (s[*]/n): " ; read deleteLink
echo -n "* Do you want to delete the links on the desktop/home of local users (y[*]/n): " ; read deleteLink
if [ "${deleteLink}" == "n" ] ; then
echo "nule" > /dev/null
else
@ -160,12 +160,12 @@ function deleteFolderLink() {
fi
done
if [ ${output} -eq 0 ] ; then
echo "* Enlaces borrados correctamente!"
echo "* Links deleted successfully!"
else
echo "* Error: Fallo al borrar los enlaces!"
echo "* Error: Failed to delete links!"
fi
else
echo "* Usuarios no encontrados en ${homeUsers}"
echo "* Users not found in ${homeUsers}"
fi
fi
}
@ -186,26 +186,26 @@ function fixHomePermissions() {
# Funcion para agregar una carpeta a Samba
function addNewFolder() {
echo ""
echo -n "* Introduce la ruta absoluta de la carpeta a agregar: " ; read folder
echo -n "* Enter the absolute path of the folder to add: " ; read folder
pathExtracted=$(extractFolder "${folder}")
endFolder=$(convertText "${pathExtracted}")
if [ -z "${folder}" ] ; then
echo "* Debes introducir la ruta absoluta de una carpeta!"
echo "* You must enter the absolute path of a folder!"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
elif [ -d "${folder}" ] ; then
if [ -d ${linuxSambaFolder}/${endFolder} ] ; then
echo "* Una carpeta con el mismo nombre ya se encuentra agregada o creada!"
echo "* A folder with the same name is already added or created!"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
else
fixHomePermissions "${folder}"
ln -s "${folder}" ${linuxSambaFolder}/${endFolder} 2> /dev/null
output=$?
if [ ${output} -ne 0 ] ; then
echo "* Error: Fallo al agregar la carpeta '${folder}'"
echo "* Error: Failed to add folder '${folder}'"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
else
echo "[${endFolder}]" >> ${sambaConfig}
echo "# Folder to ${linuxSambaFolder}/${endFolder} # 00bc00" >> ${sambaConfig}
@ -216,38 +216,38 @@ function addNewFolder() {
echo "read only = no" >> ${sambaConfig}
echo "guest ok = yes" >> ${sambaConfig}
echo "" >> ${sambaConfig}
echo "* Carpeta '${folder}' agregada con exito!"
echo "* Folder '${folder}' added successfully!"
createFolderLink ${endFolder}
fi
fi
else
echo "* La carpeta introducida no existe!"
echo "* The inserted folder does not exist!"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
fi
}
# Funcion para crear carpeta compartida con acceso para todos
function newFolderEveryone() {
echo ""
echo -n "* Introduce el nombre de la carpeta que deseas crear (sin acentos): " ; read folder
echo -n "* Enter the name of the folder you want to create (without accents): " ; read folder
formatText=$(convertText "${folder}")
folder=${formatText}
if [ -z ${folder} ] ; then
echo "* Debes introducir un nombre de carpeta!"
echo "* You must enter a folder name!"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
elif [ -d ${linuxSambaFolder}/${folder} ] ; then
echo "* La carpeta '${folder}' ya está creada, elige otro nombre"
echo "* The folder '${folder}' is already created, choose another name"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
else
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
output=$?
if [ ${output} -ne 0 ] ; then
echo "* Error: Fallo al crear la carpeta compartida '${folder}'"
echo "* Error: Failed to create shared folder '${folder}'"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
else
chmod 777 -R ${linuxSambaFolder}/${folder}
echo "[${folder}]" >> ${sambaConfig}
@ -259,7 +259,7 @@ function newFolderEveryone() {
echo "read only = no" >> ${sambaConfig}
echo "guest ok = yes" >> ${sambaConfig}
echo "" >> ${sambaConfig}
echo "* Carpeta compartida '${folder}' creada con exito!"
echo "* Shared folder '${folder}' created successfully!"
createFolderLink ${folder}
fi
fi
@ -268,24 +268,24 @@ function newFolderEveryone() {
# Funcion para crear carpeta compartida de solo lectura
function newFolderReadOnly() {
echo ""
echo -n "* Introduce el nombre de la carpeta que deseas crear (sin acentos): " ; read folder
echo -n "* Enter the name of the folder you want to create (without accents): " ; read folder
formatText=$(convertText "${folder}")
folder=${formatText}
if [ -z ${folder} ] ; then
echo "* Debes introducir un nombre de carpeta!"
echo "* You must enter a folder name!"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
elif [ -d ${linuxSambaFolder}/${folder} ] ; then
echo "* La carpeta '${folder}' ya está creada, elige otro nombre"
echo "* The folder '${folder}' is already created, choose another name"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
else
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
output=$?
if [ ${output} -ne 0 ] ; then
echo "* Error: Fallo al crear la carpeta compartida '${folder}'"
echo "* Error: Failed to create shared folder '${folder}'"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
else
chmod 777 -R ${linuxSambaFolder}/${folder}
echo "[${folder}]" >> ${sambaConfig}
@ -297,7 +297,7 @@ function newFolderReadOnly() {
echo "read only = yes" >> ${sambaConfig}
echo "guest ok = yes" >> ${sambaConfig}
echo "" >> ${sambaConfig}
echo "* Carpeta compartida '${folder}' (solo lectura) creada con exito!"
echo "* Shared folder '${folder}' (read only) created succesfully!"
createFolderLink ${folder}
fi
fi
@ -306,35 +306,35 @@ function newFolderReadOnly() {
# Crear carpeta compartida para un usuario
function newFolderForUser() {
echo ""
echo -n "* Introduce el nombre de la carpeta que deseas crear (sin acentos): " ; read folder
echo -n "* Enter the name of the folder you want to create (without accents): " ; read folder
formatText=$(convertText "${folder}")
folder=${formatText}
if [ -z ${folder} ] ; then
echo "* Debes introducir un nombre de carpeta!"
echo "* You must enter a folder name!"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
elif [ -d ${linuxSambaFolder}/${folder} ] ; then
echo "* La carpeta '${folder}' ya está creada, elige otro nombre"
echo "* The folder '${folder}' is already created, choose another name"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
else
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
output=$?
if [ ${output} -ne 0 ] ; then
echo "* Error: Fallo al crear la carpeta compartida '${folder}'"
echo "* Error: Failed to create shared folder '${folder}'"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
else
echo -n "* Introduce el nombre del usuario: " ; read forUser
echo -n "* Enter username: " ; read forUser
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}
echo "* No existe el usuario especificado!"
echo "* The specified user does not exist!"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
else
chmod 755 -R ${linuxSambaFolder}/${folder}
chown ${forUser} -R ${linuxSambaFolder}/${folder}
@ -347,7 +347,7 @@ function newFolderForUser() {
echo "read only = no" >> ${sambaConfig}
echo "guest ok = yes" >> ${sambaConfig}
echo "" >> ${sambaConfig}
echo "* Carpeta compartida '${folder}' (para ${forUser}) creada con exito!"
echo "* Shared folder '${folder}' (for ${forUser}) created successfully!"
createFolderLink ${folder}
fi
fi
@ -357,24 +357,24 @@ function newFolderForUser() {
# Crear carpeta compartida para imprimir
function newFolderPrintable() {
echo ""
echo -n "* Introduce el nombre de la carpeta que deseas crear (sin acentos): " ; read folder
echo -n "* Enter the name of the folder you want to create (without accents): " ; read folder
formatText=$(convertText "${folder}")
folder=${formatText}
if [ -z ${folder} ] ; then
echo "* Debes introducir un nombre de carpeta!"
echo "* You must enter a folder name!"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
elif [ -d ${linuxSambaFolder}/${folder} ] ; then
echo "* La carpeta '${folder}' ya está creada, elige otro nombre"
echo "* The folder '${folder}' is already created, choose another name"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
else
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
output=$?
if [ ${output} -ne 0 ] ; then
echo "* Error: Fallo al crear la carpeta compartida '${folder}'"
echo "* Error: Failed to create shared folder '${folder}'"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
else
chmod 777 -R ${linuxSambaFolder}/${folder}
echo "[${folder}]" >> ${sambaConfig}
@ -394,17 +394,17 @@ function newFolderPrintable() {
# Funcion para reiniciar el servicio de Samba
function restartSamba() {
echo -n "* Deseas reiniciar los servicios de Samba (s[*]/n): " ; read sambaSN
echo -n "* Do you want to restart the Samba services? (y[*]/n): " ; read sambaSN
if [ "${sambaSN}" == "n" ] ; then
echo "nule" > /dev/null
else
echo "* Reiniciando servicios de Samba"
echo "* Restarting Samba services"
sleep 3
/etc/init.d/samba restart &> /dev/null
systemctl restart smbd.service 2> /dev/null
systemctl restart nmbd.service 2> /dev/null
systemctl restart smb.service 2> /dev/null
echo "* Servicios de Samba reiniciados"
echo "* Samba services restarted"
echo ""
sleep 3
fi
@ -413,30 +413,30 @@ function restartSamba() {
# Funcion para todas borrar las carpetas compartidas
function restoreSmb() {
echo ""
echo "* Nota: Se van a eliminar todas las carpetas compartidas y su contenido!"
echo "* Importante: Se volvera al estado inicial del fichero 'smb.conf' antes de"
echo " de ejecutar 'easy-samba' por primera vez."
echo "* Note: All shared folders and their content will be deleted!"
echo "* Important: It will return to the initial state of the file"
echo " 'smb.conf' before executing 'easy-samba' for the first time."
echo ""
echo -n "* Deseas continuar (s/n[*]): " ; read deleteFolder
if [ "${deleteFolder}" == "s" ] ; then
echo "* Borrando carpetas..."
echo -n "* Do you want continue (y/n[*]): " ; read deleteFolder
if [ "${deleteFolder}" == "y" ] ; then
echo "* Deleting folders..."
sleep 2
rm -rf ${linuxSambaFolder}/* 2> /dev/null
output=$?
if [ ${output} -eq 0 ] ; then
echo "* Carpetas borradas con exito!"
echo "* Folders deleted successfully!"
cp -rf ${sambaBackup} ${sambaConfig} 2> /dev/null
#rm -rf ${sambaBackup} 2> /dev/null
restartSamba
else
echo "* Fallo al borrar las carpetas compartidas!"
echo "* Failed to delete shared folders!"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
fi
else
echo "* Se ha anulado el proceso de restauracion"
echo "* The restore process has been aborted"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
fi
}
@ -446,40 +446,40 @@ function viewFolders() {
cd ${linuxSambaFolder}
ls > ${sambaFoldersList}
echo ""
echo "* Lista de carpetas compartidas disponibles:"
echo "* List of available shared folders:"
echo ""
folderList=""
for folderDetected in $(cat ${sambaFoldersList}) ; do
echo " + ${folderDetected}"
done
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
else
echo ""
echo "* Actualmente no hay carpetas compartidas!"
echo "* There are currently no shared folders!"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
fi
}
# Funcion para borrar una carpeta compartida
function removeFolder() {
echo ""
echo -n "* Introduce el nombre de la carpeta que deseas borrar: " ; read folder
echo -n "* Enter the name of the folder you want to delete: " ; read folder
if [ -z ${folder} ] ; then
echo "* Debes introducir un nombre de carpeta!"
echo "* You must enter a folder name!"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
elif [ -d ${linuxSambaFolder}/${folder} ] ; then
echo "* Borrando carpeta '${folder}' ..."
echo "* Deleting folder '${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
echo "* La carpeta '${folder}' ha sido borrada pero no se ha encontrado en 'smb.conf'"
echo "* The folder '${folder}' has been deleted but not found in 'smb.conf'"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
else
initLine=$(expr ${readLine} - 1)
endLine=$(expr ${readLine} + 7)
@ -497,18 +497,18 @@ function removeFolder() {
count=$(expr ${count} + 1)
done
cp -rf /tmp/easy-samba/smb.conf ${sambaConfig}
echo "* La carpeta '${folder} ha sido borrada con exito!"
echo "* The folder '${folder} has been deleted successfully!"
deleteFolderLink ${folder}
restartSamba
fi
else
echo "* Error: No se ha podido borrar la carpeta '${folder}'"
echo "* Error: The folder '${folder}' could not be deleted"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
fi
else
echo "* Error: La carpeta '${folder}' no existe!"
echo -n "* Deseas ver un listado con las carpetas disponibles? (s[*]/n): " ; read available
echo "* Error: The folder '${folder}' does not exist!"
echo -n "* Do you want to see a list of the available folders? (y[*]/n): " ; read available
if [ "${available}" == "n" ] ; then
echo "nule" > /dev/null
else
@ -520,14 +520,14 @@ function removeFolder() {
# Funcion para mostrar el "acerca" del programa
function mostrarAcerca() {
echo ""
echo "* Acerca:"
echo "* About:"
echo ""
echo " - Software: easy-samba ${VERSION} (${M_DATE})"
echo " - Autor: q3aql"
echo " - Contacto: q3aql@protonmail.ch"
echo " - Licencia: GPL v2.0"
echo " - Author: q3aql"
echo " - Contact: q3aql@protonmail.ch"
echo " - License: GPL v2.0"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
}
# Mostrar menu con todas las opciones
@ -539,18 +539,18 @@ while [ ${mostrarMenu} -eq 0 ] ; do
echo ""
echo "* easy-samba ${VERSION} (${M_DATE})"
echo ""
echo " 1 - Agregar carpeta a Samba"
echo " 2 - Crear carpeta compartida"
echo " 3 - Crear carpeta compartida (solo lectura)"
echo " 4 - Crear carpeta compartida (para un usuario)"
echo " 5 - Crear carpeta compartida (printable)"
echo " 6 - Reiniciar servicios de Samba"
echo " 7 - Ver carpetas compartidas disponibles"
echo " 8 - Borrar carpeta compartida"
echo " 9 - Restaurar smb.conf"
echo " 10 - Acerca"
echo " 1 - Add folder to Samba"
echo " 2 - Create shared folder"
echo " 3 - Create shared folder (read only)"
echo " 4 - Create shared folder (for a user)"
echo " 5 - Create shared folder (printable)"
echo " 6 - Restart Samba services"
echo " 7 - View available shared folders"
echo " 8 - Delete shared folder"
echo " 9 - Restore smb.conf"
echo " 10 - About"
echo ""
echo " 11 - Salir"
echo " 11 - Exit"
echo ""
echo -n " * Elige una opcion: " ; read opcion
if [ "${opcion}" == "1" ] ; then
@ -582,13 +582,13 @@ while [ ${mostrarMenu} -eq 0 ] ; do
mostrarMenu=1
elif [ -z "${opcion}" ] ; then
echo ""
echo "* Debes elegir alguna opcion"
echo "* You must choose an option "
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
else
echo ""
echo "* Opcion no valida!"
echo "* Invalid option !"
echo ""
echo -n "* Pulsa INTRO para continuar... " ; read continue
echo -n "* Press ENTER to continue... " ; read continue
fi
done

View File

@ -2,13 +2,13 @@
##############################################################
# Crear carpetas compartidas en Linux (GTK) #
# U. Modificacion: 27-12-2018 #
# U. Modificacion: 28-03-2021 #
# Autor: q3aql #
# Contacto: q3aql@protonmail.ch #
# Licencia: GPL v2.0 #
##############################################################
VERSION="1.6.2 (GTK)"
M_DATE="271218"
M_DATE="280321"
# Parametros globales
linuxSambaFolder="/opt/easy-samba"
@ -26,11 +26,11 @@ 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})" --warning --width=340 --text "Administrator permissions are required"
echo ""
echo "* easy-samba-gtk ${VERSION} (${M_DATE}) (GPL v2.0)"
echo ""
echo "* Son necesarios permisos de administrador"
echo "* Administrator permissions are required"
echo ""
exit
fi
@ -74,7 +74,7 @@ function convertText() {
echo ${wordToConvert}
}
# Funcion para extraer el nombre de la carpeta de una ruta
# Funcion para extraer el nombre de The folder de una ruta
function extractFolder() {
pathToExtract="${1}/"
findFolder=0
@ -97,8 +97,8 @@ function extractFolder() {
# Sintaxis: createFolderLink [carpeta]
function createFolderLink() {
zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --cancel-label="No" --ok-label="Si" --width=530 \
--text "Deseas crear un enlace en el escritorio/home para los usuarios locales?"
zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --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
echo "nule" > /dev/null
@ -125,12 +125,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})" --info --width=280 --text "Links created successfully!"
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})" --error --width=280 --text "Error: Failed to create links!"
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})" --warning --width=310 --text "Users not found in ${homeUsers}"
fi
fi
}
@ -138,8 +138,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="Si" --width=530 \
--text "Deseas borrar los enlaces en el escritorio/home de los usuarios locales?"
zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --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
echo "nule" > /dev/null
@ -166,12 +166,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})" --info --width=280 --text "Links deleted successfully!"
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})" --error --width=290 --text "Error: Failed to delete links!"
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})" --warning --width=310 --text "Users not found in ${homeUsers}"
fi
fi
}
@ -191,20 +191,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})" --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 "Debes introducir la ruta absoluta de una carpeta!"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --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 "Una carpeta con el mismo nombre ya se encuentra agregada o creada!"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --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: Fallo al agregar la carpeta '${folder}'"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Failed to add folder '${folder}'"
else
echo "[${endFolder}]" >> ${sambaConfig}
echo "# Folder to ${linuxSambaFolder}/${endFolder} # 00bc00" >> ${sambaConfig}
@ -220,24 +220,24 @@ function addNewFolder() {
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})" --error --width=300 --text "The inserted folder does not exist!"
fi
}
# Funcion para crear carpeta compartida con acceso para todos
# Funcion para Create shared folder 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})" --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 "Debes introducir un nombre de carpeta!"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --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 "La carpeta '${folder}' ya esta creada, elige otro nombre"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --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: Fallo al crear la carpeta compartida '${folder}'"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Failed to create shared folder '${folder}'"
else
chmod 777 -R ${linuxSambaFolder}/${folder}
echo "[${folder}]" >> ${sambaConfig}
@ -249,26 +249,26 @@ 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})" --info --width=530 --text "Shared folder '${folder}' created sucessfully!"
createFolderLink ${folder}
fi
fi
}
# Funcion para crear carpeta compartida de solo lectura
# Funcion para Create shared folder 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})" --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 "Debes introducir un nombre de carpeta!"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --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 "La carpeta '${folder}' ya esta creada, elige otro nombre"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --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: Fallo al crear la carpeta compartida '${folder}'"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Failed to create shared folder '${folder}'"
else
chmod 777 -R ${linuxSambaFolder}/${folder}
echo "[${folder}]" >> ${sambaConfig}
@ -280,35 +280,35 @@ 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})" --info --width=530 --text "Shared folder '${folder}' (solo lectura) created sucessfully!"
createFolderLink ${folder}
fi
fi
}
# Crear carpeta compartida para un usuario
# Create shared folder 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})" --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 "Debes introducir un nombre de carpeta!"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --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 "La carpeta '${folder}' ya esta creada, elige otro nombre"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --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: Fallo al crear la carpeta compartida '${folder}'"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Failed to create shared folder '${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})" --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: No existe el usuario especificado!"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=330 --text "Error: The specified user does not exist!"
else
chmod 755 -R ${linuxSambaFolder}/${folder}
chown ${forUser} -R ${linuxSambaFolder}/${folder}
@ -321,27 +321,27 @@ 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})" --info --width=530 --text "Shared folder '${folder}' (para ${forUser}) created sucessfully!"
createFolderLink ${folder}
fi
fi
fi
}
# Crear carpeta compartida para imprimir
# Create shared folder 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})" --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 "Debes introducir un nombre de carpeta!"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --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 "La carpeta '${folder}' ya esta creada, elige otro nombre"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --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: Fallo al crear la carpeta compartida '${folder}'"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=520 --text "Error: Failed to create shared folder '${folder}'"
else
chmod 777 -R ${linuxSambaFolder}/${folder}
echo "[${folder}]" >> ${sambaConfig}
@ -353,7 +353,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})" --info --width=530 --text "Shared folder '${folder}' (printable) created sucessfully!"
createFolderLink ${folder}
fi
fi
@ -370,36 +370,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})" --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 "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})" --auto-close --text "Restarting Samba services"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --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="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\nde ejecutar 'easy-samba' por primera vez\n\nDeseas continuar?"
zenity --question --title "easy-samba ${VERSION} (${M_DATE})" --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 "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})" --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 "Carpetas borradas con exito!"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=350 --text "Folders deleted successfully!"
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})" --error --width=360 --text "Failed to delete shared folders"
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})" --warning --width=360 --text "The restore process has been aborted"
fi
}
@ -413,20 +413,20 @@ 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})
--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 "Nombre de carpeta: ${folder}\n\nRuta: ${linuxSambaFolder}/${folder}"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=350 --text "Folder name: ${folder}\n\nPath: ${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})" --error --width=400 --text "Error: The folder '${folder}' does not exist!"
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})" --info --width=370 --text "There are currently no shared folders!"
fi
}
# Funcion para borrar una carpeta compartida
# Funcion para borrar una Shared folder
function removeFolder() {
if [ "$(ls -A ${linuxSambaFolder})" ] ; then
cd ${linuxSambaFolder}
@ -436,17 +436,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})
--column "Select folder to delete:" ${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})" --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 "Borrando carpeta..."
sleep 2 | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --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 "La carpeta '${folder}' ha sido borrada pero no se ha encontrado en 'smb.conf'"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --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,25 +464,25 @@ 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})" --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: No se ha podido borrar la carpeta '${folder}'"
zenity --title "easy-samba ${VERSION} (${M_DATE})" --error --width=450 --text "Error: Could not delete folder '${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})" --error --width=400 --text "Error: The folder '${folder}' does not exist!"
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})" --info --width=350 --text "There are no folders available to delete!"
fi
}
# Funcion para mostrar el "acerca" del programa
function mostrarAcerca() {
zenity --title "Acerca" --info --width=330 \
--text "Software: easy-samba ${VERSION} (${M_DATE})\nAutor: q3aql\nContacto: q3aql@protonmail.ch\nLicencia: GPL v2.0"
# Funcion para mostrar el "About" del programa
function mostrarAbout() {
zenity --title "About" --info --width=330 \
--text "Software: easy-samba ${VERSION} (${M_DATE})\nAuthor: q3aql\nContact: q3aql@protonmail.ch\nLicense: GPL v2.0"
}
# Mostrar menu con todas las opciones
@ -492,39 +492,39 @@ 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
--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
addNewFolder
restartSamba
elif [ "${opcion}" == "Crear carpeta compartida" ] ; then
elif [ "${opcion}" == "Create shared folder" ] ; then
newFolderEveryone
restartSamba
elif [ "${opcion}" == "Crear carpeta compartida (solo lectura)" ] ; then
elif [ "${opcion}" == "Create shared folder (read only)" ] ; then
newFolderReadOnly
restartSamba
elif [ "${opcion}" == "Crear carpeta compartida (para un usuario)" ] ; then
elif [ "${opcion}" == "Create shared folder (for a user)" ] ; then
newFolderForUser
restartSamba
elif [ "${opcion}" == "Crear carpeta compartida (printable)" ] ; then
elif [ "${opcion}" == "Create shared folder (printable)" ] ; then
newFolderPrintable
restartSamba
elif [ "${opcion}" == "Reiniciar servicios de Samba" ] ; then
elif [ "${opcion}" == "Restart Samba services" ] ; then
restartSamba
elif [ "${opcion}" == "Ver carpetas compartidas disponibles" ] ; then
elif [ "${opcion}" == "View available shared folders" ] ; then
viewFolders
elif [ "${opcion}" == "Borrar carpeta compartida" ] ; then
elif [ "${opcion}" == "Delete shared folder" ] ; then
removeFolder
elif [ "${opcion}" == "Restaurar smb.conf" ] ; then
elif [ "${opcion}" == "Restore smb.conf" ] ; then
restoreSmb
elif [ "${opcion}" == "Acerca" ] ; then
mostrarAcerca
elif [ "${opcion}" == "Salir" ] ; then
elif [ "${opcion}" == "About" ] ; then
mostrarAbout
elif [ "${opcion}" == "Exit" ] ; 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})" --warning --width=300 --text "Choose one of the menu options"
fi
done

View File

@ -2,74 +2,74 @@
##############################################################
# Crear carpetas compartidas en Linux (GTK) #
# U. Modificacion: 27-12-2018 #
# U. Modificacion: 28-03-2021 #
# Autor: q3aql #
# Contacto: q3aql@protonmail.ch #
# Licencia: GPL v2.0 #
##############################################################
VERSION="1.6.2 (GTK)"
M_DATE="271218"
M_DATE="280321"
# Enlace con gksudo,gksu o bessu a easy-samba-gtk
function showRootMessage() {
if [ -f /usr/bin/gksudo ] ; then
gksudo /usr/bin/easy-samba-gtk
exit
elif [ -f /bin/gksudo ] ; then
gksudo /usr/bin/easy-samba-gtk
exit
elif [ -f /usr/bin/gksu ] ; then
gksu /usr/bin/easy-samba-gtk
exit
elif [ -f /bin/gksu ] ; then
gksu /usr/bin/easy-samba-gtk
exit
elif [ -f /usr/bin/beesu ] ; then
beesu /usr/bin/easy-samba-gtk
exit
elif [ -f /bin/beesu ] ; then
beesu /usr/bin/easy-samba-gtk
exit
elif [ -f /bin/sudo ] ; then
xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "sudo easy-samba-gtk"
exit
elif [ -f /usr/bin/sudo ] ; then
xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "sudo easy-samba-gtk"
exit
elif [ -f /usr/bin/su ] ; then
xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "su -c 'easy-samba-gtk'"
exit
elif [ -f /bin/su ] ; then
xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "su -c 'easy-samba-gtk'"
exit
else
zenity -h &> /dev/null
output=$?
if [ ${output} -eq 0 ] ; then
zenity --title "easy-samba ${VERSION} (${M_DATE})" --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"
fi
fi
if [ -f /usr/bin/gksudo ] ; then
gksudo /usr/bin/easy-samba-gtk
exit
elif [ -f /bin/gksudo ] ; then
gksudo /usr/bin/easy-samba-gtk
exit
elif [ -f /usr/bin/gksu ] ; then
gksu /usr/bin/easy-samba-gtk
exit
elif [ -f /bin/gksu ] ; then
gksu /usr/bin/easy-samba-gtk
exit
elif [ -f /usr/bin/beesu ] ; then
beesu /usr/bin/easy-samba-gtk
exit
elif [ -f /bin/beesu ] ; then
beesu /usr/bin/easy-samba-gtk
exit
elif [ -f /bin/sudo ] ; then
xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "sudo easy-samba-gtk"
exit
elif [ -f /usr/bin/sudo ] ; then
xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "sudo easy-samba-gtk"
exit
elif [ -f /usr/bin/su ] ; then
xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "su -c 'easy-samba-gtk'"
exit
elif [ -f /bin/su ] ; then
xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "su -c 'easy-samba-gtk'"
exit
else
zenity -h &> /dev/null
output=$?
if [ ${output} -eq 0 ] ; then
zenity --title "easy-samba ${VERSION} (${M_DATE})" --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"
fi
fi
}
# Funcion para mostrar mensaje de error
function errorMessage() {
echo ""
echo "* ATENCION!:"
echo ""
echo "* El programa 'easy-samba-gtk' no ha podido ser ejecutado como administrador"
echo ""
echo "* Porfavor, ejecuta el comando 'easy-samba-gtk' como usuario root en la terminal"
echo ""
echo -n "* Pulsa INTRO para salir... " ; read continue
exit
echo ""
echo "* ATTENTION!:"
echo ""
echo "* The 'easy-samba-gtk' program could not be run as administrator"
echo ""
echo "* Please run the command 'easy-samba-gtk' as root user in terminal"
echo ""
echo -n "* Press ENTER to exit... " ; read continue
exit
}
# Inicio del script
if [ "${1}" == "--error" ] ; then
errorMessage
errorMessage
else
showRootMessage
showRootMessage
fi