There is no need to install in the global path nor to use SUDO if the given path was writtable (#18)

* There's no need for sudo + Added warning if not in PATH

* fix: removed duplicated command call

---------

Co-authored-by: v4n <105587619+v4n00@users.noreply.github.com>
This commit is contained in:
Catherine Guelque
2025-02-17 17:07:54 +01:00
committed by GitHub
parent d18a9cdccf
commit 0485b56df5
+9 -3
View File
@@ -135,11 +135,17 @@ else
fi fi
echo "Installing $SCRIPT_NAME to $DESTINATION_PATH." echo "Installing $SCRIPT_NAME to $DESTINATION_PATH."
sudo curl "$REPO_URL"/h2mm --output "$DESTINATION_PATH/$SCRIPT_NAME" if [ -r "$DESTINATION_PATH" ]; then
sudo chmod +x "$DESTINATION_PATH/$SCRIPT_NAME" curl "$REPO_URL"/h2mm --output "$DESTINATION_PATH/$SCRIPT_NAME"
chmod +x "$DESTINATION_PATH/$SCRIPT_NAME"
else
sudo curl "$REPO_URL"/h2mm --output "$DESTINATION_PATH/$SCRIPT_NAME"
sudo chmod +x "$DESTINATION_PATH/$SCRIPT_NAME"
fi
if [[ ! -x "$(command -v $SCRIPT_NAME)" ]]; then if [[ ! -x "$(command -v $SCRIPT_NAME)" ]]; then
echo -e "${RED}Error:${NC} Installation failed." echo -e "${RED}Error:${NC} Installation failed. Mod manager was not found in PATH."
exit 1 exit 1
fi fi