From 15345c21a5dc78ba9e90ecb76e898f72281d8828 Mon Sep 17 00:00:00 2001 From: Michael Scalzetti Date: Tue, 22 Mar 2022 02:05:02 -0400 Subject: [PATCH] added a bit of error handling --- run.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/run.sh b/run.sh index 2078dc9..b00ab57 100755 --- a/run.sh +++ b/run.sh @@ -1,22 +1,26 @@ DEV_USB=$1 MOUNT_NAME=priv MOUNT_DIR=/media/michael/priv - +LOC=0 echo "Locking db..." -cryptsetup luksOpen $DEV_USB $MOUNT_NAME +cryptsetup luksOpen $DEV_USB $MOUNT_NAME || \ + echo "Issue unlocking db... quitting" &&\ + exit 1 + echo "Mounting db..." mkdir $MOUNT_DIR -mount /dev/mapper/$MOUNT_NAME $MOUNT_DIR +rm -rf $MOUNT_DIR +mount /dev/mapper/$MOUNT_NAME $MOUNT_DIR || \ + echo "Issue mounting db... quiting..." &&\ + exit 1 - -echo "Remaking link..." rm -rf ./data.link ln -s "$MOUNT_DIR/notes" ./data.link echo "Starting container..." -docker run --name privmd --rm -it -v `pwd`/data.link/:/notes `docker build -q .` +docker run --name priv --rm -it -v `pwd`/data.link/:/notes `docker build -q .` echo "Unmounting db..." umount -f "$MOUNT_DIR"