commit 4916db6401134667804fac6c09a25b2f8ef893ee parent 64bf55453d75c4dd17b63f123d14534966ebfc4f Author: rbckman <rob@tarina.org> Date: Fri, 31 May 2019 13:44:54 +0100 restore from bak if rpi-update Diffstat:
A | extras/restorebak.sh | | | 25 | +++++++++++++++++++++++++ |
1 file changed, 25 insertions(+), 0 deletions(-)
diff --git a/extras/restorebak.sh b/extras/restorebak.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +ROOT_UID=0 # Root has $UID 0. + +if [ "$UID" -eq "$ROOT_UID" ] +then + echo "OK" +else + echo "Run with sudo!" + echo "sudo ./restorebak.sh" + exit 0 +fi + +while true; do + read -p "Undo rpi-update? [y]es or [n]o?" yn + case $yn in + [Yy]* ) echo "Restoring from backup now..." +cp -r /boot.bak/* /boot/ +cp -r /lib/modules.bak/* /lib/modules/ + break;; + [Nn]* ) echo "Yes, sir! we are done!";break;; + * ) echo "Please answer yes or no.";; + esac +done +