From: Eric Blake Date: Fri, 25 Oct 2019 03:55:46 +0000 (-0500) Subject: Tweaks to ./restore. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=19d383a7e2db2843a7a13c275fe20b08a4afb032;p=libguestfs-talks.git Tweaks to ./restore. Only attempt sudo when needed, vet myself as willing to use it --- diff --git a/2019-kvm-forum/restore b/2019-kvm-forum/restore index c25a368..620e30e 100755 --- a/2019-kvm-forum/restore +++ b/2019-kvm-forum/restore @@ -1,14 +1,18 @@ #!/bin/bash - -# Only do this on Rich's laptop. -if [ "$LOGNAME" = "rjones" ]; then - if [ "$talkdir" = "" ]; then exit 1; fi +# Safety-valve for unwary users... +if [ "$LOGNAME" != "rjones" ] && [ "$LOGNAME" != "eblake" ]; then + exit 1 +fi - fusermount -u $talkdir/6200-vddk.d/mp >& /dev/null +if [ "$talkdir" = "" ]; then exit 1; fi - sudo rm -rf $talkdir/6400-boot.d/root +fusermount -u $talkdir/6200-vddk.d/mp >& /dev/null - sleep 0.5; killall nbdkit >& /dev/null +if [ -d "$talkdir/6400-boot.d/root" ]; then + sudo rm -rf $talkdir/6400-boot.d/root fi +sleep 0.5; killall nbdkit >& /dev/null + exit 0