tarinaretake

git clone https://git.tarina.org/tarinaretake
Log | Files | Refs | README | LICENSE

restorebak.sh (503B)


      1 #!/bin/bash
      2 
      3 ROOT_UID=0   # Root has $UID 0.
      4 
      5 if [ "$UID" -eq "$ROOT_UID" ]
      6 then
      7    echo "OK"
      8 else
      9     echo "Run with sudo!"
     10     echo "sudo ./restorebak.sh"
     11     exit 0
     12 fi
     13 
     14 while true; do
     15     read -p "Undo rpi-update? [y]es or [n]o?" yn
     16     case $yn in
     17         [Yy]* ) echo "Restoring from backup now..."
     18 cp -r /boot.bak/* /boot/
     19 cp -r /lib/modules.bak/* /lib/modules/
     20             break;;
     21         [Nn]* ) echo "Yes, sir! we are done!";break;;
     22         * ) echo "Please answer yes or no.";;
     23     esac
     24 done
     25