From 33403a69f1579a38d8b5f76153b43b58e672f6c9 Mon Sep 17 00:00:00 2001 From: v4n <105587619+v4n00@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:25:43 +0200 Subject: [PATCH] feat: added install script --- README.md | 7 +++++++ h2mm | 6 +++--- install.sh | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 README.md create mode 100755 install.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..7487e66 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# h2mm-cli + +install + +```bash +sh -c "$(curl -fsSL https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master/install.sh)" +``` diff --git a/h2mm b/h2mm index 9cbfcb6..3992452 100755 --- a/h2mm +++ b/h2mm @@ -73,10 +73,10 @@ function display_help() { echo " install -n \"\" Install a mod with a name and files." echo " list List all installed mods." echo " uninstall -n \"\" Uninstall a mod by name." - echo " export \"\" Export installed mods to a zip file." - echo " import \"\" Import mods from a zip file." + echo " export \"\" Export installed mods to a zip file (not yet implemented)." + echo " import \"\" Import mods from a zip file (not yet implemented)." echo " help Display this help message." - echo "For more information, use h2mm [command] --help" + echo "For more information, use h2mm [command] --help, available for install and uninstall." echo "Basic Usage:" echo " h2mm install -n \"Example mod\" a5f2c029522e6714.patch_0 a5f2c029522e6714.patch_0.stream" echo " h2mm uninstall -n \"Example mod\"" diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..4d4b2c4 --- /dev/null +++ b/install.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -e + +if [ "$(id -u)" -eq 0 ]; then + echo "Run me as normal user, not as root." + exit 1 +fi + +DESTINATION_PATH="/usr/local/bin" +SCRIPT_NAME="h2mm" + +echo "Installing $SCRIPT_NAME..." +sudo curl https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master/h2mm --output "$DESTINATION_PATH/$SCRIPT_NAME" +sudo chmod +x "$DESTINATION_PATH/$SCRIPT_NAME" + +if [[ ! -x "$(command -v $SCRIPT_NAME)" ]]; then + echo "Installation failed." + exit 1 +fi + +echo "Helldivers 2 Mod Manager CLI installed successfully to $DESTINATION_PATH/$SCRIPT_NAME."