From 08d4683f25f1039d1c303f5febb398e3204b545f Mon Sep 17 00:00:00 2001 From: Damien Lachaume <135982616+dlachaume@users.noreply.github.com> Date: Wed, 30 Jul 2025 11:28:13 +0200 Subject: [PATCH] fix: add step to check write permission on install path Also moved the creation of the install path after argument parsing to avoid creating a directory with an undefined value. --- mithril-install.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mithril-install.sh b/mithril-install.sh index df830619561..cbdc0e0e7e8 100755 --- a/mithril-install.sh +++ b/mithril-install.sh @@ -95,14 +95,19 @@ esac # Set temp file TEMP_FILE="${INSTALL_PATH}/temp.json" -# Create the install path if it doesn't exist -mkdir -p "$INSTALL_PATH" - # Check if node and path are provided if [ -z "$NODE" ] || [ -z "$DISTRIBUTION" ] || [ -z "$INSTALL_PATH" ]; then usage fi +# Create the install path if it doesn't exist +mkdir -p "$INSTALL_PATH" + +# Check if install path is writable +if [ ! -w "$INSTALL_PATH" ]; then + error_exit "Error: The specified install path '$INSTALL_PATH' is not writable." +fi + # Validate node if [ "$NODE" != "mithril-signer" ] && [ "$NODE" != "mithril-aggregator" ] && [ "$NODE" != "mithril-client" ]; then echo "Invalid node: $NODE"