Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =========================================================================================
- Fichero ------> install-bootos
- =========================================================================================
- #!/bin/bash
- ##########################################################################################
- # By Francisco Luque Frannoe@gmail.com
- # http://lmde-frannoe.blogspot.com.es/
- # MATE RebootOS es una herramienta que nos permite seleccionar desde nuestro
- # entorno gráfico con qué sistema queremos arrancar.
- # Es necesario tener instalado el paquete "zenity" para su correcto
- # funcionamiento.
- # Esta utilidad esta basada en Unity-Reboot. Creada por Andrew de webupd8:
- # http://www.webupd8.org/2011/09/unity-reboot-ubuntu-unity-launcher-to.html.
- # Las adaptaciones y modificaciones de los paquetes fuentes han sido orientadas
- # para su funcionamiento exclusivo en MATE. Por lo cual, su buen funcionamiento
- # en otros entornos no está asegurado.
- # Para instalar MATE RebootOS, abra un terminal con el prompt en la carpeta MATE-RebootOS
- # y ejecute el siguiente comando:
- # ./install-bootos
- # Si tiene la opción correspondiente activada en la configuración de archivos de Caja,
- # también podrá ejecutar el archivo anterior con un doble clic.
- # En el caso de querer desinstalar esta herramienta ejecute este comando:
- # ./remove-bootos
- # Tienes más información aquí:
- # http://lmde-frannoe.blogspot.com.es/2012/10/lmde-mate-reboot-os.html
- ##########################################################################################
- gksu -- sh -c 'cp -f mate-rebootos /usr/bin/'
- if [ $? -eq 0 ]
- then
- zenity --progress --pulsate --width "300" --no-cancel --auto-close --title="Copiando archivos..." --text="Copiando los siguientes archivos a las siguientes ubicaciones:\n\nmate-rebootos-settings a /usr/bin/\nmate-rebootos-command a /usr/bin/\nremove-bootos a /usr/bin/\nmate-rebootos.desktop a /etc/xdg/autostart/\nmate-rebootos.png a /usr/share/icons/hicolor/scalable/apps\nmate-rebootos-settings.png a /usr/share/icons/hicolor/scalable/apps\n\nEspere por favor..." &
- FINALIZAR_PROGRESS="%-"
- gksu -- sh -c 'cp -f mate-rebootos-settings /usr/bin/'
- gksu -- sh -c 'cp -f mate-rebootos-command /usr/bin/'
- gksu -- sh -c 'cp -f remove-bootos /usr/bin/'
- gksu -- sh -c 'cp -f mate-rebootos.desktop /etc/xdg/autostart/'
- gksu -- sh -c 'cp -f mate-rebootos.png /usr/share/icons/hicolor/scalable/apps/'
- gksu -- sh -c 'cp -f mate-rebootos-settings.png /usr/share/icons/hicolor/scalable/apps/'
- gksu -- sh -c 'gtk-update-icon-cache /usr/share/icons/hicolor/'
- if [[ -e /etc/default/grub ]]; then
- gksu -- sh -c 'cp /etc/default/grub /etc/default/grub_backup'
- gksu -- sh -c 'cp /boot/grub/grub.cfg /boot/grub/grub_backup'
- gksu -- sh -c 'sed -i 's/GRUB_DEFAULT.*/GRUB_DEFAULT=saved/' /etc/default/grub'
- gksu -- sh -c 'sed -i 's/#GRUB_DEFAULT.*/GRUB_DEFAULT=saved/' /etc/default/grub'
- gksu -- sh -c 'update-grub'
- fi
- if [ -e ~/.config/menus/mate-settings.menu ]
- then
- grep -r "<Name>ResetOS</Name>" ~/.config/menus/mate-settings.menu
- if [ $? -ne 0 ]
- then
- cp ~/.config/menus/mate-settings.menu ~/.config/menus/mate-settings.menu.BACK
- sed '/^$/d' ~/.config/menus/mate-settings.menu.BACK | sed '$d' > ~/.config/menus/mate-settings.menu
- echo " <Menu>
- <Name>ResetOS</Name>
- <Include>
- <Category>Reset-OS</Category>
- </Include>
- </Menu>
- </Menu> " | tee -a ~/.config/menus/mate-settings.menu
- mate-rebootos
- sleep 5s && kill $FINALIZAR_PROGRESS
- zenity --info --title "Instalación finalizada..." --text "Proceso finalizado.\nAhora puede encontrar las distintas opciones\nde arranque de MATE Reboot OS en su menú:\n<b>Sistemas -/- ResetOS</b>" --no-wrap
- exit
- else
- mate-rebootos
- sleep 5s && kill $FINALIZAR_PROGRESS
- zenity --info --title "Instalación finalizada..." --text "Proceso finalizado.\nAhora puede encontrar las distintas opciones\nde arranque de MATE Reboot OS en su menú:\n<b>Sistemas -/- ResetOS</b>" --no-wrap
- exit
- fi
- else
- mate-rebootos
- sleep 5s && kill $FINALIZAR_PROGRESS
- zenity --info --title "Instalación finalizada..." --text "Proceso finalizado.\nAhora puede encontrar las distintas opciones\nde arranque de MATE Reboot OS en su menú:\n<b>Sistemas -/- ResetOS</b>" --no-wrap
- exit
- fi
- else
- zenity --info --title "Cancelado..." --text "Proceso cancelado o contraseña incorrecta." --no-wrap
- exit
- fi
- =========================================================================================
- Fichero ------> remove-bootos
- =========================================================================================
- #!/bin/bash
- ##########################################################################################
- # By Francisco Luque Frannoe@gmail.com
- # http://lmde-frannoe.blogspot.com.es/
- # MATE RebootOS es una herramienta que nos permite seleccionar desde nuestro
- # entorno gráfico con qué sistema queremos arrancar.
- # Es necesario tener instalado el paquete "zenity" para su correcto
- # funcionamiento.
- # Esta utilidad esta basada en Unity-Reboot. Creada por Andrew de webupd8:
- # http://www.webupd8.org/2011/09/unity-reboot-ubuntu-unity-launcher-to.html.
- # Las adaptaciones y modificaciones de los paquetes fuentes han sido orientadas
- # para su funcionamiento exclusivo en MATE. Por lo cual, su buen funcionamiento
- # en otros entornos no está asegurado.
- # En el caso de querer desinstalar MATE RebootOS, abra un terminal con el prompt
- # en la carpeta MATE-RebootOS y ejecute el siguiente comando:
- # ./remove-bootos
- # Tienes más información aquí:
- # http://lmde-frannoe.blogspot.com.es/2012/10/lmde-mate-reboot-os.html
- ##########################################################################################
- if zenity --question --title "¿Eliminar MATE Reboot OS?" --text="¿Está seguro de querer eliminar Mate Reboot OS?." --no-wrap
- then
- gksu -- sh -c 'rm -f /usr/bin/mate-rebootos'
- if [ $? -eq 0 ]
- then
- zenity --progress --pulsate --width "300" --no-cancel --auto-close --title="Eliminando archivos..." --text="Eliminado los siguientes archivos:\n\n/usr/bin/mate-rebootos-settings\n/usr/bin/mate-rebootos-command\n/usr/bin/remove-bootos\n/etc/xdg/autostart/mate-reboot.desktop\n/usr/share/icons/hicolor/scalable/apps/mate-reboot.png\n/usr/share/icons/hicolor/scalable/apps/mate-rebootos-settings.png\n`whoami`/.local/share/applications/mate-rebootos*\n`whoami`/.config/mate-rebootos\n\nEspere por favor..." &
- FINALIZAR_PROGRESS="%-"
- gksu -- sh -c 'rm -f /usr/bin/mate-rebootos-settings'
- gksu -- sh -c 'rm -f /usr/bin/mate-rebootos-command'
- gksu -- sh -c 'rm -f /etc/xdg/autostart/mate-rebootos.desktop'
- gksu -- sh -c 'rm -f /usr/share/icons/hicolor/scalable/apps/mate-rebootos.png'
- gksu -- sh -c 'rm -f /usr/share/icons/hicolor/scalable/apps/mate-rebootos-settings.png'
- gksu -- sh -c 'gtk-update-icon-cache /usr/share/icons/hicolor'
- rm -f ~/.local/share/applications/mate-rebootos*
- rm -rf ~/.config/mate-rebootos
- sleep 5s && kill $FINALIZAR_PROGRESS
- zenity --info --title "Desinstalación finalizada..." --text "El proceso de eliminación de la instalación\nde MATE Reboot OS a finalizado" --no-wrap
- gksu -- sh -c 'rm -f /usr/bin/remove-bootos'
- exit
- else
- zenity --info --title "Cancelado..." --text "Proceso cancelado o contraseña incorrecta." --no-wrap
- exit
- fi
- else
- exit
- fi
- =========================================================================================
- Fichero ------> mate-rebootos
- =========================================================================================
- #!/bin/bash
- ##########################################################################################
- # By Francisco Luque Frannoe@gmail.com
- # http://lmde-frannoe.blogspot.com.es/
- # MATE RebootOS es una herramienta que nos permite seleccionar desde nuestro
- # entorno gráfico con qué sistema queremos arrancar.
- # Es necesario tener instalado el paquete "zenity" para su correcto
- # funcionamiento.
- # Esta utilidad esta basada en Unity-Reboot. Creada por Andrew de webupd8:
- # http://www.webupd8.org/2011/09/unity-reboot-ubuntu-unity-launcher-to.html.
- # Las adaptaciones y modificaciones de los paquetes fuentes han sido orientadas
- # para su funcionamiento exclusivo en MATE. Por lo cual, su buen funcionamiento
- # en otros entornos no está asegurado.
- # Tienes más información aquí:
- # http://lmde-frannoe.blogspot.com.es/2012/10/lmde-mate-reboot-os.html
- ##########################################################################################
- if [[ ! -e ~/.config/mate-rebootos/settings ]]; then
- mkdir -p ~/.config/mate-rebootos
- echo "no-password-prompt = FALSE" > ~/.config/mate-rebootos/settings
- fi
- mkdir -p ~/.local/share/applications
- cat /boot/grub/grub.cfg | grep menuentry >> /tmp/.ur_bootlist
- sed -i -e 's/.*recovery mode.*//g' -e 's/.*memtest.*//g' -e 's/menuentry //g' -e 's/ --class.*//g' -e "s/'//g" -e "s/\"//g" /tmp/.ur_bootlist
- sed -i '/^$/d' /tmp/.ur_bootlist
- awk ' !x[$0]++' /tmp/.ur_bootlist >> /tmp/.ur_bootlist2
- rm /tmp/.ur_bootlist
- cp /tmp/.ur_bootlist2 /tmp/.ur_bootlist
- rm /tmp/.ur_bootlist2 /tmp/.ur_bootlistformatted /tmp/.ur_rebootshortcuts > /dev/null 2>&1
- rm -f ~/.local/share/applications/mate-rebootos*
- BOOTLISTNRS=$(cat /tmp/.ur_bootlist | wc -l)
- n=1
- while [ $n -le $BOOTLISTNRS ];
- do
- echo Reboot$n\; | tee -a /tmp/.ur_rebootshortcuts
- n=$(( n+1 ))
- done
- awk '{ printf "%s", $0 }' /tmp/.ur_rebootshortcuts > /tmp/.ur_rebootshortcuts2
- rm /tmp/.ur_rebootshortcuts
- cp /tmp/.ur_rebootshortcuts2 /tmp/.ur_rebootshortcuts
- SHORTCUTS=$(cat /tmp/.ur_rebootshortcuts)
- current_noaskforpassword=`grep "no-password-prompt = " ~/.config/mate-rebootos/settings | sed -e 's/no-password-prompt = //g'`
- if [[ $current_noaskforpassword == "TRUE" ]]; then
- # n=1
- # while [ $n -le $BOOTLISTNRS ];
- # do
- # MENUENTRY=$(sed -n "$n{p;q;}" /tmp/.ur_bootlist)
- #echo "[Reboot$n Shortcut Group]
- # Name=$MENUENTRY
- # Exec=sh -c 'grub-reboot "\"$MENUENTRY\"" && dbus-send --session --type=method_call --print-reply --dest=org.mate.SessionManager /org/mate/SessionManager org.mate.SessionManager.RequestReboot'
- # TargetEnvironment=MATE" | tee -a ~/.local/share/applications/mate-rebootos.desktop
- # n=$(( n+1 ))
- # done
- # rm /tmp/.ur_* > /dev/null 2>&1
- n=1
- while [ $n -le $BOOTLISTNRS ];
- do
- MENUENTRY=$(sed -n "$n{p;q;}" /tmp/.ur_bootlist)
- echo "[Desktop Entry]
- Version=1.0
- Comment=Arrancar con $MENUENTRY
- Name=$n-$MENUENTRY
- Icon=mate-rebootos
- Terminal=false
- X-MultipleArgs=false
- Type=Application
- Categories=Reset-OS;
- Exec=sh -c 'echo "\"$MENUENTRY\"" > /tmp/.rboot; mate-rebootos-command && dbus-send --session --type=method_call --print-reply --dest=org.mate.SessionManager /org/mate/SessionManager org.mate.SessionManager.RequestReboot'" | tee ~/.local/share/applications/mate-rebootos-$n.desktop
- n=$(( n+1 ))
- done
- rm /tmp/.ur_* > /dev/null 2>&1
- else
- # n=1
- # while [ $n -le $BOOTLISTNRS ];
- # do
- # MENUENTRY=$(sed -n "$n{p;q;}" /tmp/.ur_bootlist)
- #echo "[Reboot$n Shortcut Group]
- # Name=$MENUENTRY
- # Exec=gksu -- sh -c 'grub-reboot "\"$MENUENTRY\"" && reboot'
- # TargetEnvironment=MATE" | tee -a ~/.local/share/applications/mate-rebootos.desktop
- # n=$(( n+1 ))
- # done
- # rm /tmp/.ur_* > /dev/null 2>&1
- n=1
- while [ $n -le $BOOTLISTNRS ];
- do
- MENUENTRY=$(sed -n "$n{p;q;}" /tmp/.ur_bootlist)
- echo "[Desktop Entry]
- Version=1.0
- Comment=Arrancar con $MENUENTRY
- Name=$n-$MENUENTRY
- Icon=mate-rebootos
- Terminal=false
- X-MultipleArgs=false
- Type=Application
- Categories=Reset-OS;
- Exec=sh -c 'echo "\"$MENUENTRY\"" > /tmp/.rboot; mate-rebootos-command && dbus-send --session --type=method_call --print-reply --dest=org.mate.SessionManager /org/mate/SessionManager org.mate.SessionManager.RequestReboot'" | tee ~/.local/share/applications/mate-rebootos-$n.desktop
- n=$(( n+1 ))
- done
- rm /tmp/.ur_* > /dev/null 2>&1
- fi
- echo "[Desktop Entry]
- Name=Mate Rebootos Settings
- Icon=mate-rebootos-settings
- Terminal=false
- X-MultipleArgs=false
- Type=Application
- Categories=Reset-OS;
- Exec=mate-rebootos-settings" | tee ~/.local/share/applications/mate-rebootos.Settings.desktop
- echo "[Desktop Entry]
- Name=x-Eliminar Mate Reboot OS
- Comment=Elimina totalmente Mate Reboot OS del sistema.
- Icon=mate-rebootos-settings
- Terminal=false
- X-MultipleArgs=false
- Type=Application
- Categories=Reset-OS;
- Exec=remove-bootos" | tee ~/.local/share/applications/mate-rebootos-remove.desktop
- =========================================================================================
- Fichero ------> mate-rebootos-command
- =========================================================================================
- #!/bin/bash
- ##########################################################################################
- # By Francisco Luque Frannoe@gmail.com
- # http://lmde-frannoe.blogspot.com.es/
- # MATE RebootOS es una herramienta que nos permite seleccionar desde nuestro
- # entorno gráfico con qué sistema queremos arrancar.
- # Es necesario tener instalado el paquete "zenity" para su correcto
- # funcionamiento.
- # Esta utilidad esta basada en Unity-Reboot. Creada por Andrew de webupd8:
- # http://www.webupd8.org/2011/09/unity-reboot-ubuntu-unity-launcher-to.html.
- # Las adaptaciones y modificaciones de los paquetes fuentes han sido orientadas
- # para su funcionamiento exclusivo en MATE. Por lo cual, su buen funcionamiento
- # en otros entornos no está asegurado.
- # Tienes más información aquí:
- # http://lmde-frannoe.blogspot.com.es/2012/10/lmde-mate-reboot-os.html
- ##########################################################################################
- current_noaskforpassword=`grep "no-password-prompt = " ~/.config/mate-rebootos/settings | sed -e 's/no-password-prompt = //g'`
- if [[ $current_noaskforpassword == "TRUE" ]]; then
- /usr/sbin/grub-reboot "$(cat /tmp/.rboot)"
- else
- gksu grub-reboot "$(cat /tmp/.rboot)"
- fi
- =========================================================================================
- Fichero ------> mate-rebootos-settings
- =========================================================================================
- #!/bin/bash
- ##########################################################################################
- # By Francisco Luque Frannoe@gmail.com
- # http://lmde-frannoe.blogspot.com.es/
- # MATE RebootOS es una herramienta que nos permite seleccionar desde nuestro
- # entorno gráfico con qué sistema queremos arrancar.
- # Es necesario tener instalado el paquete "zenity" para su correcto
- # funcionamiento.
- # Esta utilidad esta basada en Unity-Reboot. Creada por Andrew de webupd8:
- # http://www.webupd8.org/2011/09/unity-reboot-ubuntu-unity-launcher-to.html.
- # Las adaptaciones y modificaciones de los paquetes fuentes han sido orientadas
- # para su funcionamiento exclusivo en MATE. Por lo cual, su buen funcionamiento
- # en otros entornos no está asegurado.
- # Tienes más información aquí:
- # http://lmde-frannoe.blogspot.com.es/2012/10/lmde-mate-reboot-os.html
- ##########################################################################################
- current_noaskforpassword=`grep "no-password-prompt = " ~/.config/mate-rebootos/settings | sed -e 's/no-password-prompt = //g'`
- case "$current_noaskforpassword" in
- TRUE)
- Activado=\T"RUE"
- Desactivado=\F"ALSE"
- ;;
- FALSE)
- Activado=\F"ALSE"
- Desactivado=\T"RUE"
- ;;
- *)
- zenity --info --title "Error..." --text "Contenido erróneo en el archivo de <b>$HOME/.config/mate-rebootos/settings</b>\nPara correjir esto la única línea que debe contener este archivo es:\n\n<b>no-password-prompt = FALSE</b> o con el valor <b>TRUE</b>.\n\nTambién puede eliminar y volver a instalar Mate Reboot OS." --no-wrap
- exit
- esac
- R_SETTINGS=$(zenity --list --title "Mate Reboot OS" --text "-------------------- <b>¡Advertencia!</b> --------------------\n Activar ésto supone que /usr/bin/grub-editenv\n podrá ser ejecutado por cualquier usuario." --height "200" --width "300" --radiolist --column "#" --column "Estado en que se encuentra el Servicio" $Activado "Activado (No se solicita clave Root)" $Desactivado "Desactivado (Se solicita clave Root)")
- ret=$?
- case "$R_SETTINGS" in
- 'Activado (No se solicita clave Root)')
- R_SETTINGS="TRUE"
- ;;
- 'Desactivado (Se solicita clave Root)')
- R_SETTINGS="FALSE"
- ;;
- *)
- exit
- esac
- if [[ $ret -eq 0 ]]; then
- R_password=`echo "$R_SETTINGS" | cut -d '|' -f1`
- if [[ "$R_password" == "TRUE" ]]; then
- gksu -- sh -c 'chmod +s /usr/bin/grub-editenv'
- if [ $? -eq 0 ]
- then
- sed -i "s/no-password-prompt = .*/no-password-prompt = $R_password/g" ~/.config/mate-rebootos/settings
- else
- exit
- fi
- else
- gksu -- sh -c 'chmod -s /usr/bin/grub-editenv'
- if [ $? -eq 0 ]
- then
- sed -i "s/no-password-prompt = .*/no-password-prompt = $R_password/g" ~/.config/mate-rebootos/settings
- else
- exit
- fi
- fi
- mate-rebootos
- else
- exit
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement