#!/bin/bash #Author: Lampslave #URL: http://lampslave.ru #License: GPLv3 #This is code monkey's remake of unity-reboot #Are you root? if [ $USER != root ]; then echo "Only root can do it!" exit 0 fi #Stuff echo "Wizard is working!" #Prepare configs sed -i s/.*GRUB_DEFAULT=.*/GRUB_DEFAULT=saved/g /etc/default/grub grub-set-default 0 grub-mkconfig -o /boot/grub/grub.cfg #Grep OS grep "menuentry" /boot/grub/grub.cfg > /tmp/rebooter-grublist sed -i -e 's/menuentry //g' -e 's/ --class.*//g' -e "s/'//g" -e "s/\"//g" -e "s/\ {//g" /tmp/rebooter-grublist #Set path echo "Enter path to your shortcuts dir, like \"/home/user\"" read home while [ -z "$home" ] do echo "Like \"/home/user\"!" read home done #Make shortcuts saved=0 while read line do if [ "$(echo $line | grep -o 'recovery mode')" = "recovery mode" ]; then let saved++ continue fi if [ "$(echo $line | grep -o 'memtest')" = "memtest" ]; then let saved++ continue fi if [ "$(echo $line | grep -o 'Fallback')" = "Fallback" ]; then let saved++ continue fi echo "[Desktop Entry] Type=Application Version=1.0 Name=Reboot to $line GenericName=Reboot to $line Comment=Reboot to $line Exec=gksu -- sh -c 'grub-reboot $saved && reboot' Icon=gnome-shutdown Terminal=false Categories=System" > $home/rebooter-$saved.desktop let saved++ done < /tmp/rebooter-grublist #Clean rm /tmp/rebooter-grublist #Done echo "Finished. Enjoy :)"