Skip to content

Commit 08d4683

Browse files
committed
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.
1 parent a776b3d commit 08d4683

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

mithril-install.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,19 @@ esac
9595
# Set temp file
9696
TEMP_FILE="${INSTALL_PATH}/temp.json"
9797

98-
# Create the install path if it doesn't exist
99-
mkdir -p "$INSTALL_PATH"
100-
10198
# Check if node and path are provided
10299
if [ -z "$NODE" ] || [ -z "$DISTRIBUTION" ] || [ -z "$INSTALL_PATH" ]; then
103100
usage
104101
fi
105102

103+
# Create the install path if it doesn't exist
104+
mkdir -p "$INSTALL_PATH"
105+
106+
# Check if install path is writable
107+
if [ ! -w "$INSTALL_PATH" ]; then
108+
error_exit "Error: The specified install path '$INSTALL_PATH' is not writable."
109+
fi
110+
106111
# Validate node
107112
if [ "$NODE" != "mithril-signer" ] && [ "$NODE" != "mithril-aggregator" ] && [ "$NODE" != "mithril-client" ]; then
108113
echo "Invalid node: $NODE"

0 commit comments

Comments
 (0)