From 23c628c9b8daba265ba188459a54d7ac4b4386f9 Mon Sep 17 00:00:00 2001
From: Matei Adriel <rafaeladriel11@gmail.com>
Date: Thu, 18 Jan 2024 02:37:01 +0100
Subject: [PATCH] Allow already mounted keys in emergency script

---
 scripts/emergency-lapetus.sh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/emergency-lapetus.sh b/scripts/emergency-lapetus.sh
index dfbd537..19797cf 100755
--- a/scripts/emergency-lapetus.sh
+++ b/scripts/emergency-lapetus.sh
@@ -20,9 +20,13 @@ if [ "$#" != "1" ] && [ "$2" != "install" ] && [ "$2" != "enter" ]; then
     exit 1
 fi
 
-echo "Mounting keys"
-mkdir /hermes
-mount /dev/disk/by-uuid/7FE7-CA68 /hermes
+if mountpoint -q /hermes; then 
+  echo "Keys already mounted"
+else
+  echo "Mounting keys"
+  mkdir -p /hermes
+  mount /dev/disk/by-uuid/7FE7-CA68 /hermes
+fi
 
 echo "Running disko"