From 69f151723597f11cb60d1e1a9a04d9627bb6b452 Mon Sep 17 00:00:00 2001 From: Ned Bingham Date: Mon, 26 Sep 2022 14:59:06 -0400 Subject: [PATCH] adding error handling --- bcli-develop.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bcli-develop.sh b/bcli-develop.sh index d9ac9dd..24888d6 100644 --- a/bcli-develop.sh +++ b/bcli-develop.sh @@ -6,10 +6,20 @@ bcli() { docker stop bcli-develop > /dev/null echo "bcli-develop stopped" elif [ "$1" = "mount" ]; then - mkdir -p $HOME/tech - sshfs $BROCCOLI_USER@broccolimicro.io:/opt/tech $HOME/tech/ + if [ -z "$BROCCOLI_USER" ]; then + echo "Please set the BROCCOLI_USER environment variable for ssh access." + else + mkdir -p $HOME/tech + sshfs $BROCCOLI_USER@broccolimicro.io:/opt/tech $HOME/tech/ + fi elif [ "$1" = "unmount" ]; then - umount $HOME/tech + shift + if [ "$1" = "-f" ]; then + pkill -KILL sshfs + fusermount -u $HOME/tech + else + umount $HOME/tech + fi rmdir $HOME/tech else docker exec -u $(id -u):$(id -g) -it bcli-develop /bin/bash