Rewrite code for include icons in interface
This commit is contained in:
parent
2cfda54215
commit
834489df41
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# Edita ciertas opciones del GRUB graficamente #
|
# Edita ciertas opciones del GRUB graficamente #
|
||||||
# U. Modificacion: 27-03-2021 #
|
# U. Modificacion: 02-08-2021 #
|
||||||
# Autor: q3aql #
|
# Autor: q3aql #
|
||||||
# Contacto: q3aql@protonmail.ch #
|
# Contacto: q3aql@protonmail.ch #
|
||||||
# Licencia: GPL v2.0 #
|
# Licencia: GPL v2.0 #
|
||||||
##############################################################
|
##############################################################
|
||||||
VERSION="1.4"
|
VERSION="1.4"
|
||||||
M_DATE="270321"
|
M_DATE="020821"
|
||||||
|
|
||||||
# Variables generales
|
# Variables generales
|
||||||
defaultGrub="/etc/default/grub"
|
defaultGrub="/etc/default/grub"
|
||||||
|
@ -19,6 +19,10 @@ zenigrubDir="/etc/zenigrub"
|
||||||
tmpZenigrub="/tmp/zenigrub.tmp"
|
tmpZenigrub="/tmp/zenigrub.tmp"
|
||||||
zenigrubSedFolder="/tmp/zenigrub/word/"
|
zenigrubSedFolder="/tmp/zenigrub/word/"
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
iconPath="/opt/zenigrub-custom/zenigrub-custom.png"
|
||||||
|
imagesPath="/opt/zenigrub-custom/img"
|
||||||
|
|
||||||
# Funcion para comprobar permisos de administrador
|
# Funcion para comprobar permisos de administrador
|
||||||
function comprobarAdministrador() {
|
function comprobarAdministrador() {
|
||||||
mkdir -p /etc/root &> /dev/null
|
mkdir -p /etc/root &> /dev/null
|
||||||
|
@ -27,7 +31,7 @@ function comprobarAdministrador() {
|
||||||
rm -rf /etc/root
|
rm -rf /etc/root
|
||||||
touch ${zenigrubInit}
|
touch ${zenigrubInit}
|
||||||
else
|
else
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --warning --width=340 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=340 \
|
||||||
--text "Son necesarios permisos de administrador"
|
--text "Son necesarios permisos de administrador"
|
||||||
echo ""
|
echo ""
|
||||||
echo "* zenigrub-custom ${VERSION} (${M_DATE})"
|
echo "* zenigrub-custom ${VERSION} (${M_DATE})"
|
||||||
|
@ -44,12 +48,12 @@ function comprobarFicheros() {
|
||||||
if [ -f ${bootGrub} ] ; then
|
if [ -f ${bootGrub} ] ; then
|
||||||
echo "null" > /dev/null
|
echo "null" > /dev/null
|
||||||
else
|
else
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --warning --width=340 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=340 \
|
||||||
--text "El archivo '${bootGrub}' no existe!"
|
--text "El archivo '${bootGrub}' no existe!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --warning --width=340 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=340 \
|
||||||
--text "El archivo '${defaultGrub}' no existe!"
|
--text "El archivo '${defaultGrub}' no existe!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -84,7 +88,7 @@ function backupFicheros() {
|
||||||
|
|
||||||
# Funcion para restaurar la configuracion del GRUB
|
# Funcion para restaurar la configuracion del GRUB
|
||||||
function restaurarConfiguracion() {
|
function restaurarConfiguracion() {
|
||||||
zenity --question --title "zenigrub-custom ${VERSION} (${M_DATE})" --cancel-label="No" \
|
zenity --question --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --cancel-label="No" \
|
||||||
--ok-label="Si" --width=470 --text "Se va a restaurar la configuracion inicial o la ultima guardada del GRUB. Continuar?"
|
--ok-label="Si" --width=470 --text "Se va a restaurar la configuracion inicial o la ultima guardada del GRUB. Continuar?"
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -eq 1 ] ; then
|
if [ ${output} -eq 1 ] ; then
|
||||||
|
@ -96,12 +100,12 @@ function restaurarConfiguracion() {
|
||||||
errorDos=$?
|
errorDos=$?
|
||||||
erroresTotales=$(expr ${errorUno} + ${errorDos})
|
erroresTotales=$(expr ${errorUno} + ${errorDos})
|
||||||
if [ ${erroresTotales} -eq 0 ] ; then
|
if [ ${erroresTotales} -eq 0 ] ; then
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --info --width=340 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=340 \
|
||||||
--text "La configuracion del GRUB se ha restaurado correctamente"
|
--text "La configuracion del GRUB se ha restaurado correctamente"
|
||||||
rm -rfv ${zenigrubDir}/grub
|
rm -rfv ${zenigrubDir}/grub
|
||||||
rm -rfv ${zenigrubDir}/grub.cfg
|
rm -rfv ${zenigrubDir}/grub.cfg
|
||||||
else
|
else
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --info --width=340 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=340 \
|
||||||
--text "Ha habido un problema al restaurar la configuracion del GRUB"
|
--text "Ha habido un problema al restaurar la configuracion del GRUB"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -109,7 +113,7 @@ function restaurarConfiguracion() {
|
||||||
|
|
||||||
# Funcion para guardar la configuracion del GRUB
|
# Funcion para guardar la configuracion del GRUB
|
||||||
function guardarConfiguracionGrub() {
|
function guardarConfiguracionGrub() {
|
||||||
zenity --question --title "zenigrub-custom ${VERSION} (${M_DATE})" --cancel-label="No" \
|
zenity --question --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --cancel-label="No" \
|
||||||
--ok-label="Si" --width=470 --text "Se va a establecer la configuracion actual como por defecto. Continuar?"
|
--ok-label="Si" --width=470 --text "Se va a establecer la configuracion actual como por defecto. Continuar?"
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -eq 1 ] ; then
|
if [ ${output} -eq 1 ] ; then
|
||||||
|
@ -121,10 +125,10 @@ function guardarConfiguracionGrub() {
|
||||||
errorDos=$?
|
errorDos=$?
|
||||||
erroresTotales=$(expr ${errorUno} + ${errorDos})
|
erroresTotales=$(expr ${errorUno} + ${errorDos})
|
||||||
if [ ${erroresTotales} -eq 0 ] ; then
|
if [ ${erroresTotales} -eq 0 ] ; then
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --info --width=340 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=340 \
|
||||||
--text "La configuracion del GRUB se ha guardado correctamente"
|
--text "La configuracion del GRUB se ha guardado correctamente"
|
||||||
else
|
else
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --info --width=340 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=340 \
|
||||||
--text "Ha habido un problema al guardar la configuracion del GRUB"
|
--text "Ha habido un problema al guardar la configuracion del GRUB"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -251,7 +255,7 @@ function mostrarEntradasGrub() {
|
||||||
listaInicial=$(expr ${listaInicial} + 1)
|
listaInicial=$(expr ${listaInicial} + 1)
|
||||||
done
|
done
|
||||||
zenity --width=510 --height=370 --list --title "zenigrub-custom ${VERSION} ($M_DATE) | Entradas en el GRUB:" \
|
zenity --width=510 --height=370 --list --title "zenigrub-custom ${VERSION} ($M_DATE) | Entradas en el GRUB:" \
|
||||||
--column "Lista de entradas en el GRUB:" ${listaCompleta}
|
--window-icon=${iconPath} --column "Lista de entradas en el GRUB:" ${listaCompleta}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funcion para cambiar la entrada por defecto
|
# Funcion para cambiar la entrada por defecto
|
||||||
|
@ -268,7 +272,7 @@ function cambiarEntradaDefecto() {
|
||||||
listaInicial=$(expr ${listaInicial} + 1)
|
listaInicial=$(expr ${listaInicial} + 1)
|
||||||
done
|
done
|
||||||
establecerEntrada=$(zenity --width=510 --height=370 --list --title "zenigrub-custom ${VERSION} ($M_DATE)" \
|
establecerEntrada=$(zenity --width=510 --height=370 --list --title "zenigrub-custom ${VERSION} ($M_DATE)" \
|
||||||
--column "Selecciona la entrada por defecto en GRUB:" ${listaCompleta})
|
--window-icon=${iconPath} --column "Selecciona la entrada por defecto en GRUB:" ${listaCompleta})
|
||||||
if [ ${cancelar} -eq 1 ] ; then
|
if [ ${cancelar} -eq 1 ] ; then
|
||||||
mostrarMenuPrincipal
|
mostrarMenuPrincipal
|
||||||
else
|
else
|
||||||
|
@ -303,7 +307,7 @@ function mostrarConfiguracionActual() {
|
||||||
parametrosGrubLeido=$(cat ${defaultGrub} | grep "GRUB_CMDLINE_LINUX_DEFAULT=" | cut -d "=" -f ${LineaInicial} | cut -d '"' -f 1)
|
parametrosGrubLeido=$(cat ${defaultGrub} | grep "GRUB_CMDLINE_LINUX_DEFAULT=" | cut -d "=" -f ${LineaInicial} | cut -d '"' -f 1)
|
||||||
done
|
done
|
||||||
echo "${parametrosGrub}" > ${tmpZenigrub}
|
echo "${parametrosGrub}" > ${tmpZenigrub}
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --info --width=520 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=520 \
|
||||||
--text "Configuracion GRUB:\n
|
--text "Configuracion GRUB:\n
|
||||||
- Entrada por defecto: ${entradaDefecto}
|
- Entrada por defecto: ${entradaDefecto}
|
||||||
- Tiempo de GRUB: ${tiempoGrub}
|
- Tiempo de GRUB: ${tiempoGrub}
|
||||||
|
@ -314,7 +318,7 @@ function mostrarConfiguracionActual() {
|
||||||
function cambiarTiempoGrub() {
|
function cambiarTiempoGrub() {
|
||||||
tiempoGrub=$(cat ${defaultGrub} | grep "GRUB_TIMEOUT=" | cut -d "=" -f 2 | cut -d '"' -f 2)
|
tiempoGrub=$(cat ${defaultGrub} | grep "GRUB_TIMEOUT=" | cut -d "=" -f 2 | cut -d '"' -f 2)
|
||||||
tiempoActual=$(zenity --entry --title "zenigrub-custom ${VERSION} (${M_DATE})" \
|
tiempoActual=$(zenity --entry --title "zenigrub-custom ${VERSION} (${M_DATE})" \
|
||||||
--text "Escribe los SEGUNDOS que estara el GRUB visible:" --entry-text "${tiempoGrub}")
|
--window-icon=${iconPath} --text "Escribe los SEGUNDOS que estara el GRUB visible:" --entry-text "${tiempoGrub}")
|
||||||
cancelar=$?
|
cancelar=$?
|
||||||
if [ ${cancelar} -eq 1 ] ; then
|
if [ ${cancelar} -eq 1 ] ; then
|
||||||
mostrarMenuPrincipal
|
mostrarMenuPrincipal
|
||||||
|
@ -348,7 +352,7 @@ function editarParametrosArranque() {
|
||||||
parametrosGrub=$(cat ${tmpZenigrub})
|
parametrosGrub=$(cat ${tmpZenigrub})
|
||||||
# Se leen y procesan los nuevos parametros
|
# Se leen y procesan los nuevos parametros
|
||||||
parametrosActual=$(zenity --entry --title "zenigrub-custom ${VERSION} (${M_DATE})" \
|
parametrosActual=$(zenity --entry --title "zenigrub-custom ${VERSION} (${M_DATE})" \
|
||||||
--text "Escribe los PARAMETROS DE ARRANQUE en el GRUB: " --entry-text "${parametrosGrubMostrar}")
|
--window-icon=${iconPath} --text "Escribe los PARAMETROS DE ARRANQUE en el GRUB: " --entry-text "${parametrosGrubMostrar}")
|
||||||
cancelar=$?
|
cancelar=$?
|
||||||
if [ ${cancelar} -eq 1 ] ; then
|
if [ ${cancelar} -eq 1 ] ; then
|
||||||
mostrarMenuPrincipal
|
mostrarMenuPrincipal
|
||||||
|
@ -371,23 +375,23 @@ function actualizandoGRUB() {
|
||||||
update-grub
|
update-grub
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -eq 0 ] ; then
|
if [ ${output} -eq 0 ] ; then
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --info --width=320 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=320 \
|
||||||
--text "El proceso de actualizacion de GRUB ha finalizado!"
|
--text "El proceso de actualizacion de GRUB ha finalizado!"
|
||||||
else
|
else
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --error --width=320 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=320 \
|
||||||
--text "Ha habido un error en el proceso de actualizacion de GRUB"
|
--text "Ha habido un error en el proceso de actualizacion de GRUB"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funcion para actualizar el GRUB mostrando la barra de progreso
|
# Funcion para actualizar el GRUB mostrando la barra de progreso
|
||||||
function actualizarGrub() {
|
function actualizarGrub() {
|
||||||
actualizandoGRUB | zenity --progress --title "zenigrub-custom ${VERSION} (${M_DATE})" --auto-close \
|
actualizandoGRUB | zenity --progress --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --auto-close \
|
||||||
--pulsate --text "Actualizando configuracion del GRUB"
|
--pulsate --text "Actualizando configuracion del GRUB"
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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: zenigrub-custom ${VERSION} (${M_DATE})\nAutor: q3aql\nContacto: q3aql@protonmail.ch\nLicencia: GPL v2.0"
|
--text "Software: zenigrub-custom ${VERSION} (${M_DATE})\nAutor: q3aql\nContacto: q3aql@protonmail.ch\nLicencia: GPL v2.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,40 +399,40 @@ function mostrarAcerca() {
|
||||||
function mostrarMenuPrincipal() {
|
function mostrarMenuPrincipal() {
|
||||||
mostrarMenu=0
|
mostrarMenu=0
|
||||||
while [ ${mostrarMenu} -eq 0 ] ; do
|
while [ ${mostrarMenu} -eq 0 ] ; do
|
||||||
opcion=$(zenity --width=340 --height=365 --list --title "zenigrub-custom ${VERSION} (${M_DATE})" \
|
opcion=$(zenity --width=340 --height=420 --list --title "zenigrub-custom ${VERSION} (${M_DATE})" \
|
||||||
--column "Selecciona una opcion:" "Mostrar entradadas del GRUB" "Cambiar entrada por defecto" \
|
--window-icon=${iconPath} --imagelist --column "Icono" --column "Opcion" ${imagesPath}/show-grub-entries.png "Mostrar entradadas del GRUB" ${imagesPath}/change-default-entry.png "Cambiar entrada por defecto" ${imagesPath}/change-grub-time.png "Cambiar tiempo de GRUB" \
|
||||||
"Cambiar tiempo de GRUB" "Editar parametros de arranque" "Mostrar configuracion actual" \
|
${imagesPath}/edit-boot-parameters.png "Editar parametros de arranque" ${imagesPath}/show-current-settings.png "Mostrar configuracion actual" \
|
||||||
"Actualizar GRUB (update-grub)" "Guardar configuracion de GRUB" "Restaurar configuracion de GRUB" \
|
${imagesPath}/update-grub.png "Actualizar GRUB (update-grub)" ${imagesPath}/save-grub-configuration.png "Guardar configuracion de GRUB" ${imagesPath}/restore-grub-settings.png "Restaurar configuracion de GRUB" \
|
||||||
"Acerca" "Salir")
|
${imagesPath}/about.png "Acerca" ${imagesPath}/exit.png "Salir")
|
||||||
cancelar=$?
|
cancelar=$?
|
||||||
if [ ${cancelar} -eq 1 ] ; then
|
if [ ${cancelar} -eq 1 ] ; then
|
||||||
mostrarMenu=1
|
mostrarMenu=1
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
if [ "${opcion}" == "Mostrar entradadas del GRUB" ] ; then
|
if [ "${opcion}" == "${imagesPath}/show-grub-entries.png" ] ; then
|
||||||
mostrarEntradasGrub
|
mostrarEntradasGrub
|
||||||
elif [ "${opcion}" == "Cambiar entrada por defecto" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/change-default-entry.png" ] ; then
|
||||||
cambiarEntradaDefecto
|
cambiarEntradaDefecto
|
||||||
elif [ "${opcion}" == "Cambiar tiempo de GRUB" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/change-grub-time.png" ] ; then
|
||||||
cambiarTiempoGrub
|
cambiarTiempoGrub
|
||||||
elif [ "${opcion}" == "Editar parametros de arranque" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/edit-boot-parameters.png" ] ; then
|
||||||
editarParametrosArranque
|
editarParametrosArranque
|
||||||
elif [ "${opcion}" == "Mostrar configuracion actual" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/show-current-settings.png" ] ; then
|
||||||
mostrarConfiguracionActual
|
mostrarConfiguracionActual
|
||||||
elif [ "${opcion}" == "Actualizar GRUB (update-grub)" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/update-grub.png" ] ; then
|
||||||
actualizarGrub
|
actualizarGrub
|
||||||
elif [ "${opcion}" == "Guardar configuracion de GRUB" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/save-grub-configuration.png" ] ; then
|
||||||
guardarConfiguracionGrub
|
guardarConfiguracionGrub
|
||||||
elif [ "${opcion}" == "Restaurar configuracion de GRUB" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/restore-grub-settings.png" ] ; then
|
||||||
restaurarConfiguracion
|
restaurarConfiguracion
|
||||||
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
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --warning --width=300 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=300 \
|
||||||
--text "Elige una de las opciones del menu"
|
--text "Choose one of the menu options"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -2,13 +2,16 @@
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# Edita ciertas opciones del GRUB graficamente #
|
# Edita ciertas opciones del GRUB graficamente #
|
||||||
# U. Modificacion: 27-03-2021 #
|
# U. Modificacion: 02-08-2021 #
|
||||||
# Autor: q3aql #
|
# Autor: q3aql #
|
||||||
# Contacto: q3aql@protonmail.ch #
|
# Contacto: q3aql@protonmail.ch #
|
||||||
# Licencia: GPL v2.0 #
|
# Licencia: GPL v2.0 #
|
||||||
##############################################################
|
##############################################################
|
||||||
VERSION="1.4"
|
VERSION="1.4"
|
||||||
M_DATE="270321"
|
M_DATE="020821"
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
iconPath="/opt/zenigrub-custom/zenigrub-custom.png"
|
||||||
|
|
||||||
# Enlace con gksudo,gksu o bessu a zenigrub-custom
|
# Enlace con gksudo,gksu o bessu a zenigrub-custom
|
||||||
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 "zenigrub-custom ${VERSION} (${M_DATE})" --info \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --width 450 --info \
|
||||||
--text "El programa 'zenigrub-custom' no ha podido ser ejecutado como administrador\n\nPor favor, ejecuta el comando 'zenigrub-custom' como usuario root en la terminal"
|
--text "El programa 'zenigrub-custom' no ha podido ser ejecutado como administrador\n\nPor favor, ejecuta el comando 'zenigrub-custom' como usuario root en la terminal"
|
||||||
else
|
else
|
||||||
xterm -T "zenigrub-custom ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "zenigrub-custom-admin --error"
|
xterm -T "zenigrub-custom ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "zenigrub-custom-admin --error"
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# Edita ciertas opciones del GRUB graficamente #
|
# Edita ciertas opciones del GRUB graficamente #
|
||||||
# U. Modificacion: 27-03-2021 #
|
# U. Modificacion: 02-08-2021 #
|
||||||
# Autor: q3aql #
|
# Autor: q3aql #
|
||||||
# Contacto: q3aql@protonmail.ch #
|
# Contacto: q3aql@protonmail.ch #
|
||||||
# Licencia: GPL v2.0 #
|
# Licencia: GPL v2.0 #
|
||||||
##############################################################
|
##############################################################
|
||||||
VERSION="1.4"
|
VERSION="1.4"
|
||||||
M_DATE="270321"
|
M_DATE="020821"
|
||||||
|
|
||||||
# Variables generales
|
# Variables generales
|
||||||
defaultGrub="/etc/default/grub"
|
defaultGrub="/etc/default/grub"
|
||||||
|
@ -19,6 +19,10 @@ zenigrubDir="/etc/zenigrub"
|
||||||
tmpZenigrub="/tmp/zenigrub.tmp"
|
tmpZenigrub="/tmp/zenigrub.tmp"
|
||||||
zenigrubSedFolder="/tmp/zenigrub/word/"
|
zenigrubSedFolder="/tmp/zenigrub/word/"
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
iconPath="/opt/zenigrub-custom/zenigrub-custom.png"
|
||||||
|
imagesPath="/opt/zenigrub-custom/img"
|
||||||
|
|
||||||
# Funcion para comprobar permisos de administrador
|
# Funcion para comprobar permisos de administrador
|
||||||
function comprobarAdministrador() {
|
function comprobarAdministrador() {
|
||||||
mkdir -p /etc/root &> /dev/null
|
mkdir -p /etc/root &> /dev/null
|
||||||
|
@ -27,7 +31,7 @@ function comprobarAdministrador() {
|
||||||
rm -rf /etc/root
|
rm -rf /etc/root
|
||||||
touch ${zenigrubInit}
|
touch ${zenigrubInit}
|
||||||
else
|
else
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --warning --width=340 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=340 \
|
||||||
--text "Administrator permissions are required "
|
--text "Administrator permissions are required "
|
||||||
echo ""
|
echo ""
|
||||||
echo "* zenigrub-custom ${VERSION} (${M_DATE})"
|
echo "* zenigrub-custom ${VERSION} (${M_DATE})"
|
||||||
|
@ -44,12 +48,12 @@ function comprobarFicheros() {
|
||||||
if [ -f ${bootGrub} ] ; then
|
if [ -f ${bootGrub} ] ; then
|
||||||
echo "null" > /dev/null
|
echo "null" > /dev/null
|
||||||
else
|
else
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --warning --width=340 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=340 \
|
||||||
--text "The file '${bootGrub}' doesn't exist!"
|
--text "The file '${bootGrub}' doesn't exist!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --warning --width=340 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=340 \
|
||||||
--text "The file '${defaultGrub}' doesn't exist!"
|
--text "The file '${defaultGrub}' doesn't exist!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -84,7 +88,7 @@ function backupFicheros() {
|
||||||
|
|
||||||
# Funcion para restaurar la configuracion del GRUB
|
# Funcion para restaurar la configuracion del GRUB
|
||||||
function restaurarConfiguracion() {
|
function restaurarConfiguracion() {
|
||||||
zenity --question --title "zenigrub-custom ${VERSION} (${M_DATE})" --cancel-label="No" \
|
zenity --question --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --cancel-label="No" \
|
||||||
--ok-label="Yes" --width=470 --text "The initial or last saved GRUB configuration will be restored. Continue?"
|
--ok-label="Yes" --width=470 --text "The initial or last saved GRUB configuration will be restored. Continue?"
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -eq 1 ] ; then
|
if [ ${output} -eq 1 ] ; then
|
||||||
|
@ -96,12 +100,12 @@ function restaurarConfiguracion() {
|
||||||
errorDos=$?
|
errorDos=$?
|
||||||
erroresTotales=$(expr ${errorUno} + ${errorDos})
|
erroresTotales=$(expr ${errorUno} + ${errorDos})
|
||||||
if [ ${erroresTotales} -eq 0 ] ; then
|
if [ ${erroresTotales} -eq 0 ] ; then
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --info --width=340 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=340 \
|
||||||
--text "GRUB settings have been successfully restored"
|
--text "GRUB settings have been successfully restored"
|
||||||
rm -rfv ${zenigrubDir}/grub
|
rm -rfv ${zenigrubDir}/grub
|
||||||
rm -rfv ${zenigrubDir}/grub.cfg
|
rm -rfv ${zenigrubDir}/grub.cfg
|
||||||
else
|
else
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --info --width=340 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=340 \
|
||||||
--text "There was a problem restoring the GRUB configuration"
|
--text "There was a problem restoring the GRUB configuration"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -109,7 +113,7 @@ function restaurarConfiguracion() {
|
||||||
|
|
||||||
# Funcion para guardar la configuracion del GRUB
|
# Funcion para guardar la configuracion del GRUB
|
||||||
function guardarConfiguracionGrub() {
|
function guardarConfiguracionGrub() {
|
||||||
zenity --question --title "zenigrub-custom ${VERSION} (${M_DATE})" --cancel-label="No" \
|
zenity --question --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --cancel-label="No" \
|
||||||
--ok-label="Yes" --width=470 --text "The current configuration will be set as the default. Continue?"
|
--ok-label="Yes" --width=470 --text "The current configuration will be set as the default. Continue?"
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -eq 1 ] ; then
|
if [ ${output} -eq 1 ] ; then
|
||||||
|
@ -121,10 +125,10 @@ function guardarConfiguracionGrub() {
|
||||||
errorDos=$?
|
errorDos=$?
|
||||||
erroresTotales=$(expr ${errorUno} + ${errorDos})
|
erroresTotales=$(expr ${errorUno} + ${errorDos})
|
||||||
if [ ${erroresTotales} -eq 0 ] ; then
|
if [ ${erroresTotales} -eq 0 ] ; then
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --info --width=340 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=340 \
|
||||||
--text "GRUB configuration has been saved successfully"
|
--text "GRUB configuration has been saved successfully"
|
||||||
else
|
else
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --info --width=340 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=340 \
|
||||||
--text "There was a problem saving the GRUB configuration"
|
--text "There was a problem saving the GRUB configuration"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -251,7 +255,7 @@ function mostrarEntradasGrub() {
|
||||||
listaInicial=$(expr ${listaInicial} + 1)
|
listaInicial=$(expr ${listaInicial} + 1)
|
||||||
done
|
done
|
||||||
zenity --width=510 --height=370 --list --title "zenigrub-custom ${VERSION} ($M_DATE) | Entries of GRUB:" \
|
zenity --width=510 --height=370 --list --title "zenigrub-custom ${VERSION} ($M_DATE) | Entries of GRUB:" \
|
||||||
--column "List of entries of GRUB:" ${listaCompleta}
|
--window-icon=${iconPath} --column "List of entries of GRUB:" ${listaCompleta}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funcion para cambiar la entrada por defecto
|
# Funcion para cambiar la entrada por defecto
|
||||||
|
@ -268,7 +272,7 @@ function cambiarEntradaDefecto() {
|
||||||
listaInicial=$(expr ${listaInicial} + 1)
|
listaInicial=$(expr ${listaInicial} + 1)
|
||||||
done
|
done
|
||||||
establecerEntrada=$(zenity --width=510 --height=370 --list --title "zenigrub-custom ${VERSION} ($M_DATE)" \
|
establecerEntrada=$(zenity --width=510 --height=370 --list --title "zenigrub-custom ${VERSION} ($M_DATE)" \
|
||||||
--column "Select the default entry in GRUB:" ${listaCompleta})
|
--window-icon=${iconPath} --column "Select the default entry in GRUB:" ${listaCompleta})
|
||||||
if [ ${cancelar} -eq 1 ] ; then
|
if [ ${cancelar} -eq 1 ] ; then
|
||||||
mostrarMenuPrincipal
|
mostrarMenuPrincipal
|
||||||
else
|
else
|
||||||
|
@ -303,7 +307,7 @@ function mostrarConfiguracionActual() {
|
||||||
parametrosGrubLeido=$(cat ${defaultGrub} | grep "GRUB_CMDLINE_LINUX_DEFAULT=" | cut -d "=" -f ${LineaInicial} | cut -d '"' -f 1)
|
parametrosGrubLeido=$(cat ${defaultGrub} | grep "GRUB_CMDLINE_LINUX_DEFAULT=" | cut -d "=" -f ${LineaInicial} | cut -d '"' -f 1)
|
||||||
done
|
done
|
||||||
echo "${parametrosGrub}" > ${tmpZenigrub}
|
echo "${parametrosGrub}" > ${tmpZenigrub}
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --info --width=520 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=520 \
|
||||||
--text "GRUB configuration:\n
|
--text "GRUB configuration:\n
|
||||||
- Default entry: ${entradaDefecto}
|
- Default entry: ${entradaDefecto}
|
||||||
- GRUB time: ${tiempoGrub}
|
- GRUB time: ${tiempoGrub}
|
||||||
|
@ -313,7 +317,7 @@ function mostrarConfiguracionActual() {
|
||||||
# Funcion para cambiar el tiempo del GRUB
|
# Funcion para cambiar el tiempo del GRUB
|
||||||
function cambiarTiempoGrub() {
|
function cambiarTiempoGrub() {
|
||||||
tiempoGrub=$(cat ${defaultGrub} | grep "GRUB_TIMEOUT=" | cut -d "=" -f 2 | cut -d '"' -f 2)
|
tiempoGrub=$(cat ${defaultGrub} | grep "GRUB_TIMEOUT=" | cut -d "=" -f 2 | cut -d '"' -f 2)
|
||||||
tiempoActual=$(zenity --entry --title "zenigrub-custom ${VERSION} (${M_DATE})" \
|
tiempoActual=$(zenity --entry --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} \
|
||||||
--text "Type the SECONDS that the GRUB will be visible:" --entry-text "${tiempoGrub}")
|
--text "Type the SECONDS that the GRUB will be visible:" --entry-text "${tiempoGrub}")
|
||||||
cancelar=$?
|
cancelar=$?
|
||||||
if [ ${cancelar} -eq 1 ] ; then
|
if [ ${cancelar} -eq 1 ] ; then
|
||||||
|
@ -347,7 +351,7 @@ function editarParametrosArranque() {
|
||||||
sed -i 's/ /\\ /g' "${tmpZenigrub}" &> /dev/null
|
sed -i 's/ /\\ /g' "${tmpZenigrub}" &> /dev/null
|
||||||
parametrosGrub=$(cat ${tmpZenigrub})
|
parametrosGrub=$(cat ${tmpZenigrub})
|
||||||
# Se leen y procesan los nuevos parametros
|
# Se leen y procesan los nuevos parametros
|
||||||
parametrosActual=$(zenity --entry --title "zenigrub-custom ${VERSION} (${M_DATE})" \
|
parametrosActual=$(zenity --entry --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} \
|
||||||
--text "Type the BOOT PARAMETERS in GRUB: " --entry-text "${parametrosGrubMostrar}")
|
--text "Type the BOOT PARAMETERS in GRUB: " --entry-text "${parametrosGrubMostrar}")
|
||||||
cancelar=$?
|
cancelar=$?
|
||||||
if [ ${cancelar} -eq 1 ] ; then
|
if [ ${cancelar} -eq 1 ] ; then
|
||||||
|
@ -371,23 +375,23 @@ function actualizandoGRUB() {
|
||||||
update-grub
|
update-grub
|
||||||
output=$?
|
output=$?
|
||||||
if [ ${output} -eq 0 ] ; then
|
if [ ${output} -eq 0 ] ; then
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --info --width=320 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info --width=320 \
|
||||||
--text "GRUB update process is complete!"
|
--text "GRUB update process is complete!"
|
||||||
else
|
else
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --error --width=320 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --error --width=320 \
|
||||||
--text "There was an error in the GRUB update process"
|
--text "There was an error in the GRUB update process"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funcion para actualizar el GRUB mostrando la barra de progreso
|
# Funcion para actualizar el GRUB mostrando la barra de progreso
|
||||||
function actualizarGrub() {
|
function actualizarGrub() {
|
||||||
actualizandoGRUB | zenity --progress --title "zenigrub-custom ${VERSION} (${M_DATE})" --auto-close \
|
actualizandoGRUB | zenity --progress --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --auto-close \
|
||||||
--pulsate --text "Updating GRUB configuration"
|
--pulsate --text "Updating GRUB configuration"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funcion para mostrar el "acerca" del programa
|
# Funcion para mostrar el "acerca" del programa
|
||||||
function mostrarAcerca() {
|
function mostrarAcerca() {
|
||||||
zenity --title "About" --info --width=330 \
|
zenity --title "About" --window-icon=${iconPath} --info --width=330 \
|
||||||
--text "Software: zenigrub-custom ${VERSION} (${M_DATE})\nAuthor: q3aql\nContact: q3aql@protonmail.ch\nLicense: GPL v2.0"
|
--text "Software: zenigrub-custom ${VERSION} (${M_DATE})\nAuthor: q3aql\nContact: q3aql@protonmail.ch\nLicense: GPL v2.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,39 +399,40 @@ function mostrarAcerca() {
|
||||||
function mostrarMenuPrincipal() {
|
function mostrarMenuPrincipal() {
|
||||||
mostrarMenu=0
|
mostrarMenu=0
|
||||||
while [ ${mostrarMenu} -eq 0 ] ; do
|
while [ ${mostrarMenu} -eq 0 ] ; do
|
||||||
opcion=$(zenity --width=340 --height=365 --list --title "zenigrub-custom ${VERSION} (${M_DATE})" \
|
opcion=$(zenity --width=340 --height=420 --list --title "zenigrub-custom ${VERSION} (${M_DATE})" \
|
||||||
--column "Select an option:" "Show GRUB entries" "Change default entry" \
|
--window-icon=${iconPath} --imagelist --column "Icon" --column "Option" ${imagesPath}/show-grub-entries.png "Show GRUB entries" \
|
||||||
"Change GRUB time" "Edit boot parameters" "Show current settings" \
|
${imagesPath}/change-default-entry.png "Change default entry" ${imagesPath}/change-grub-time.png "Change GRUB time" \
|
||||||
"Update GRUB (update-grub)" "Save GRUB configuration" "Restore GRUB settings" \
|
${imagesPath}/edit-boot-parameters.png "Edit boot parameters" ${imagesPath}/show-current-settings.png "Show current settings" \
|
||||||
"About" "Exit")
|
${imagesPath}/update-grub.png "Update GRUB (update-grub)" ${imagesPath}/save-grub-configuration.png "Save GRUB configuration" ${imagesPath}/restore-grub-settings.png "Restore GRUB settings" \
|
||||||
|
${imagesPath}/about.png "About" ${imagesPath}/exit.png "Exit")
|
||||||
cancelar=$?
|
cancelar=$?
|
||||||
if [ ${cancelar} -eq 1 ] ; then
|
if [ ${cancelar} -eq 1 ] ; then
|
||||||
mostrarMenu=1
|
mostrarMenu=1
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
if [ "${opcion}" == "Show GRUB entries" ] ; then
|
if [ "${opcion}" == "${imagesPath}/show-grub-entries.png" ] ; then
|
||||||
mostrarEntradasGrub
|
mostrarEntradasGrub
|
||||||
elif [ "${opcion}" == "Change default entry" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/change-default-entry.png" ] ; then
|
||||||
cambiarEntradaDefecto
|
cambiarEntradaDefecto
|
||||||
elif [ "${opcion}" == "Change GRUB time" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/change-grub-time.png" ] ; then
|
||||||
cambiarTiempoGrub
|
cambiarTiempoGrub
|
||||||
elif [ "${opcion}" == "Edit boot parameters" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/edit-boot-parameters.png" ] ; then
|
||||||
editarParametrosArranque
|
editarParametrosArranque
|
||||||
elif [ "${opcion}" == "Show current settings" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/show-current-settings.png" ] ; then
|
||||||
mostrarConfiguracionActual
|
mostrarConfiguracionActual
|
||||||
elif [ "${opcion}" == "Update GRUB (update-grub)" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/update-grub.png" ] ; then
|
||||||
actualizarGrub
|
actualizarGrub
|
||||||
elif [ "${opcion}" == "Save GRUB configuration" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/save-grub-configuration.png" ] ; then
|
||||||
guardarConfiguracionGrub
|
guardarConfiguracionGrub
|
||||||
elif [ "${opcion}" == "Restore GRUB settings" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/restore-grub-settings.png" ] ; then
|
||||||
restaurarConfiguracion
|
restaurarConfiguracion
|
||||||
elif [ "${opcion}" == "About" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/about.png" ] ; then
|
||||||
mostrarAcerca
|
mostrarAcerca
|
||||||
elif [ "${opcion}" == "Exit" ] ; then
|
elif [ "${opcion}" == "${imagesPath}/exit.png" ] ; then
|
||||||
mostrarMenu=1
|
mostrarMenu=1
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --warning --width=300 \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --warning --width=300 \
|
||||||
--text "Choose one of the menu options"
|
--text "Choose one of the menu options"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -2,13 +2,16 @@
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# Edita ciertas opciones del GRUB graficamente #
|
# Edita ciertas opciones del GRUB graficamente #
|
||||||
# U. Modificacion: 27-03-2021 #
|
# U. Modificacion: 02-08-2021 #
|
||||||
# Autor: q3aql #
|
# Autor: q3aql #
|
||||||
# Contacto: q3aql@protonmail.ch #
|
# Contacto: q3aql@protonmail.ch #
|
||||||
# Licencia: GPL v2.0 #
|
# Licencia: GPL v2.0 #
|
||||||
##############################################################
|
##############################################################
|
||||||
VERSION="1.4"
|
VERSION="1.4"
|
||||||
M_DATE="270321"
|
M_DATE="020821"
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
iconPath="/opt/zenigrub-custom/zenigrub-custom.png"
|
||||||
|
|
||||||
# Enlace con gksudo,gksu o bessu a zenigrub-custom
|
# Enlace con gksudo,gksu o bessu a zenigrub-custom
|
||||||
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 "zenigrub-custom ${VERSION} (${M_DATE})" --info \
|
zenity --title "zenigrub-custom ${VERSION} (${M_DATE})" --window-icon=${iconPath} --width 450 --info \
|
||||||
--text "The 'zenigrub-custom' program could not be run as administrator\n\nPlease run the 'zenigrub-custom' command as root user in terminal"
|
--text "The 'zenigrub-custom' program could not be run as administrator\n\nPlease run the 'zenigrub-custom' command as root user in terminal"
|
||||||
else
|
else
|
||||||
xterm -T "zenigrub-custom ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "zenigrub-custom-admin --error"
|
xterm -T "zenigrub-custom ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "zenigrub-custom-admin --error"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user