From 19d383a7e2db2843a7a13c275fe20b08a4afb032 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 24 Oct 2019 22:55:46 -0500 Subject: [PATCH] Tweaks to ./restore. Only attempt sudo when needed, vet myself as willing to use it --- 2019-kvm-forum/restore | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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 -- 1.8.3.1