easy-samba (v1.6.2 - English version)
This commit is contained in:
parent
8178f1b515
commit
5e8d329fa1
208
src/easy-samba
208
src/easy-samba
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# Crear carpetas compartidas en Linux #
|
# Crear carpetas compartidas en Linux #
|
||||||
# U. Modificacion: 27-12-2018 #
|
# U. Modificacion: 28-03-2021 #
|
||||||
# Autor: q3aql #
|
# Autor: q3aql #
|
||||||
# Contacto: q3aql@protonmail.ch #
|
# Contacto: q3aql@protonmail.ch #
|
||||||
# Licencia: GPL v2.0 #
|
# Licencia: GPL v2.0 #
|
||||||
##############################################################
|
##############################################################
|
||||||
VERSION="1.6.2"
|
VERSION="1.6.2"
|
||||||
M_DATE="271218"
|
M_DATE="280321"
|
||||||
|
|
||||||
# Parametros globales
|
# Parametros globales
|
||||||
linuxSambaFolder="/opt/easy-samba"
|
linuxSambaFolder="/opt/easy-samba"
|
||||||
|
@ -29,7 +29,7 @@ function rootMessage() {
|
||||||
echo ""
|
echo ""
|
||||||
echo "* easy-samba ${VERSION} (${M_DATE}) (GPL v2.0)"
|
echo "* easy-samba ${VERSION} (${M_DATE}) (GPL v2.0)"
|
||||||
echo ""
|
echo ""
|
||||||
echo "* Son necesarios permisos de administrador"
|
echo "* Administrator permissions are required"
|
||||||
echo ""
|
echo ""
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -95,7 +95,7 @@ function extractFolder() {
|
||||||
# Funcion para crear enlace en el escritorio/home de los usuarios
|
# Funcion para crear enlace en el escritorio/home de los usuarios
|
||||||
# Sintaxis: createFolderLink [carpeta]
|
# Sintaxis: createFolderLink [carpeta]
|
||||||
function createFolderLink() {
|
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
|
if [ "${createLink}" == "n" ] ; then
|
||||||
echo "nule" > /dev/null
|
echo "nule" > /dev/null
|
||||||
else
|
else
|
||||||
|
@ -121,12 +121,12 @@ function createFolderLink() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ ${output} -eq 0 ] ; then
|
if [ ${output} -eq 0 ] ; then
|
||||||
echo "* Enlaces creados correctamente!"
|
echo "* Links created successfully!"
|
||||||
else
|
else
|
||||||
echo "* Error: Fallo al crear los enlaces!"
|
echo "* Error: Failed to create links!"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "* Usuarios no encontrados en ${homeUsers}"
|
echo "* Users not found in ${homeUsers}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ function createFolderLink() {
|
||||||
# Funcion para borrar los enlaces en el escritorio/home de los usuarios
|
# Funcion para borrar los enlaces en el escritorio/home de los usuarios
|
||||||
# Sintaxis: deleteFolderLink [carpeta]
|
# Sintaxis: deleteFolderLink [carpeta]
|
||||||
function deleteFolderLink() {
|
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
|
if [ "${deleteLink}" == "n" ] ; then
|
||||||
echo "nule" > /dev/null
|
echo "nule" > /dev/null
|
||||||
else
|
else
|
||||||
|
@ -160,12 +160,12 @@ function deleteFolderLink() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ ${output} -eq 0 ] ; then
|
if [ ${output} -eq 0 ] ; then
|
||||||
echo "* Enlaces borrados correctamente!"
|
echo "* Links deleted successfully!"
|
||||||
else
|
else
|
||||||
echo "* Error: Fallo al borrar los enlaces!"
|
echo "* Error: Failed to delete links!"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "* Usuarios no encontrados en ${homeUsers}"
|
echo "* Users not found in ${homeUsers}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -186,26 +186,26 @@ function fixHomePermissions() {
|
||||||
# Funcion para agregar una carpeta a Samba
|
# Funcion para agregar una carpeta a Samba
|
||||||
function addNewFolder() {
|
function addNewFolder() {
|
||||||
echo ""
|
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}")
|
pathExtracted=$(extractFolder "${folder}")
|
||||||
endFolder=$(convertText "${pathExtracted}")
|
endFolder=$(convertText "${pathExtracted}")
|
||||||
if [ -z "${folder}" ] ; then
|
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 ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
elif [ -d "${folder}" ] ; then
|
elif [ -d "${folder}" ] ; then
|
||||||
if [ -d ${linuxSambaFolder}/${endFolder} ] ; 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 ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
else
|
else
|
||||||
fixHomePermissions "${folder}"
|
fixHomePermissions "${folder}"
|
||||||
ln -s "${folder}" ${linuxSambaFolder}/${endFolder} 2> /dev/null
|
ln -s "${folder}" ${linuxSambaFolder}/${endFolder} 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -ne 0 ] ; then
|
if [ ${output} -ne 0 ] ; then
|
||||||
echo "* Error: Fallo al agregar la carpeta '${folder}'"
|
echo "* Error: Failed to add folder '${folder}'"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
else
|
else
|
||||||
echo "[${endFolder}]" >> ${sambaConfig}
|
echo "[${endFolder}]" >> ${sambaConfig}
|
||||||
echo "# Folder to ${linuxSambaFolder}/${endFolder} # 00bc00" >> ${sambaConfig}
|
echo "# Folder to ${linuxSambaFolder}/${endFolder} # 00bc00" >> ${sambaConfig}
|
||||||
|
@ -216,38 +216,38 @@ function addNewFolder() {
|
||||||
echo "read only = no" >> ${sambaConfig}
|
echo "read only = no" >> ${sambaConfig}
|
||||||
echo "guest ok = yes" >> ${sambaConfig}
|
echo "guest ok = yes" >> ${sambaConfig}
|
||||||
echo "" >> ${sambaConfig}
|
echo "" >> ${sambaConfig}
|
||||||
echo "* Carpeta '${folder}' agregada con exito!"
|
echo "* Folder '${folder}' added successfully!"
|
||||||
createFolderLink ${endFolder}
|
createFolderLink ${endFolder}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "* La carpeta introducida no existe!"
|
echo "* The inserted folder does not exist!"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funcion para crear carpeta compartida con acceso para todos
|
# Funcion para crear carpeta compartida con acceso para todos
|
||||||
function newFolderEveryone() {
|
function newFolderEveryone() {
|
||||||
echo ""
|
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}")
|
formatText=$(convertText "${folder}")
|
||||||
folder=${formatText}
|
folder=${formatText}
|
||||||
if [ -z ${folder} ] ; then
|
if [ -z ${folder} ] ; then
|
||||||
echo "* Debes introducir un nombre de carpeta!"
|
echo "* You must enter a folder name!"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
elif [ -d ${linuxSambaFolder}/${folder} ] ; then
|
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 ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
else
|
else
|
||||||
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -ne 0 ] ; then
|
if [ ${output} -ne 0 ] ; then
|
||||||
echo "* Error: Fallo al crear la carpeta compartida '${folder}'"
|
echo "* Error: Failed to create shared folder '${folder}'"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
else
|
else
|
||||||
chmod 777 -R ${linuxSambaFolder}/${folder}
|
chmod 777 -R ${linuxSambaFolder}/${folder}
|
||||||
echo "[${folder}]" >> ${sambaConfig}
|
echo "[${folder}]" >> ${sambaConfig}
|
||||||
|
@ -259,7 +259,7 @@ function newFolderEveryone() {
|
||||||
echo "read only = no" >> ${sambaConfig}
|
echo "read only = no" >> ${sambaConfig}
|
||||||
echo "guest ok = yes" >> ${sambaConfig}
|
echo "guest ok = yes" >> ${sambaConfig}
|
||||||
echo "" >> ${sambaConfig}
|
echo "" >> ${sambaConfig}
|
||||||
echo "* Carpeta compartida '${folder}' creada con exito!"
|
echo "* Shared folder '${folder}' created successfully!"
|
||||||
createFolderLink ${folder}
|
createFolderLink ${folder}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -268,24 +268,24 @@ function newFolderEveryone() {
|
||||||
# Funcion para crear carpeta compartida de solo lectura
|
# Funcion para crear carpeta compartida de solo lectura
|
||||||
function newFolderReadOnly() {
|
function newFolderReadOnly() {
|
||||||
echo ""
|
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}")
|
formatText=$(convertText "${folder}")
|
||||||
folder=${formatText}
|
folder=${formatText}
|
||||||
if [ -z ${folder} ] ; then
|
if [ -z ${folder} ] ; then
|
||||||
echo "* Debes introducir un nombre de carpeta!"
|
echo "* You must enter a folder name!"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
elif [ -d ${linuxSambaFolder}/${folder} ] ; then
|
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 ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
else
|
else
|
||||||
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -ne 0 ] ; then
|
if [ ${output} -ne 0 ] ; then
|
||||||
echo "* Error: Fallo al crear la carpeta compartida '${folder}'"
|
echo "* Error: Failed to create shared folder '${folder}'"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
else
|
else
|
||||||
chmod 777 -R ${linuxSambaFolder}/${folder}
|
chmod 777 -R ${linuxSambaFolder}/${folder}
|
||||||
echo "[${folder}]" >> ${sambaConfig}
|
echo "[${folder}]" >> ${sambaConfig}
|
||||||
|
@ -297,7 +297,7 @@ function newFolderReadOnly() {
|
||||||
echo "read only = yes" >> ${sambaConfig}
|
echo "read only = yes" >> ${sambaConfig}
|
||||||
echo "guest ok = yes" >> ${sambaConfig}
|
echo "guest ok = yes" >> ${sambaConfig}
|
||||||
echo "" >> ${sambaConfig}
|
echo "" >> ${sambaConfig}
|
||||||
echo "* Carpeta compartida '${folder}' (solo lectura) creada con exito!"
|
echo "* Shared folder '${folder}' (read only) created succesfully!"
|
||||||
createFolderLink ${folder}
|
createFolderLink ${folder}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -306,35 +306,35 @@ function newFolderReadOnly() {
|
||||||
# Crear carpeta compartida para un usuario
|
# Crear carpeta compartida para un usuario
|
||||||
function newFolderForUser() {
|
function newFolderForUser() {
|
||||||
echo ""
|
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}")
|
formatText=$(convertText "${folder}")
|
||||||
folder=${formatText}
|
folder=${formatText}
|
||||||
if [ -z ${folder} ] ; then
|
if [ -z ${folder} ] ; then
|
||||||
echo "* Debes introducir un nombre de carpeta!"
|
echo "* You must enter a folder name!"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
elif [ -d ${linuxSambaFolder}/${folder} ] ; then
|
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 ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
else
|
else
|
||||||
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -ne 0 ] ; then
|
if [ ${output} -ne 0 ] ; then
|
||||||
echo "* Error: Fallo al crear la carpeta compartida '${folder}'"
|
echo "* Error: Failed to create shared folder '${folder}'"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
else
|
else
|
||||||
echo -n "* Introduce el nombre del usuario: " ; read forUser
|
echo -n "* Enter username: " ; read forUser
|
||||||
randomFolder=/tmp/easy-samba/${RANDOM}-${RANDOM}
|
randomFolder=/tmp/easy-samba/${RANDOM}-${RANDOM}
|
||||||
mkdir -p ${randomFolder}
|
mkdir -p ${randomFolder}
|
||||||
chown ${forUser} ${randomFolder} 2> /dev/null
|
chown ${forUser} ${randomFolder} 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -ne 0 ] ; then
|
if [ ${output} -ne 0 ] ; then
|
||||||
rm -rf ${linuxSambaFolder}/${folder}
|
rm -rf ${linuxSambaFolder}/${folder}
|
||||||
echo "* No existe el usuario especificado!"
|
echo "* The specified user does not exist!"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
else
|
else
|
||||||
chmod 755 -R ${linuxSambaFolder}/${folder}
|
chmod 755 -R ${linuxSambaFolder}/${folder}
|
||||||
chown ${forUser} -R ${linuxSambaFolder}/${folder}
|
chown ${forUser} -R ${linuxSambaFolder}/${folder}
|
||||||
|
@ -347,7 +347,7 @@ function newFolderForUser() {
|
||||||
echo "read only = no" >> ${sambaConfig}
|
echo "read only = no" >> ${sambaConfig}
|
||||||
echo "guest ok = yes" >> ${sambaConfig}
|
echo "guest ok = yes" >> ${sambaConfig}
|
||||||
echo "" >> ${sambaConfig}
|
echo "" >> ${sambaConfig}
|
||||||
echo "* Carpeta compartida '${folder}' (para ${forUser}) creada con exito!"
|
echo "* Shared folder '${folder}' (for ${forUser}) created successfully!"
|
||||||
createFolderLink ${folder}
|
createFolderLink ${folder}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -357,24 +357,24 @@ function newFolderForUser() {
|
||||||
# Crear carpeta compartida para imprimir
|
# Crear carpeta compartida para imprimir
|
||||||
function newFolderPrintable() {
|
function newFolderPrintable() {
|
||||||
echo ""
|
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}")
|
formatText=$(convertText "${folder}")
|
||||||
folder=${formatText}
|
folder=${formatText}
|
||||||
if [ -z ${folder} ] ; then
|
if [ -z ${folder} ] ; then
|
||||||
echo "* Debes introducir un nombre de carpeta!"
|
echo "* You must enter a folder name!"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
elif [ -d ${linuxSambaFolder}/${folder} ] ; then
|
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 ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
else
|
else
|
||||||
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -ne 0 ] ; then
|
if [ ${output} -ne 0 ] ; then
|
||||||
echo "* Error: Fallo al crear la carpeta compartida '${folder}'"
|
echo "* Error: Failed to create shared folder '${folder}'"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
else
|
else
|
||||||
chmod 777 -R ${linuxSambaFolder}/${folder}
|
chmod 777 -R ${linuxSambaFolder}/${folder}
|
||||||
echo "[${folder}]" >> ${sambaConfig}
|
echo "[${folder}]" >> ${sambaConfig}
|
||||||
|
@ -394,17 +394,17 @@ function newFolderPrintable() {
|
||||||
|
|
||||||
# Funcion para reiniciar el servicio de Samba
|
# Funcion para reiniciar el servicio de Samba
|
||||||
function restartSamba() {
|
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
|
if [ "${sambaSN}" == "n" ] ; then
|
||||||
echo "nule" > /dev/null
|
echo "nule" > /dev/null
|
||||||
else
|
else
|
||||||
echo "* Reiniciando servicios de Samba"
|
echo "* Restarting Samba services"
|
||||||
sleep 3
|
sleep 3
|
||||||
/etc/init.d/samba restart &> /dev/null
|
/etc/init.d/samba restart &> /dev/null
|
||||||
systemctl restart smbd.service 2> /dev/null
|
systemctl restart smbd.service 2> /dev/null
|
||||||
systemctl restart nmbd.service 2> /dev/null
|
systemctl restart nmbd.service 2> /dev/null
|
||||||
systemctl restart smb.service 2> /dev/null
|
systemctl restart smb.service 2> /dev/null
|
||||||
echo "* Servicios de Samba reiniciados"
|
echo "* Samba services restarted"
|
||||||
echo ""
|
echo ""
|
||||||
sleep 3
|
sleep 3
|
||||||
fi
|
fi
|
||||||
|
@ -413,30 +413,30 @@ function restartSamba() {
|
||||||
# Funcion para todas borrar las carpetas compartidas
|
# Funcion para todas borrar las carpetas compartidas
|
||||||
function restoreSmb() {
|
function restoreSmb() {
|
||||||
echo ""
|
echo ""
|
||||||
echo "* Nota: Se van a eliminar todas las carpetas compartidas y su contenido!"
|
echo "* Note: All shared folders and their content will be deleted!"
|
||||||
echo "* Importante: Se volvera al estado inicial del fichero 'smb.conf' antes de"
|
echo "* Important: It will return to the initial state of the file"
|
||||||
echo " de ejecutar 'easy-samba' por primera vez."
|
echo " 'smb.conf' before executing 'easy-samba' for the first time."
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Deseas continuar (s/n[*]): " ; read deleteFolder
|
echo -n "* Do you want continue (y/n[*]): " ; read deleteFolder
|
||||||
if [ "${deleteFolder}" == "s" ] ; then
|
if [ "${deleteFolder}" == "y" ] ; then
|
||||||
echo "* Borrando carpetas..."
|
echo "* Deleting folders..."
|
||||||
sleep 2
|
sleep 2
|
||||||
rm -rf ${linuxSambaFolder}/* 2> /dev/null
|
rm -rf ${linuxSambaFolder}/* 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -eq 0 ] ; then
|
if [ ${output} -eq 0 ] ; then
|
||||||
echo "* Carpetas borradas con exito!"
|
echo "* Folders deleted successfully!"
|
||||||
cp -rf ${sambaBackup} ${sambaConfig} 2> /dev/null
|
cp -rf ${sambaBackup} ${sambaConfig} 2> /dev/null
|
||||||
#rm -rf ${sambaBackup} 2> /dev/null
|
#rm -rf ${sambaBackup} 2> /dev/null
|
||||||
restartSamba
|
restartSamba
|
||||||
else
|
else
|
||||||
echo "* Fallo al borrar las carpetas compartidas!"
|
echo "* Failed to delete shared folders!"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "* Se ha anulado el proceso de restauracion"
|
echo "* The restore process has been aborted"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,40 +446,40 @@ function viewFolders() {
|
||||||
cd ${linuxSambaFolder}
|
cd ${linuxSambaFolder}
|
||||||
ls > ${sambaFoldersList}
|
ls > ${sambaFoldersList}
|
||||||
echo ""
|
echo ""
|
||||||
echo "* Lista de carpetas compartidas disponibles:"
|
echo "* List of available shared folders:"
|
||||||
echo ""
|
echo ""
|
||||||
folderList=""
|
folderList=""
|
||||||
for folderDetected in $(cat ${sambaFoldersList}) ; do
|
for folderDetected in $(cat ${sambaFoldersList}) ; do
|
||||||
echo " + ${folderDetected}"
|
echo " + ${folderDetected}"
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
else
|
else
|
||||||
echo ""
|
echo ""
|
||||||
echo "* Actualmente no hay carpetas compartidas!"
|
echo "* There are currently no shared folders!"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funcion para borrar una carpeta compartida
|
# Funcion para borrar una carpeta compartida
|
||||||
function removeFolder() {
|
function removeFolder() {
|
||||||
echo ""
|
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
|
if [ -z ${folder} ] ; then
|
||||||
echo "* Debes introducir un nombre de carpeta!"
|
echo "* You must enter a folder name!"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
elif [ -d ${linuxSambaFolder}/${folder} ] ; then
|
elif [ -d ${linuxSambaFolder}/${folder} ] ; then
|
||||||
echo "* Borrando carpeta '${folder}' ..."
|
echo "* Deleting folder '${folder}' ..."
|
||||||
rm -rf ${linuxSambaFolder}/${folder} 2> /dev/null
|
rm -rf ${linuxSambaFolder}/${folder} 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -eq 0 ] ; then
|
if [ ${output} -eq 0 ] ; then
|
||||||
readLine=$(cat ${sambaConfig} | grep "# Folder to ${linuxSambaFolder}/${folder} # 00bc00" -n | cut -d ":" -f 1)
|
readLine=$(cat ${sambaConfig} | grep "# Folder to ${linuxSambaFolder}/${folder} # 00bc00" -n | cut -d ":" -f 1)
|
||||||
if [ -z ${readLine} ] ; then
|
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 ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
else
|
else
|
||||||
initLine=$(expr ${readLine} - 1)
|
initLine=$(expr ${readLine} - 1)
|
||||||
endLine=$(expr ${readLine} + 7)
|
endLine=$(expr ${readLine} + 7)
|
||||||
|
@ -497,18 +497,18 @@ function removeFolder() {
|
||||||
count=$(expr ${count} + 1)
|
count=$(expr ${count} + 1)
|
||||||
done
|
done
|
||||||
cp -rf /tmp/easy-samba/smb.conf ${sambaConfig}
|
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}
|
deleteFolderLink ${folder}
|
||||||
restartSamba
|
restartSamba
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "* Error: No se ha podido borrar la carpeta '${folder}'"
|
echo "* Error: The folder '${folder}' could not be deleted"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "* Error: La carpeta '${folder}' no existe!"
|
echo "* Error: The folder '${folder}' does not exist!"
|
||||||
echo -n "* Deseas ver un listado con las carpetas disponibles? (s[*]/n): " ; read available
|
echo -n "* Do you want to see a list of the available folders? (y[*]/n): " ; read available
|
||||||
if [ "${available}" == "n" ] ; then
|
if [ "${available}" == "n" ] ; then
|
||||||
echo "nule" > /dev/null
|
echo "nule" > /dev/null
|
||||||
else
|
else
|
||||||
|
@ -520,14 +520,14 @@ function removeFolder() {
|
||||||
# Funcion para mostrar el "acerca" del programa
|
# Funcion para mostrar el "acerca" del programa
|
||||||
function mostrarAcerca() {
|
function mostrarAcerca() {
|
||||||
echo ""
|
echo ""
|
||||||
echo "* Acerca:"
|
echo "* About:"
|
||||||
echo ""
|
echo ""
|
||||||
echo " - Software: easy-samba ${VERSION} (${M_DATE})"
|
echo " - Software: easy-samba ${VERSION} (${M_DATE})"
|
||||||
echo " - Autor: q3aql"
|
echo " - Author: q3aql"
|
||||||
echo " - Contacto: q3aql@protonmail.ch"
|
echo " - Contact: q3aql@protonmail.ch"
|
||||||
echo " - Licencia: GPL v2.0"
|
echo " - License: GPL v2.0"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
}
|
}
|
||||||
|
|
||||||
# Mostrar menu con todas las opciones
|
# Mostrar menu con todas las opciones
|
||||||
|
@ -539,18 +539,18 @@ while [ ${mostrarMenu} -eq 0 ] ; do
|
||||||
echo ""
|
echo ""
|
||||||
echo "* easy-samba ${VERSION} (${M_DATE})"
|
echo "* easy-samba ${VERSION} (${M_DATE})"
|
||||||
echo ""
|
echo ""
|
||||||
echo " 1 - Agregar carpeta a Samba"
|
echo " 1 - Add folder to Samba"
|
||||||
echo " 2 - Crear carpeta compartida"
|
echo " 2 - Create shared folder"
|
||||||
echo " 3 - Crear carpeta compartida (solo lectura)"
|
echo " 3 - Create shared folder (read only)"
|
||||||
echo " 4 - Crear carpeta compartida (para un usuario)"
|
echo " 4 - Create shared folder (for a user)"
|
||||||
echo " 5 - Crear carpeta compartida (printable)"
|
echo " 5 - Create shared folder (printable)"
|
||||||
echo " 6 - Reiniciar servicios de Samba"
|
echo " 6 - Restart Samba services"
|
||||||
echo " 7 - Ver carpetas compartidas disponibles"
|
echo " 7 - View available shared folders"
|
||||||
echo " 8 - Borrar carpeta compartida"
|
echo " 8 - Delete shared folder"
|
||||||
echo " 9 - Restaurar smb.conf"
|
echo " 9 - Restore smb.conf"
|
||||||
echo " 10 - Acerca"
|
echo " 10 - About"
|
||||||
echo ""
|
echo ""
|
||||||
echo " 11 - Salir"
|
echo " 11 - Exit"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n " * Elige una opcion: " ; read opcion
|
echo -n " * Elige una opcion: " ; read opcion
|
||||||
if [ "${opcion}" == "1" ] ; then
|
if [ "${opcion}" == "1" ] ; then
|
||||||
|
@ -582,13 +582,13 @@ while [ ${mostrarMenu} -eq 0 ] ; do
|
||||||
mostrarMenu=1
|
mostrarMenu=1
|
||||||
elif [ -z "${opcion}" ] ; then
|
elif [ -z "${opcion}" ] ; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "* Debes elegir alguna opcion"
|
echo "* You must choose an option "
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
else
|
else
|
||||||
echo ""
|
echo ""
|
||||||
echo "* Opcion no valida!"
|
echo "* Invalid option !"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para continuar... " ; read continue
|
echo -n "* Press ENTER to continue... " ; read continue
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# Crear carpetas compartidas en Linux (GTK) #
|
# Crear carpetas compartidas en Linux (GTK) #
|
||||||
# U. Modificacion: 27-12-2018 #
|
# U. Modificacion: 28-03-2021 #
|
||||||
# Autor: q3aql #
|
# Autor: q3aql #
|
||||||
# Contacto: q3aql@protonmail.ch #
|
# Contacto: q3aql@protonmail.ch #
|
||||||
# Licencia: GPL v2.0 #
|
# Licencia: GPL v2.0 #
|
||||||
##############################################################
|
##############################################################
|
||||||
VERSION="1.6.2 (GTK)"
|
VERSION="1.6.2 (GTK)"
|
||||||
M_DATE="271218"
|
M_DATE="280321"
|
||||||
|
|
||||||
# Parametros globales
|
# Parametros globales
|
||||||
linuxSambaFolder="/opt/easy-samba"
|
linuxSambaFolder="/opt/easy-samba"
|
||||||
|
@ -26,11 +26,11 @@ function rootMessage() {
|
||||||
if [ ${administrador} -eq 0 ] ; then
|
if [ ${administrador} -eq 0 ] ; then
|
||||||
rm -rf /etc/root
|
rm -rf /etc/root
|
||||||
else
|
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 ""
|
||||||
echo "* easy-samba-gtk ${VERSION} (${M_DATE}) (GPL v2.0)"
|
echo "* easy-samba-gtk ${VERSION} (${M_DATE}) (GPL v2.0)"
|
||||||
echo ""
|
echo ""
|
||||||
echo "* Son necesarios permisos de administrador"
|
echo "* Administrator permissions are required"
|
||||||
echo ""
|
echo ""
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -74,7 +74,7 @@ function convertText() {
|
||||||
echo ${wordToConvert}
|
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() {
|
function extractFolder() {
|
||||||
pathToExtract="${1}/"
|
pathToExtract="${1}/"
|
||||||
findFolder=0
|
findFolder=0
|
||||||
|
@ -97,8 +97,8 @@ function extractFolder() {
|
||||||
# Sintaxis: createFolderLink [carpeta]
|
# Sintaxis: createFolderLink [carpeta]
|
||||||
|
|
||||||
function createFolderLink() {
|
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})" --cancel-label="No" --ok-label="Yes" --width=530 \
|
||||||
--text "Deseas crear un enlace en el escritorio/home para los usuarios locales?"
|
--text "Do you want to create a link on the desktop/home for local users?"
|
||||||
createLink=$?
|
createLink=$?
|
||||||
if [ ${createLink} -eq 1 ] ; then
|
if [ ${createLink} -eq 1 ] ; then
|
||||||
echo "nule" > /dev/null
|
echo "nule" > /dev/null
|
||||||
|
@ -125,12 +125,12 @@ function createFolderLink() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ ${output} -eq 0 ] ; then
|
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
|
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
|
fi
|
||||||
else
|
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
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -138,8 +138,8 @@ function createFolderLink() {
|
||||||
# Funcion para borrar los enlaces en el escritorio/home de los usuarios
|
# Funcion para borrar los enlaces en el escritorio/home de los usuarios
|
||||||
# Sintaxis: deleteFolderLink [carpeta]
|
# Sintaxis: deleteFolderLink [carpeta]
|
||||||
function deleteFolderLink() {
|
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})" --cancel-label="No" --ok-label="Yes" --width=530 \
|
||||||
--text "Deseas borrar los enlaces en el escritorio/home de los usuarios locales?"
|
--text "Do you want to delete the links on the desktop/home of the local users?"
|
||||||
deleteLink=$?
|
deleteLink=$?
|
||||||
if [ ${deleteLink} -eq 1 ] ; then
|
if [ ${deleteLink} -eq 1 ] ; then
|
||||||
echo "nule" > /dev/null
|
echo "nule" > /dev/null
|
||||||
|
@ -166,12 +166,12 @@ function deleteFolderLink() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ ${output} -eq 0 ] ; then
|
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
|
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
|
fi
|
||||||
else
|
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
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -191,20 +191,20 @@ function fixHomePermissions() {
|
||||||
|
|
||||||
# Funcion para agregar una carpeta a Samba
|
# Funcion para agregar una carpeta a Samba
|
||||||
function addNewFolder() {
|
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}")
|
pathExtracted=$(extractFolder "${folder}")
|
||||||
endFolder=$(convertText "${pathExtracted}")
|
endFolder=$(convertText "${pathExtracted}")
|
||||||
if [ -z ${folder} ] ; then
|
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
|
elif [ -d "${folder}" ] ; then
|
||||||
if [ -d ${linuxSambaFolder}/${endFolder} ] ; 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
|
else
|
||||||
fixHomePermissions "${folder}"
|
fixHomePermissions "${folder}"
|
||||||
ln -s "${folder}" ${linuxSambaFolder}/${endFolder} 2> /dev/null
|
ln -s "${folder}" ${linuxSambaFolder}/${endFolder} 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -ne 0 ] ; then
|
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
|
else
|
||||||
echo "[${endFolder}]" >> ${sambaConfig}
|
echo "[${endFolder}]" >> ${sambaConfig}
|
||||||
echo "# Folder to ${linuxSambaFolder}/${endFolder} # 00bc00" >> ${sambaConfig}
|
echo "# Folder to ${linuxSambaFolder}/${endFolder} # 00bc00" >> ${sambaConfig}
|
||||||
|
@ -220,24 +220,24 @@ function addNewFolder() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funcion para crear carpeta compartida con acceso para todos
|
# Funcion para Create shared folder con acceso para todos
|
||||||
function newFolderEveryone() {
|
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}")
|
formatText=$(convertText "${folder}")
|
||||||
folder=${formatText}
|
folder=${formatText}
|
||||||
if [ -z ${folder} ] ; then
|
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
|
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
|
else
|
||||||
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -ne 0 ] ; then
|
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
|
else
|
||||||
chmod 777 -R ${linuxSambaFolder}/${folder}
|
chmod 777 -R ${linuxSambaFolder}/${folder}
|
||||||
echo "[${folder}]" >> ${sambaConfig}
|
echo "[${folder}]" >> ${sambaConfig}
|
||||||
|
@ -249,26 +249,26 @@ function newFolderEveryone() {
|
||||||
echo "read only = no" >> ${sambaConfig}
|
echo "read only = no" >> ${sambaConfig}
|
||||||
echo "guest ok = yes" >> ${sambaConfig}
|
echo "guest ok = yes" >> ${sambaConfig}
|
||||||
echo "" >> ${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}
|
createFolderLink ${folder}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funcion para crear carpeta compartida de solo lectura
|
# Funcion para Create shared folder de solo lectura
|
||||||
function newFolderReadOnly() {
|
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}")
|
formatText=$(convertText "${folder}")
|
||||||
folder=${formatText}
|
folder=${formatText}
|
||||||
if [ -z ${folder} ] ; then
|
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
|
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
|
else
|
||||||
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -ne 0 ] ; then
|
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
|
else
|
||||||
chmod 777 -R ${linuxSambaFolder}/${folder}
|
chmod 777 -R ${linuxSambaFolder}/${folder}
|
||||||
echo "[${folder}]" >> ${sambaConfig}
|
echo "[${folder}]" >> ${sambaConfig}
|
||||||
|
@ -280,35 +280,35 @@ function newFolderReadOnly() {
|
||||||
echo "read only = yes" >> ${sambaConfig}
|
echo "read only = yes" >> ${sambaConfig}
|
||||||
echo "guest ok = yes" >> ${sambaConfig}
|
echo "guest ok = yes" >> ${sambaConfig}
|
||||||
echo "" >> ${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}
|
createFolderLink ${folder}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Crear carpeta compartida para un usuario
|
# Create shared folder para un usuario
|
||||||
function newFolderForUser() {
|
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}")
|
formatText=$(convertText "${folder}")
|
||||||
folder=${formatText}
|
folder=${formatText}
|
||||||
if [ -z ${folder} ] ; then
|
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
|
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
|
else
|
||||||
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -ne 0 ] ; then
|
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
|
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}
|
randomFolder=/tmp/easy-samba/${RANDOM}-${RANDOM}
|
||||||
mkdir -p ${randomFolder}
|
mkdir -p ${randomFolder}
|
||||||
chown ${forUser} ${randomFolder} 2> /dev/null
|
chown ${forUser} ${randomFolder} 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -ne 0 ] ; then
|
if [ ${output} -ne 0 ] ; then
|
||||||
rm -rf ${linuxSambaFolder}/${folder}
|
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
|
else
|
||||||
chmod 755 -R ${linuxSambaFolder}/${folder}
|
chmod 755 -R ${linuxSambaFolder}/${folder}
|
||||||
chown ${forUser} -R ${linuxSambaFolder}/${folder}
|
chown ${forUser} -R ${linuxSambaFolder}/${folder}
|
||||||
|
@ -321,27 +321,27 @@ function newFolderForUser() {
|
||||||
echo "read only = no" >> ${sambaConfig}
|
echo "read only = no" >> ${sambaConfig}
|
||||||
echo "guest ok = yes" >> ${sambaConfig}
|
echo "guest ok = yes" >> ${sambaConfig}
|
||||||
echo "" >> ${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}
|
createFolderLink ${folder}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Crear carpeta compartida para imprimir
|
# Create shared folder para imprimir
|
||||||
function newFolderPrintable() {
|
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}")
|
formatText=$(convertText "${folder}")
|
||||||
folder=${formatText}
|
folder=${formatText}
|
||||||
if [ -z ${folder} ] ; then
|
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
|
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
|
else
|
||||||
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
mkdir -p ${linuxSambaFolder}/${folder} 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -ne 0 ] ; then
|
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
|
else
|
||||||
chmod 777 -R ${linuxSambaFolder}/${folder}
|
chmod 777 -R ${linuxSambaFolder}/${folder}
|
||||||
echo "[${folder}]" >> ${sambaConfig}
|
echo "[${folder}]" >> ${sambaConfig}
|
||||||
|
@ -353,7 +353,7 @@ function newFolderPrintable() {
|
||||||
echo "printable = yes" >> ${sambaConfig}
|
echo "printable = yes" >> ${sambaConfig}
|
||||||
echo "guest ok = yes" >> ${sambaConfig}
|
echo "guest ok = yes" >> ${sambaConfig}
|
||||||
echo "" >> ${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}
|
createFolderLink ${folder}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -370,36 +370,36 @@ function reiniciandoSamba() {
|
||||||
|
|
||||||
# Funcion para reiniciar el servicio de Samba
|
# Funcion para reiniciar el servicio de Samba
|
||||||
function restartSamba() {
|
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=$?
|
sambaSN=$?
|
||||||
if [ "${sambaSN}" == "1" ] ; then
|
if [ "${sambaSN}" == "1" ] ; then
|
||||||
echo "nule" > /dev/null
|
echo "nule" > /dev/null
|
||||||
else
|
else
|
||||||
reiniciandoSamba | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --auto-close --text "Reiniciando servicios de Samba"
|
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 "Servicios de Samba reiniciados"
|
zenity --title "easy-samba ${VERSION} (${M_DATE})" --info --width=300 --text "Samba services restarted"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funcion para borrar todas las carpetas compartidas
|
# Funcion para borrar todas las carpetas compartidas
|
||||||
function restoreSmb() {
|
function restoreSmb() {
|
||||||
echo ""
|
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})" --cancel-label="No" --ok-label="Yes" --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?"
|
--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=$?
|
deleteFolder=$?
|
||||||
if [ ${deleteFolder} -eq 0 ] ; then
|
if [ ${deleteFolder} -eq 0 ] ; then
|
||||||
sleep 2 | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --auto-close --text "Borrando carpetas"
|
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 "Finalizando proceso de borrado"
|
rm -rf ${linuxSambaFolder}/* | zenity --progress --pulsate --title "easy-samba ${VERSION} (${M_DATE})" --auto-close --text "Finalizing the deletion process"
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -eq 0 ] ; then
|
if [ ${output} -eq 0 ] ; then
|
||||||
cp -rf ${sambaBackup} ${sambaConfig} 2> /dev/null
|
cp -rf ${sambaBackup} ${sambaConfig} 2> /dev/null
|
||||||
#rm -rf ${sambaBackup} 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
|
restartSamba
|
||||||
else
|
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
|
fi
|
||||||
else
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,20 +413,20 @@ function viewFolders() {
|
||||||
folderList="${folderList} ${folderDetected}"
|
folderList="${folderList} ${folderDetected}"
|
||||||
done
|
done
|
||||||
folder=$(zenity --width=390 --height=300 --list --title "easy-samba ${VERSION} ($M_DATE)" \
|
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
|
if [ -z ${folder} ] ; then
|
||||||
echo "nule" > /dev/null
|
echo "nule" > /dev/null
|
||||||
elif [ -d ${linuxSambaFolder}/${folder} ] ; then
|
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
|
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
|
fi
|
||||||
else
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funcion para borrar una carpeta compartida
|
# Funcion para borrar una Shared folder
|
||||||
function removeFolder() {
|
function removeFolder() {
|
||||||
if [ "$(ls -A ${linuxSambaFolder})" ] ; then
|
if [ "$(ls -A ${linuxSambaFolder})" ] ; then
|
||||||
cd ${linuxSambaFolder}
|
cd ${linuxSambaFolder}
|
||||||
|
@ -436,17 +436,17 @@ function removeFolder() {
|
||||||
folderList="${folderList} ${folderDetected}"
|
folderList="${folderList} ${folderDetected}"
|
||||||
done
|
done
|
||||||
folder=$(zenity --width=390 --height=300 --list --title "easy-samba ${VERSION} ($M_DATE)" \
|
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
|
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
|
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
|
rm -rf ${linuxSambaFolder}/${folder} 2> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -eq 0 ] ; then
|
if [ ${output} -eq 0 ] ; then
|
||||||
readLine=$(cat ${sambaConfig} | grep "# Folder to ${linuxSambaFolder}/${folder} # 00bc00" -n | cut -d ":" -f 1)
|
readLine=$(cat ${sambaConfig} | grep "# Folder to ${linuxSambaFolder}/${folder} # 00bc00" -n | cut -d ":" -f 1)
|
||||||
if [ -z ${readLine} ] ; then
|
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
|
else
|
||||||
initLine=$(expr ${readLine} - 1)
|
initLine=$(expr ${readLine} - 1)
|
||||||
endLine=$(expr ${readLine} + 7)
|
endLine=$(expr ${readLine} + 7)
|
||||||
|
@ -464,25 +464,25 @@ function removeFolder() {
|
||||||
count=$(expr ${count} + 1)
|
count=$(expr ${count} + 1)
|
||||||
done
|
done
|
||||||
cp -rf /tmp/easy-samba/smb.conf ${sambaConfig}
|
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}
|
deleteFolderLink ${folder}
|
||||||
restartSamba
|
restartSamba
|
||||||
fi
|
fi
|
||||||
else
|
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
|
fi
|
||||||
else
|
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
|
fi
|
||||||
else
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funcion para mostrar el "acerca" del programa
|
# Funcion para mostrar el "About" del programa
|
||||||
function mostrarAcerca() {
|
function mostrarAbout() {
|
||||||
zenity --title "Acerca" --info --width=330 \
|
zenity --title "About" --info --width=330 \
|
||||||
--text "Software: easy-samba ${VERSION} (${M_DATE})\nAutor: q3aql\nContacto: q3aql@protonmail.ch\nLicencia: GPL v2.0"
|
--text "Software: easy-samba ${VERSION} (${M_DATE})\nAuthor: q3aql\nContact: q3aql@protonmail.ch\nLicense: GPL v2.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Mostrar menu con todas las opciones
|
# Mostrar menu con todas las opciones
|
||||||
|
@ -492,39 +492,39 @@ backupSmbConf
|
||||||
while [ ${mostrarMenu} -eq 0 ] ; do
|
while [ ${mostrarMenu} -eq 0 ] ; do
|
||||||
clear
|
clear
|
||||||
opcion=$(zenity --width=390 --height=400 --list --title "easy-samba ${VERSION} ($M_DATE)" \
|
opcion=$(zenity --width=390 --height=400 --list --title "easy-samba ${VERSION} ($M_DATE)" \
|
||||||
--column "Selecciona una opcion:" "Agregar carpeta a Samba" "Crear carpeta compartida" \
|
--column "Select an option :" "Add folder to Samba" "Create shared folder" \
|
||||||
"Crear carpeta compartida (solo lectura)" "Crear carpeta compartida (para un usuario)" \
|
"Create shared folder (read only)" "Create shared folder (for a user)" \
|
||||||
"Crear carpeta compartida (printable)" "Reiniciar servicios de Samba" \
|
"Create shared folder (printable)" "Restart Samba services" \
|
||||||
"Ver carpetas compartidas disponibles" "Borrar carpeta compartida" "Restaurar smb.conf" \
|
"View available shared folders" "Delete shared folder" "Restore smb.conf" \
|
||||||
"Acerca" "Salir")
|
"About" "Exit")
|
||||||
if [ "${opcion}" == "Agregar carpeta a Samba" ] ; then
|
if [ "${opcion}" == "Add folder to Samba" ] ; then
|
||||||
addNewFolder
|
addNewFolder
|
||||||
restartSamba
|
restartSamba
|
||||||
elif [ "${opcion}" == "Crear carpeta compartida" ] ; then
|
elif [ "${opcion}" == "Create shared folder" ] ; then
|
||||||
newFolderEveryone
|
newFolderEveryone
|
||||||
restartSamba
|
restartSamba
|
||||||
elif [ "${opcion}" == "Crear carpeta compartida (solo lectura)" ] ; then
|
elif [ "${opcion}" == "Create shared folder (read only)" ] ; then
|
||||||
newFolderReadOnly
|
newFolderReadOnly
|
||||||
restartSamba
|
restartSamba
|
||||||
elif [ "${opcion}" == "Crear carpeta compartida (para un usuario)" ] ; then
|
elif [ "${opcion}" == "Create shared folder (for a user)" ] ; then
|
||||||
newFolderForUser
|
newFolderForUser
|
||||||
restartSamba
|
restartSamba
|
||||||
elif [ "${opcion}" == "Crear carpeta compartida (printable)" ] ; then
|
elif [ "${opcion}" == "Create shared folder (printable)" ] ; then
|
||||||
newFolderPrintable
|
newFolderPrintable
|
||||||
restartSamba
|
restartSamba
|
||||||
elif [ "${opcion}" == "Reiniciar servicios de Samba" ] ; then
|
elif [ "${opcion}" == "Restart Samba services" ] ; then
|
||||||
restartSamba
|
restartSamba
|
||||||
elif [ "${opcion}" == "Ver carpetas compartidas disponibles" ] ; then
|
elif [ "${opcion}" == "View available shared folders" ] ; then
|
||||||
viewFolders
|
viewFolders
|
||||||
elif [ "${opcion}" == "Borrar carpeta compartida" ] ; then
|
elif [ "${opcion}" == "Delete shared folder" ] ; then
|
||||||
removeFolder
|
removeFolder
|
||||||
elif [ "${opcion}" == "Restaurar smb.conf" ] ; then
|
elif [ "${opcion}" == "Restore smb.conf" ] ; then
|
||||||
restoreSmb
|
restoreSmb
|
||||||
elif [ "${opcion}" == "Acerca" ] ; then
|
elif [ "${opcion}" == "About" ] ; then
|
||||||
mostrarAcerca
|
mostrarAbout
|
||||||
elif [ "${opcion}" == "Salir" ] ; then
|
elif [ "${opcion}" == "Exit" ] ; then
|
||||||
mostrarMenu=1
|
mostrarMenu=1
|
||||||
else
|
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
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -2,74 +2,74 @@
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# Crear carpetas compartidas en Linux (GTK) #
|
# Crear carpetas compartidas en Linux (GTK) #
|
||||||
# U. Modificacion: 27-12-2018 #
|
# U. Modificacion: 28-03-2021 #
|
||||||
# Autor: q3aql #
|
# Autor: q3aql #
|
||||||
# Contacto: q3aql@protonmail.ch #
|
# Contacto: q3aql@protonmail.ch #
|
||||||
# Licencia: GPL v2.0 #
|
# Licencia: GPL v2.0 #
|
||||||
##############################################################
|
##############################################################
|
||||||
VERSION="1.6.2 (GTK)"
|
VERSION="1.6.2 (GTK)"
|
||||||
M_DATE="271218"
|
M_DATE="280321"
|
||||||
|
|
||||||
# Enlace con gksudo,gksu o bessu a easy-samba-gtk
|
# Enlace con gksudo,gksu o bessu a easy-samba-gtk
|
||||||
function showRootMessage() {
|
function showRootMessage() {
|
||||||
if [ -f /usr/bin/gksudo ] ; then
|
if [ -f /usr/bin/gksudo ] ; then
|
||||||
gksudo /usr/bin/easy-samba-gtk
|
gksudo /usr/bin/easy-samba-gtk
|
||||||
exit
|
exit
|
||||||
elif [ -f /bin/gksudo ] ; then
|
elif [ -f /bin/gksudo ] ; then
|
||||||
gksudo /usr/bin/easy-samba-gtk
|
gksudo /usr/bin/easy-samba-gtk
|
||||||
exit
|
exit
|
||||||
elif [ -f /usr/bin/gksu ] ; then
|
elif [ -f /usr/bin/gksu ] ; then
|
||||||
gksu /usr/bin/easy-samba-gtk
|
gksu /usr/bin/easy-samba-gtk
|
||||||
exit
|
exit
|
||||||
elif [ -f /bin/gksu ] ; then
|
elif [ -f /bin/gksu ] ; then
|
||||||
gksu /usr/bin/easy-samba-gtk
|
gksu /usr/bin/easy-samba-gtk
|
||||||
exit
|
exit
|
||||||
elif [ -f /usr/bin/beesu ] ; then
|
elif [ -f /usr/bin/beesu ] ; then
|
||||||
beesu /usr/bin/easy-samba-gtk
|
beesu /usr/bin/easy-samba-gtk
|
||||||
exit
|
exit
|
||||||
elif [ -f /bin/beesu ] ; then
|
elif [ -f /bin/beesu ] ; then
|
||||||
beesu /usr/bin/easy-samba-gtk
|
beesu /usr/bin/easy-samba-gtk
|
||||||
exit
|
exit
|
||||||
elif [ -f /bin/sudo ] ; then
|
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"
|
xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "sudo easy-samba-gtk"
|
||||||
exit
|
exit
|
||||||
elif [ -f /usr/bin/sudo ] ; then
|
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"
|
xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "sudo easy-samba-gtk"
|
||||||
exit
|
exit
|
||||||
elif [ -f /usr/bin/su ] ; then
|
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'"
|
xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "su -c 'easy-samba-gtk'"
|
||||||
exit
|
exit
|
||||||
elif [ -f /bin/su ] ; then
|
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'"
|
xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "su -c 'easy-samba-gtk'"
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
zenity -h &> /dev/null
|
zenity -h &> /dev/null
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -eq 0 ] ; then
|
if [ ${output} -eq 0 ] ; then
|
||||||
zenity --title "easy-samba ${VERSION} (${M_DATE})" --info \
|
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"
|
--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
|
else
|
||||||
xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "easy-samba-gtk-admin --error"
|
xterm -T "easy-samba ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "easy-samba-gtk-admin --error"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funcion para mostrar mensaje de error
|
# Funcion para mostrar mensaje de error
|
||||||
function errorMessage() {
|
function errorMessage() {
|
||||||
echo ""
|
echo ""
|
||||||
echo "* ATENCION!:"
|
echo "* ATTENTION!:"
|
||||||
echo ""
|
echo ""
|
||||||
echo "* El programa 'easy-samba-gtk' no ha podido ser ejecutado como administrador"
|
echo "* The 'easy-samba-gtk' program could not be run as administrator"
|
||||||
echo ""
|
echo ""
|
||||||
echo "* Porfavor, ejecuta el comando 'easy-samba-gtk' como usuario root en la terminal"
|
echo "* Please run the command 'easy-samba-gtk' as root user in terminal"
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "* Pulsa INTRO para salir... " ; read continue
|
echo -n "* Press ENTER to exit... " ; read continue
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
# Inicio del script
|
# Inicio del script
|
||||||
if [ "${1}" == "--error" ] ; then
|
if [ "${1}" == "--error" ] ; then
|
||||||
errorMessage
|
errorMessage
|
||||||
else
|
else
|
||||||
showRootMessage
|
showRootMessage
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user