Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 093d849c19 | |||
| c98e0094ce | |||
| 2ffc669010 | |||
| 9bfa8923fe | |||
| 87ec07b10a | |||
| 687bdf6709 | |||
| 3bf4a5e542 | |||
| c72ceb899e | |||
| 7c9544f419 | |||
| 9627ee199f | |||
| 53d9f8a093 | |||
| 96163fc7d9 | |||
| 84cbc80eb2 | |||
| 423ea1280d | |||
| 05548ca460 | |||
| 30649e0312 | |||
| c3d76c625c | |||
| a9a17a7617 | |||
| 711d416e49 | |||
| a9e11211f4 | |||
| 1d35ac00d7 | |||
| 5b10fbf364 | |||
| 1f2a34dc5b | |||
| 159dd47851 | |||
| 73cd330ab0 | |||
| 2efed53b4c | |||
| b501f642c9 | |||
| 28684be2de | |||
| 397b50bc19 | |||
| 61a15ef816 | |||
| d435bb35ac | |||
| a75d92252e | |||
| 2c51e2bfd3 | |||
| 1c1235c85e | |||
| 7cedfcb451 | |||
| 0fdc5a2306 | |||
| 13dc822fd9 | |||
| 35302aa7c7 | |||
| ebadc049e7 | |||
| 649404c2d4 | |||
| 737fa01c11 | |||
| 0ac711085b |
@@ -2,132 +2,66 @@
|
|||||||
|
|
||||||
Helldivers 2 Mod Manager CLI is a command line interface for managing Helldivers 2 mods. Since there is no Linux mod manager available and I like being a nerd by using CLI tools instead of GUIs, this project was born.
|
Helldivers 2 Mod Manager CLI is a command line interface for managing Helldivers 2 mods. Since there is no Linux mod manager available and I like being a nerd by using CLI tools instead of GUIs, this project was born.
|
||||||
|
|
||||||
This script is complete, the version will always [remain at 0.x.x](https://0ver.org/)
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Pre-requisites:
|
Pre-requisites:
|
||||||
|
|
||||||
- You must have the `unzip` package installed for zip archives;
|
- The `unzip` package must be installed for ZIP archives.
|
||||||
- You might want to have the `unarchiver` package installed for rar archives.
|
- The `unarchiver` package is recommended for RAR and 7Z archives.
|
||||||
|
|
||||||
> The `unzip` package comes pre-installed on most Linux distributions. If you do not know how to install packages, search for your Linux distro and package manager.
|
To install Helldivers 2 Mod Manager CLI run the following command in the terminal:
|
||||||
|
|
||||||
To install Helldivers 2 Mod Manager CLI run the following command in your terminal:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master/install.sh)"
|
bash -c "$(curl -fsSL https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master/install.sh)"
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!CAUTION]
|
|
||||||
> Running this script will require sudo permissions. **DO NOT TRUST** random scripts from the internet. If you want to review the script before running it, check out the mod repository for yourself.
|
|
||||||
|
|
||||||
If for some reason, the installation command doesn't work you can:
|
|
||||||
|
|
||||||
1. Go to <https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master/install.sh>
|
|
||||||
1. Right click -> Save page as...
|
|
||||||
1. Open your terminal
|
|
||||||
1. Go to your downloads folders with `cd ~/Downloads`
|
|
||||||
1. Give the script execution permissions `chmod +x install.sh`
|
|
||||||
1. Run the script `./install.sh`
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
The script gets added to `/usr/local/bin/h2mm` and can be used by running `h2mm` in your shell, which will show the help message explaining how to use the script.
|
The script gets added to `/usr/local/bin/h2mm` (or `$HOME/.local/bin` on Steam Deck) and can be used by running `h2mm` in the shell, which will print the help message along with all available commands.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
h2mm
|
h2mm --help
|
||||||
```
|
```
|
||||||
|
|
||||||
### Available commands
|
To find out how to use a command, run `h2mm COMMAND --help`. This is the most up-to-date source of information about the commands.
|
||||||
|
|
||||||
- `install` or `i` - Install a mod by the file provided (directory, zip, patch);
|
## Available commands
|
||||||
- `uninstall` or `u` - Uninstall a mod;
|
|
||||||
- `list` or `l` - List all installed mods;
|
|
||||||
- `enable` or `e` - Enable a mod;
|
|
||||||
- `disable` or `d` - Disable a mod;
|
|
||||||
- `order` or `o` - Change load order for a mod;
|
|
||||||
- `export` or `ex` - Export installed mods to a zip file;
|
|
||||||
- `import` or `im` - Import mods from a zip file;
|
|
||||||
- `modpack-create` or `mc` - Create a modpack from the currently installed mods;
|
|
||||||
- `modpack-switch` or `ms` - Switch to a modpack;
|
|
||||||
- `modpack-list` or `ml` - List all installed modpacks;
|
|
||||||
- `modpack-delete` or `md` - Delete a modpack;
|
|
||||||
- `modpack-overwrite` or `mo` - Overwrite a modpack;
|
|
||||||
- `modpack-reset` or `mr` - Reset all installed modpacks;
|
|
||||||
- `nexus-setup` or `ns` - Setup Nexus Mods integration;
|
|
||||||
- `nexus-update` or `nu` - Start Nexus mods upgrade process;
|
|
||||||
- `update` or `up` - Update h2mm to latest version;
|
|
||||||
- `reset` or `r` - Reset all installed mods;
|
|
||||||
- `help` or `h` - Display this help message.
|
|
||||||
|
|
||||||
### Usage
|
- `install` or `i` - Install a mod by the file provided (directory, zip, patch)
|
||||||
|
- `uninstall` or `u` - Uninstall a mod
|
||||||
|
- `list` or `l` - List all installed mods
|
||||||
|
- `enable` or `e` - Enable a mod
|
||||||
|
- `disable` or `d` - Disable a mod
|
||||||
|
- `rename` or `r` - Rename a mod
|
||||||
|
- `order` or `o` - Change load order for a mod
|
||||||
|
- `export` or `ex` - Export installed mods to a zip file
|
||||||
|
- `import` or `im` - Import mods from a zip file
|
||||||
|
- `modpack` or `m` - Manage modpacks (collections of mods)
|
||||||
|
- `nexus-setup` or `ns` - Setup Nexus Mods integration
|
||||||
|
- `update` or `up` - Update h2mm to latest version
|
||||||
|
- `reset` or `rs` - Reset all installed mods
|
||||||
|
- `help` or `h` - Display this help message
|
||||||
|
|
||||||
To find out how to use a command, you can run `h2mm <COMMAND> --help`.
|
## Examples
|
||||||
|
|
||||||
#### Install mod(s)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
h2mm install /path/to/mod.zip
|
|
||||||
h2mm install /path/to/mod/directory/
|
|
||||||
h2mm install /path/to/mod.zip /path/to/mod2.zip /path/to/mod/files
|
|
||||||
h2mm install -n "Example mod" mod.patch_0 mod.patch_0.stream # -n is mandatory when using files
|
|
||||||
```
|
|
||||||
|
|
||||||
> It's better to be in the directory where the mod files are located, so you don't have to specify the full path. For mod downloads, you can do `cd ~/Downloads` and then run the command.
|
|
||||||
>
|
|
||||||
> Also, use the Tab key to autocomplete the file names, as it will help you escape special characters likes spaces or quotes.
|
|
||||||
|
|
||||||
#### List installed mods
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
h2mm install --help
|
||||||
|
h2mm install ~/Downloads/mod.zip
|
||||||
|
h2mm install ~/Downloads/mod\ files/
|
||||||
|
h2mm install a0b1c2d3.patch_0 a0b1c2d3.patch_0.stream -n "Example mod"
|
||||||
h2mm list
|
h2mm list
|
||||||
h2mm list -v # verbose mode
|
h2mm uninstall --index 3
|
||||||
|
h2mm modpack create "Example modpack"
|
||||||
|
h2mm modpack switch "Example modpack"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Uninstall a mod
|
> When installing, it is recommended to be in the directory where mod archives are, or to use absolute paths. Use `cd ~/Downloads` to go to the Downloads folder, and run `ls -la` to find the archives to install. Use the Tab key to auto-complete file and folder names, this helps escape spaces and special characters.
|
||||||
|
>
|
||||||
```bash
|
> Use the `--index` flag with commands that normally require a mod name to specify a mod by its index. The index can be obtained with `h2mm list`.
|
||||||
h2mm uninstall -n "Example mod"
|
|
||||||
h2mm uninstall -i 3 # get the index from the list command
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Enable/disable mods
|
|
||||||
|
|
||||||
```bash
|
|
||||||
h2mm enable -n "Example mod"
|
|
||||||
h2mm enable -i 3
|
|
||||||
h2mm disable -n "Example mod"
|
|
||||||
h2mm disable -i 3
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Updating the script
|
|
||||||
|
|
||||||
```bash
|
|
||||||
h2mm update
|
|
||||||
```
|
|
||||||
|
|
||||||
## Nexus Mods integration
|
## Nexus Mods integration
|
||||||
|
|
||||||
Nexus Mods integration allows you to use the 1-click install feature of Nexus Mods (with the "Vortex" or "Mod manager download" buttons). You can set up Nexus Mods integration by running the following command:
|
Nexus Mods integration allows the use the 1-click install feature of Nexus Mods (with the "Vortex" or "Mod manager download" buttons). Set up Nexus Mods integration by running `h2mm nexus-setup`. Setup includes providing the Nexus Mods API key and selecting the preferred terminal.
|
||||||
|
|
||||||
```bash
|
|
||||||
h2mm nexus-setup
|
|
||||||
```
|
|
||||||
|
|
||||||
You will be walked through the setup process, which will ask you for your Nexus Mods API key and your preferred terminal.
|
|
||||||
|
|
||||||
## Compatibility
|
|
||||||
|
|
||||||
The script is developed and tested on Arch Linux, but it should work on other Linux distributions as well. If you encounter any issues, please open an issue on the repository.
|
|
||||||
|
|
||||||
Status of platforms:
|
|
||||||
|
|
||||||
- Linux :white_check_mark:
|
|
||||||
- Steam Deck :white_check_mark:
|
|
||||||
- Windows - WSL :white_check_mark:
|
|
||||||
|
|
||||||
> The script works on WSL, but you need to specify the path to the Helldivers 2 mods directory manually, to find your Windows partition head to `/mnt/` and from there go to your Helldivers 2 data directory, on a typical install it should be on `/mnt/c/Program\ Files\ \(x86\)/Steam/steamapps/common/Helldivers\ 2/data`. You also need to have `unzip` installed, which can be done by running `sudo apt install unzip`. Nexus Mods integration is not supported on WSL.
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|||||||
+67
-47
@@ -7,7 +7,6 @@ ORANGE='\033[0;33m'
|
|||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
||||||
DESTINATION_PATH="/usr/local/bin"
|
DESTINATION_PATH="/usr/local/bin"
|
||||||
SCRIPT_NAME="h2mm"
|
|
||||||
REPO_URL="https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master"
|
REPO_URL="https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master"
|
||||||
|
|
||||||
function log() {
|
function log() {
|
||||||
@@ -28,17 +27,7 @@ function log() {
|
|||||||
|
|
||||||
# --- Main ---
|
# --- Main ---
|
||||||
|
|
||||||
# warning
|
log INFO "Running h2mm CLI Installer (https://github.com/v4n00/h2mm-cli)"
|
||||||
|
|
||||||
cat << EOF
|
|
||||||
!!! WARNING !!!
|
|
||||||
This script will install Helldivers 2 Mod Manager CLI for Linux to $DESTINATION_PATH/$SCRIPT_NAME.
|
|
||||||
Running this script will require sudo permissions. DO NOT TRUST random scripts from the internet.
|
|
||||||
If you want to review the script before running it, check out the mod repository for yourself:
|
|
||||||
https://github.com/v4n00/h2mm-cli
|
|
||||||
!!! WARNING !!!
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# breaking changes hash table
|
# breaking changes hash table
|
||||||
breaking_changes_patches=(
|
breaking_changes_patches=(
|
||||||
@@ -46,19 +35,21 @@ breaking_changes_patches=(
|
|||||||
["3"]='sed -i "1 i\\3" "$1/mods.csv"'
|
["3"]='sed -i "1 i\\3" "$1/mods.csv"'
|
||||||
["4"]='tmp_file=$(mktemp) && awk '\''BEGIN {FS=OFS=","} NR==1 {print 4; next} {print NR-1, $2, $3, $4, $5}'\'' "$1/mods.csv" > "$tmp_file" && tee "$1/mods.csv" < "$tmp_file" > /dev/null && rm "$tmp_file"'
|
["4"]='tmp_file=$(mktemp) && awk '\''BEGIN {FS=OFS=","} NR==1 {print 4; next} {print NR-1, $2, $3, $4, $5}'\'' "$1/mods.csv" > "$tmp_file" && tee "$1/mods.csv" < "$tmp_file" > /dev/null && rm "$tmp_file"'
|
||||||
["5"]='sed -i "s/^\([0-9]\+\),\(.*\),\(.*\),\(.*\)/\1,\2,\3,,,,\4/" "$1/mods.csv"; sed -i "1 s/4/5/" "$1/mods.csv"'
|
["5"]='sed -i "s/^\([0-9]\+\),\(.*\),\(.*\),\(.*\)/\1,\2,\3,,,,\4/" "$1/mods.csv"; sed -i "1 s/4/5/" "$1/mods.csv"'
|
||||||
|
["6"]='sed -i "s/^\([0-9]\+\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\)/\1,\2,\3,\4,\6,\7/" "$1/mods.csv"; sed -i "1 s/5/6/" "$1/mods.csv"'
|
||||||
)
|
)
|
||||||
|
|
||||||
# notify if update is happening
|
# notify if update is happening
|
||||||
installed_version=""
|
installed_version=""
|
||||||
latest_version=""
|
latest_version=""
|
||||||
if [[ -x "$(command -v $SCRIPT_NAME)" ]]; then
|
if [[ -x "$(command -v h2mm)" ]]; then
|
||||||
installed_version=$($SCRIPT_NAME --version)
|
installed_version=$(h2mm --version)
|
||||||
|
|
||||||
# if installed version isn't x.x.x crash
|
# if installed version isn't x.x.x crash
|
||||||
if [[ ! "$installed_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
if [[ ! "$installed_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
log ERROR "Installed version is not in the correct format."
|
log ERROR "Installed version is not in the correct format."
|
||||||
log ERROR "h2mm is installed here -> $(which h2mm)"
|
log ERROR "h2mm is installed here -> $(which h2mm)"
|
||||||
log ERROR "Delete the script file and retry the install script, any mods installed will not be lost."
|
log ERROR "Delete the script file and retry the install script, any mods installed will not be lost."
|
||||||
|
log INFO 'Download using the command: bash -c "$(curl -fsSL https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master/install.sh)"'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -70,37 +61,44 @@ if [[ -x "$(command -v $SCRIPT_NAME)" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if steam deck, set destination path to ~/.local/bin
|
# if steam os, set destination path to ~/.local/bin
|
||||||
log PROMPT "Are you installing on a Steam Deck? (y/N): "
|
steamos=false
|
||||||
IFS= read -e response_sd
|
|
||||||
|
|
||||||
if [[ "$response_sd" == "y" || "$response_sd" == "Y" ]]; then
|
if [[ -f "/etc/os-release" ]]; then
|
||||||
# steam deck
|
if grep -q "ID=steamos" /etc/os-release; then
|
||||||
|
steamos=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $steamos == true ]]; then
|
||||||
|
# steam os
|
||||||
DESTINATION_PATH="$HOME/.local/bin"
|
DESTINATION_PATH="$HOME/.local/bin"
|
||||||
|
log INFO "Detected SteamOS, setting installation path to ${ORANGE}$DESTINATION_PATH${NC}."
|
||||||
|
|
||||||
mkdir -p "$DESTINATION_PATH"
|
mkdir -p "$DESTINATION_PATH"
|
||||||
|
|
||||||
# check if ~/.local/bin is in PATH
|
# check if ~/.local/bin is in PATH
|
||||||
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
|
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
|
||||||
# add ~/.local/bin to PATH
|
# add ~/.local/bin to PATH
|
||||||
log INFO "Installing the script on a Steam Deck means adding $DESTINATION_PATH to your \$PATH."
|
log INFO "Installing the script on SteamOS means adding ${ORANGE}$DESTINATION_PATH${NC} to your \$PATH."
|
||||||
log INFO "If you're using a different shell than bash (the default), you may need to add it manually."
|
log INFO "If you're using a different shell than bash (the default), you may need to add it manually."
|
||||||
|
|
||||||
log PROMPT "Do you want to add $DESTINATION_PATH to your \$PATH in ~/.bashrc? (Y/n): "
|
log PROMPT "Do you want to automatically add ${ORANGE}$DESTINATION_PATH${NC} to your \$PATH in ~/.bashrc? (Y/n): "
|
||||||
IFS= read -e response
|
IFS= read -e response
|
||||||
if [[ "$response" == "y" || "$response" = "Y" || -z "$response" ]]; then
|
if [[ "$response" == "y" || "$response" = "Y" || -z "$response" ]]; then
|
||||||
echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> "$HOME/.bashrc"
|
echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> "$HOME/.bashrc"
|
||||||
[[ $? -ne 0 ]] && { log ERROR "Failed to add $DESTINATION_PATH to \$PATH in ~/.bashrc." ; exit 1; }
|
[[ $? -ne 0 ]] && { log ERROR "Failed to add $DESTINATION_PATH to \$PATH in ~/.bashrc." ; exit 1; }
|
||||||
|
|
||||||
source "$HOME/.bashrc"
|
source "$HOME/.bashrc"
|
||||||
[[ $? -ne 0 ]] && { log ERROR "Failed to source ~/.bashrc." ; exit 1; }
|
export PATH="$HOME/.local/bin:$PATH" # fallback kinda in case sourcing fails
|
||||||
|
|
||||||
log INFO "Added $DESTINATION_PATH to your \$PATH in ~/.bashrc."
|
log INFO "Added ${ORANGE}$DESTINATION_PATH${NC} to your \$PATH in ~/.bashrc."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# not steam deck
|
# not steam os
|
||||||
# set another path if needed
|
# set another path if needed
|
||||||
log PROMPT "Install the script to $DESTINATION_PATH or specify another path (must be included in \$PATH)? (Y/path): "
|
log PROMPT "Install the script to ${ORANGE}$DESTINATION_PATH${NC} or specify another path (must be included in \$PATH)? (Y/path): "
|
||||||
IFS= read -e response
|
IFS= read -e response
|
||||||
|
|
||||||
if [[ "$response" != "y" && "$response" != "Y" && -n "$response" ]]; then
|
if [[ "$response" != "y" && "$response" != "Y" && -n "$response" ]]; then
|
||||||
@@ -115,37 +113,42 @@ latest_major=$(echo "$latest_version" | awk -F. '{print $2}')
|
|||||||
|
|
||||||
if [[ $latest_major -gt $installed_major ]]; then
|
if [[ $latest_major -gt $installed_major ]]; then
|
||||||
log INFO ""
|
log INFO ""
|
||||||
log INFO "Major version upgrade detected."
|
log INFO "${GREEN}IMPORTANT${NC}: Major version upgrade detected. Check out the changelogs here -> https://github.com/v4n00/h2mm-cli/releases"
|
||||||
log INFO "Check out the changelogs here -> https://github.com/v4n00/h2mm-cli/releases"
|
log INFO "The script will proceed to upgrade the database file. Creating a backup in case anything goes wrong."
|
||||||
log INFO "The script will proceed to upgrade the database file to avoid breaking changes."
|
|
||||||
|
|
||||||
# find hd2 path
|
|
||||||
search_dir="${HOME}"
|
|
||||||
target_dir="Steam/steamapps/common/Helldivers\ 2/data"
|
|
||||||
|
|
||||||
# make backup
|
# make backup
|
||||||
log INFO "Creating a backup in case anything goes wrong."
|
|
||||||
h2mm export
|
h2mm export
|
||||||
|
|
||||||
# check if game directory is in ~/.config/h2mm/h2path
|
# check if game directory is in ~/.config/h2mm/h2path
|
||||||
if [[ -f "$HOME/.config/h2mm/h2path" ]]; then
|
if [[ -f "$HOME/.config/h2mm/h2path" ]]; then
|
||||||
game_dir=$(cat "$HOME/.config/h2mm/h2path")
|
game_dir=$(cat "$HOME/.config/h2mm/h2path")
|
||||||
[[ ! -d "$game_dir" ]] && { log ERROR "Helldivers 2 data directory in ~/.config/h2mm/h2path is not a valid directory." ; exit 1; }
|
[[ ! -d "$game_dir" ]] && { log ERROR "Helldivers 2 data directory is not valid: $game_dir." ; exit 1; }
|
||||||
|
|
||||||
log INFO "Helldivers 2 data directory found: $game_dir."
|
|
||||||
else
|
else
|
||||||
log INFO "Searching for the Helldivers 2 data directory... (10 seconds timeout)"
|
log INFO "Searching for the Helldivers 2 data directory... (10 seconds timeout)"
|
||||||
game_dir=$(timeout 10 find "$search_dir" -type d -path "*/$target_dir" 2>/dev/null | head -n 1)
|
game_dir=$(timeout 10 find "$HOME" -type d -path "*/Steam/steamapps/common/Helldivers\ 2/data" 2>/dev/null | head -n 1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if not found, prompt user
|
# if not found, prompt user
|
||||||
if [[ -z "$game_dir" ]]; then
|
if [[ -z "$game_dir" ]]; then
|
||||||
|
# if not found, ask user for the directory
|
||||||
log INFO "Could not find the Helldivers 2 data directory automatically."
|
log INFO "Could not find the Helldivers 2 data directory automatically."
|
||||||
log PROMPT "Please enter the path to the Helldivers 2 data directory: "
|
log PROMPT "Please enter the path to the Helldivers 2 data directory: "
|
||||||
IFS= read -e game_dir
|
IFS= read -e game_dir; unset IFS
|
||||||
if [[ ! -d "$game_dir" ]]; then
|
game_dir="$(substitute_home "$game_dir")"
|
||||||
log ERROR "Provided path is not a valid directory."
|
|
||||||
exit 1
|
[[ ! -d "$game_dir" ]] && { log ERROR "Provided path is not a valid directory."; exit 1; }
|
||||||
|
else
|
||||||
|
# confirm with the user that the directory is ok
|
||||||
|
log INFO "Found Helldivers 2 data directory: $game_dir"
|
||||||
|
log PROMPT "Is this the correct directory? (Y/n): "
|
||||||
|
read confirm
|
||||||
|
|
||||||
|
if [[ "$confirm" != "y" && "$confirm" != "Y" && "$confirm" != "" ]]; then
|
||||||
|
log PROMPT "Please enter the path to the Helldivers 2 data directory: "
|
||||||
|
IFS= read -e game_dir; unset IFS
|
||||||
|
game_dir="$(substitute_home "$game_dir")"
|
||||||
|
|
||||||
|
[[ ! -d "$game_dir" ]] && { log ERROR "Provided path is not a valid directory."; exit 1; }
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -174,12 +177,20 @@ if [[ $latest_major -gt $installed_major ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# install
|
# install
|
||||||
log INFO "Installing $SCRIPT_NAME to $DESTINATION_PATH."
|
log INFO "Installing h2mm to ${ORANGE}$DESTINATION_PATH${NC}."
|
||||||
sudo curl "$REPO_URL"/h2mm --output "$DESTINATION_PATH/$SCRIPT_NAME"
|
|
||||||
sudo chmod +x "$DESTINATION_PATH/$SCRIPT_NAME"
|
# check if we need sudo based on destination path
|
||||||
|
SUDO_CMD=""
|
||||||
|
if [[ ! -w "$DESTINATION_PATH" || ( -f "$DESTINATION_PATH/h2mm" && ! -w "$DESTINATION_PATH/h2mm" ) ]]; then
|
||||||
|
SUDO_CMD="sudo"
|
||||||
|
log INFO "Destination path ${RED}requires${NC} elevated permissions, using sudo."
|
||||||
|
fi
|
||||||
|
|
||||||
|
$SUDO_CMD curl "$REPO_URL"/h2mm --output "$DESTINATION_PATH/h2mm"
|
||||||
|
$SUDO_CMD chmod +x "$DESTINATION_PATH/h2mm"
|
||||||
log INFO ""
|
log INFO ""
|
||||||
|
|
||||||
[[ ! -x "$(command -v $SCRIPT_NAME)" ]] && { log ERROR "Installation failed. Mod manager was not found in \$PATH." ; exit 1; }
|
[[ ! -x "$(command -v h2mm)" ]] && { log ERROR "Installation failed. Mod manager was not found in \$PATH." ; exit 1; }
|
||||||
|
|
||||||
log INFO "Helldivers 2 Mod Manager CLI ${GREEN}successfully${NC} installed."
|
log INFO "Helldivers 2 Mod Manager CLI ${GREEN}successfully${NC} installed."
|
||||||
log INFO "${GREEN}IMPORTANT${NC}: To install mods, you need to have installed:"
|
log INFO "${GREEN}IMPORTANT${NC}: To install mods, you need to have installed:"
|
||||||
@@ -187,5 +198,14 @@ log INFO " -> \"unzip\" package for .zip archives"
|
|||||||
log INFO " -> \"unarchiver\" package for .rar archives"
|
log INFO " -> \"unarchiver\" package for .rar archives"
|
||||||
log INFO "If you do not know how to install these packages, please search for your linux distro on how to install packages."
|
log INFO "If you do not know how to install these packages, please search for your linux distro on how to install packages."
|
||||||
log INFO ""
|
log INFO ""
|
||||||
log INFO "Use the mod manager by running '$SCRIPT_NAME' in your terminal."
|
log INFO "Use the mod manager by running 'h2mm' in your terminal."
|
||||||
log INFO "Made with love <3 by v4n and contributors."
|
log INFO "View the changelogs: https://github.com/v4n00/h2mm-cli/releases/latest"
|
||||||
|
log INFO "Check out the ${ORANGE}Nexus Mods integration${NC} by running 'h2mm nexus-setup'."
|
||||||
|
log INFO "Made with <3 by v4n and contributors."
|
||||||
|
log INFO ""
|
||||||
|
log INFO "${RED}Special announcement:${NC}"
|
||||||
|
log INFO "The Helldivers 2 Mod Manager CLI is now deprecated in favor of the Arsenal Mod Manager."
|
||||||
|
log INFO "Check it out here: https://www.nexusmods.com/helldivers2/mods/4664"
|
||||||
|
log INFO "The Arsenal Mod Manager has a GUI and is more user friendly,"
|
||||||
|
log INFO "making it the preferred choice for most users, especially since it now works on Linux!"
|
||||||
|
log INFO "Thank you for using the Helldivers 2 Mod Manager CLI, and we hope to see you on the Arsenal Mod Manager!"
|
||||||
|
|||||||
Reference in New Issue
Block a user