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