Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 09c40aa25f | |||
| 1a01034816 | |||
| 83e2161456 | |||
| a2b904caa2 | |||
| 9f622ca130 | |||
| 0ab273977e | |||
| 388afe69b7 | |||
| 3f0305c741 | |||
| 1a6a13a621 | |||
| 23cb0646bf | |||
| 6768cab391 | |||
| 35902f1f8f | |||
| 55f382a8e5 | |||
| c1785b5323 | |||
| 115e8acac3 | |||
| 8b06d76c31 | |||
| fc7ccc2f7c | |||
| f763d96797 | |||
| 83260e9961 | |||
| 36fc676ce0 | |||
| 911a9b86ff | |||
| f9c047078d | |||
| c80812476b | |||
| 740b0edd98 | |||
| cc91661663 |
@@ -1,33 +1,27 @@
|
|||||||
# Helldivers 2 Mod Manager CLI
|
# Helldivers 2 Mod Manager CLI
|
||||||
|
|
||||||
- [Helldivers 2 Mod Manager CLI](#helldivers-2-mod-manager-cli)
|
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.
|
||||||
- [Installation](#installation)
|
|
||||||
- [Usage](#usage)
|
|
||||||
- [Available commands](#available-commands)
|
|
||||||
- [Basic usage](#basic-usage)
|
|
||||||
- [Install a mod](#install-a-mod)
|
|
||||||
- [Uninstall a mod](#uninstall-a-mod)
|
|
||||||
- [Enable/disable mods](#enabledisable-mods)
|
|
||||||
- [List installed mods](#list-installed-mods)
|
|
||||||
- [Advanced usage](#advanced-usage)
|
|
||||||
- [Shortcuts](#shortcuts)
|
|
||||||
- [Exporting and importing](#exporting-and-importing)
|
|
||||||
- [Resetting all installed mods](#resetting-all-installed-mods)
|
|
||||||
- [Database location and details](#database-location-and-details)
|
|
||||||
- [Contributing](#contributing)
|
|
||||||
- [Planned features](#planned-features)
|
|
||||||
|
|
||||||
Helldivers 2 Mod Manager CLI is a command line interface for managing Helldivers 2 mods. Since there is no mod manager GUI for Helldivers 2 on Linux yet, this small script aims to provide a simple way to manage mods on Linux.
|
This script is complete, the version will always [remain at 0.x.x](https://0ver.org/)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
To install/update Helldivers 2 Mod Manager CLI run the following command in your terminal:
|
To install Helldivers 2 Mod Manager CLI run the following command in your terminal:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sh -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)"
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
> [!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. Go to your downloads folders `cd ~/Downloads`
|
||||||
|
1. Give the script execution permissions `chmod +x install.sh`
|
||||||
|
1. Run the script `./install.sh`
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -39,26 +33,37 @@ h2mm
|
|||||||
|
|
||||||
### Available commands
|
### Available commands
|
||||||
|
|
||||||
- `install` - Install a mod with files
|
- `install` - Install a mod by the file provided (directory, zip, patch).
|
||||||
- `uninstall` - Uninstall a mod by name
|
- `uninstall` - Uninstall a mod by name (or index).
|
||||||
- `list` - List all installed mods
|
- `list` - List all installed mods.
|
||||||
- `export <zip_name>` - Export installed mods to a zip file
|
- `enable` - Enable a mod by name (or index).
|
||||||
- `import <zip_name>` - Import mods from a zip file
|
- `disable` - Disable a mod by name (or index).
|
||||||
- `reset` - Reset all installed mods
|
- `export` - Export installed mods to a zip file.
|
||||||
- `help` - Display the help message
|
- `import` - Import mods from a zip file.
|
||||||
|
- `modpack-create` - Create a modpack from the currently installed mods.
|
||||||
|
- `modpack-switch` - Switch to a modpack by name (or index).
|
||||||
|
- `modpack-list` - List all installed modpacks.
|
||||||
|
- `modpack-delete` - Delete a modpack by name (or index).
|
||||||
|
- `modpack-overwrite` - Overwrite a modpack by name (or index).
|
||||||
|
- `modpack-reset` - Reset all installed modpacks.
|
||||||
|
- `reset` - Reset all installed mods.
|
||||||
|
- `update` - Update h2mm to latest version.
|
||||||
|
- `help` - Display this help message.
|
||||||
|
|
||||||
### Basic usage
|
### Basic usage
|
||||||
|
|
||||||
#### Install a mod
|
#### Install mod(s)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
h2mm install /path/to/mod.zip
|
h2mm install /path/to/mod.zip
|
||||||
h2mm install /path/to/mod/files
|
h2mm install /path/to/mod/files
|
||||||
|
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
|
h2mm install -n "Example mod" mod.patch_0 mod.patch_0.stream # -n is mandatory when using files
|
||||||
h2mm install -n "Example mod" mod* # using a wildcard to include all files
|
h2mm install -n "Example mod" mod* # using a wildcard to include all files
|
||||||
```
|
```
|
||||||
|
|
||||||
> Currently, if the mod has more than 1 variant, you need to install the one you want by unarchiving it separately.
|
> [!NOTE]
|
||||||
|
> If the mod has more than 1 variant, you need to install the one you want by unarchiving it separately and providing the directory.
|
||||||
|
|
||||||
#### Uninstall a mod
|
#### Uninstall a mod
|
||||||
|
|
||||||
@@ -67,7 +72,6 @@ h2mm uninstall "Example mod"
|
|||||||
h2mm uninstall -i 1 # uninstall mod with index 1
|
h2mm uninstall -i 1 # uninstall mod with index 1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
#### Enable/disable mods
|
#### Enable/disable mods
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -83,6 +87,24 @@ h2mm disable -i 1 # disable mod with index 1
|
|||||||
h2mm list
|
h2mm list
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Updating the script
|
||||||
|
|
||||||
|
```bash
|
||||||
|
h2mm update
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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`.
|
||||||
|
|
||||||
## Advanced usage
|
## Advanced usage
|
||||||
|
|
||||||
### Shortcuts
|
### Shortcuts
|
||||||
@@ -96,11 +118,29 @@ You can use the short form of commands to save some time. The shortcuts are:
|
|||||||
- `l` for `list`
|
- `l` for `list`
|
||||||
- `ex` for `export`
|
- `ex` for `export`
|
||||||
- `im` for `import`
|
- `im` for `import`
|
||||||
|
- `mc` for `modpack-create`
|
||||||
|
- `ms` for `modpack-switch`
|
||||||
|
- `ml` for `modpack-list`
|
||||||
|
- `md` for `modpack-delete`
|
||||||
|
- `mo` for `modpack-overwrite`
|
||||||
|
- `mr` for `modpack-reset`
|
||||||
- `r` for `reset`
|
- `r` for `reset`
|
||||||
|
- `up` for `update`
|
||||||
|
|
||||||
|
### Modpacks support
|
||||||
|
|
||||||
|
You can set up modpacks by using the `modpack-*` commands. This allows you to quickly change between a set of mods. For more information, check the help message.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
h2mm modpack-create "Modpack 1"
|
||||||
|
# install, enable, disable other mods...
|
||||||
|
h2mm modpack-create "Modpack 2"
|
||||||
|
h2mm modpack-switch "Modpack 1"
|
||||||
|
```
|
||||||
|
|
||||||
### Exporting and importing
|
### Exporting and importing
|
||||||
|
|
||||||
You can export all installed mods to a zip file and import mods from the same file. This can be useful for sharing mods with others or for backing up your mods. The zip file will be saved in the current directory.
|
You can export all installed mods to a zip file and import mods from the same file. This can be useful for sharing mods with others or for backing up your mods. The archive file (`.tar.gz`) will be saved in the current directory.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
h2mm export modpack1.zip
|
h2mm export modpack1.zip
|
||||||
@@ -122,14 +162,3 @@ The database is stored in the `Helldivers 2` install directory, under the `data`
|
|||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Feel free to contribute to this project by creating a pull request or opening an issue.
|
Feel free to contribute to this project by creating a pull request or opening an issue.
|
||||||
|
|
||||||
## Planned features
|
|
||||||
|
|
||||||
- [x] Check for mod updates
|
|
||||||
- [x] Enable/disable mods
|
|
||||||
- [ ] Easier way to change mod presets
|
|
||||||
- [ ] Find a way to make use of `manifest.json` and simplify installing variants
|
|
||||||
- [x] [DEV] Change to `.tar.gz` for exporting and importing
|
|
||||||
- [x] [DEV] Provide fixes for breaking updates
|
|
||||||
- [ ] [DEV] Optimize code - throw errors in 1 line
|
|
||||||
- [ ] [DEV] Rewrite some code to be more readable
|
|
||||||
|
|||||||
+55
-26
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
@@ -8,6 +8,7 @@ NC='\033[0m'
|
|||||||
|
|
||||||
DESTINATION_PATH="/usr/local/bin"
|
DESTINATION_PATH="/usr/local/bin"
|
||||||
SCRIPT_NAME="h2mm"
|
SCRIPT_NAME="h2mm"
|
||||||
|
REPO_URL="https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master"
|
||||||
|
|
||||||
if [ "$(id -u)" -eq 0 ]; then
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
echo "Run me as normal user, not as root."
|
echo "Run me as normal user, not as root."
|
||||||
@@ -32,16 +33,17 @@ echo
|
|||||||
|
|
||||||
breaking_changes_patches=(
|
breaking_changes_patches=(
|
||||||
["2"]='sed -i "s/^\([0-9]\+\),/\1,ENABLED,/" "$1/mods.csv"'
|
["2"]='sed -i "s/^\([0-9]\+\),/\1,ENABLED,/" "$1/mods.csv"'
|
||||||
|
["3"]='sed -i "1 i\\3" "$1/mods.csv"'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Script
|
# Handle breaking changes
|
||||||
|
|
||||||
if [[ -x "$(command -v $SCRIPT_NAME)" ]]; then
|
if [[ -x "$(command -v $SCRIPT_NAME)" ]]; then
|
||||||
installed_version=$($SCRIPT_NAME --version)
|
installed_version=$($SCRIPT_NAME --version)
|
||||||
# version 1 show the help message, if the first character is not a 0, store installed version as 0.1.6
|
# version 1 show the help message, if the first character is not a 0, store installed version as 0.1.6
|
||||||
[[ ${installed_version:0:1} != "0" ]] && { installed_version="0.1.6"; }
|
[[ ${installed_version:0:1} != "0" ]] && { installed_version="0.1.6"; }
|
||||||
|
|
||||||
latest_version=$(curl -sS https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master/version)
|
latest_version=$(curl -sS "$REPO_URL"/version)
|
||||||
if [[ "$latest_version" == "$installed_version" ]]; then
|
if [[ "$latest_version" == "$installed_version" ]]; then
|
||||||
echo -e "You are reinstalling version $installed_version."
|
echo -e "You are reinstalling version $installed_version."
|
||||||
else
|
else
|
||||||
@@ -56,57 +58,84 @@ if [[ -x "$(command -v $SCRIPT_NAME)" ]]; then
|
|||||||
|
|
||||||
if [[ $latest_major -gt $installed_major ]]; then
|
if [[ $latest_major -gt $installed_major ]]; then
|
||||||
echo -e "${ORANGE}Warning:${NC} Major version upgrade detected."
|
echo -e "${ORANGE}Warning:${NC} Major version upgrade detected."
|
||||||
|
echo "${ORANGE}Info${NC}: Check out the changelogs here -> https://github.com/v4n00/h2mm-cli/releases"
|
||||||
echo "The script will proceed to upgrade ${SCRIPT_NAME} to avoid breaking changes."
|
echo "The script will proceed to upgrade ${SCRIPT_NAME} to avoid breaking changes."
|
||||||
|
|
||||||
# find hd2 path
|
# find hd2 path
|
||||||
search_dir="${HOME}"
|
search_dir="${HOME}"
|
||||||
target_dir="Steam/steamapps/common/Helldivers\ 2/data"
|
target_dir="Steam/steamapps/common/Helldivers\ 2/data"
|
||||||
echo "Searching for the Helldivers 2 data directory..." >&2
|
echo "Searching for the Helldivers 2 data directory... (20 seconds timeout)" >&2
|
||||||
game_dir=$(find "$search_dir" -type d -path "*/$target_dir" 2>/dev/null | head -n 1)
|
|
||||||
if [[ -z "$game_dir" ]]; then
|
|
||||||
echo "Could not find the Helldivers 2 data directory automatically." >&2
|
|
||||||
read -p "Please enter the path to the Helldivers 2 data directory: " game_dir
|
|
||||||
game_dir=$(eval echo "$game_dir")
|
|
||||||
|
|
||||||
if [[ ! -d "$game_dir" ]]; then
|
game_dir=$(timeout 20 find "$search_dir" -type d -path "*/$target_dir" 2>/dev/null | head -n 1)
|
||||||
echo -e "${RED}Error${NC}: Provided path is not a valid directory." >&2
|
if [[ -z "$game_dir" ]]; then
|
||||||
exit 1
|
echo "Could not find the Helldivers 2 data directory automatically." >&2
|
||||||
fi
|
IFS= read -ep "Please enter the path to the Helldivers 2 data directory: " game_dir
|
||||||
fi
|
if [[ ! -d "$game_dir" ]]; then
|
||||||
|
echo -e "${RED}Error${NC}: Provided path is not a valid directory." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
[[ ! -f "$game_dir/mods.csv" ]] && { echo -e "${RED}Error:${NC} mods.csv not found in $game_dir."; exit 1; }
|
[[ ! -f "$game_dir/mods.csv" ]] && { echo -e "${RED}Error:${NC} mods.csv not found in $game_dir."; exit 1; }
|
||||||
|
|
||||||
|
# make backup of mods in case something goes wrong
|
||||||
|
echo "${ORANGE}V${NC} It is advised to make a backup before proceeding."
|
||||||
|
h2mm export
|
||||||
|
|
||||||
# iterate from installed major number to latest major number
|
# iterate from installed major number to latest major number
|
||||||
for ((i = installed_major + 1; i <= latest_major; i++)); do
|
for ((i = installed_major + 1; i <= latest_major; i++)); do
|
||||||
echo -e "${RED}[ ]${NC} Applying breaking changes patch for version $i."
|
if [[ -n "${breaking_changes_patches[$i]}" ]]; then
|
||||||
|
eval $(echo "${breaking_changes_patches[$i]}" | sed "s:\$1:$game_dir:")
|
||||||
[[ -n "${breaking_changes_patches[$i]}" ]] && eval $(echo "${breaking_changes_patches[$i]}" | sed "s:\$1:$game_dir:")
|
else
|
||||||
|
echo "No breaking changes for version $i."
|
||||||
|
fi
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo -ne "${RED}Error:${NC} Failed to apply breaking changes patch for version $i. Do you want to continue? (Y/n): "
|
echo -ne "${RED}Error:${NC} Failed to apply breaking changes patch for version $i. Do you want to continue? (Y/n): "
|
||||||
read -r response
|
read -er response
|
||||||
|
|
||||||
[[ "$response" != "y" && "$response" != "Y" && -n "$response" ]] && { echo "Exiting. Uninstall the script first the retry the install script."; exit 1; }
|
[[ "$response" != "y" && "$response" != "Y" && -n "$response" ]] && { echo "Exiting. Uninstall the script first the retry the install script."; exit 1; }
|
||||||
else
|
else
|
||||||
echo -e "${GREEN}[X]${NC} Breaking changes patch for version $i applied successfully."
|
echo -e "Breaking changes patch for version ${ORANGE}$i${NC} applied ${GREEN}successfully${NC}."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
|
|
||||||
read -p "Install the script to $DESTINATION_PATH or specify another path (must be included in \$PATH)? (Y/path): " response
|
# if steam deck, set destination path to ~/.local/bin
|
||||||
|
IFS= read -ep "Are you installing on a Steam Deck? (y/N): " response_sd
|
||||||
|
if [[ "$response_sd" == "y" || "$response_sd" == "Y" ]]; then
|
||||||
|
# steam deck
|
||||||
|
DESTINATION_PATH="$HOME/.local/bin"
|
||||||
|
mkdir -p "$DESTINATION_PATH"
|
||||||
|
|
||||||
if [[ "$response" != "y" && "$response" != "Y" && -n "$response" ]]; then
|
# check if ~/.local/bin is in PATH
|
||||||
DESTINATION_PATH=$(eval echo "$response")
|
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
|
||||||
if [[ ! -d "$DESTINATION_PATH" ]]; then
|
# add ~/.local/bin to PATH
|
||||||
echo -e "${RED}Error:${NC} Path $DESTINATION_PATH does not exist. Exiting..."
|
echo -e "${ORANGE}Warning:${NC} Installing the script on a Steam Deck means adding $DESTINATION_PATH to your \$PATH."
|
||||||
exit 1
|
echo -e "${ORANGE}Warning:${NC} If you're using a different shell, you may need to add it manually."
|
||||||
|
|
||||||
|
IFS= read -ep "Do you want to add $DESTINATION_PATH to your \$PATH in ~/.bashrc? (Y/n): " response
|
||||||
|
if [[ "$response" == "y" || "$response" = "Y" || -z "$response" ]]; then
|
||||||
|
echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> "$HOME/.bashrc"
|
||||||
|
echo -e "${GREEN}Success:${NC} Added $DESTINATION_PATH to your \$PATH in ~/.bashrc."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# not steam deck
|
||||||
|
# set another path if needed
|
||||||
|
IFS= read -ep "Install the script to $DESTINATION_PATH or specify another path (must be included in \$PATH)? (Y/path): " response
|
||||||
|
|
||||||
|
if [[ "$response" != "y" && "$response" != "Y" && -n "$response" ]]; then
|
||||||
|
DESTINATION_PATH="$response"
|
||||||
|
[[ ! -d "$DESTINATION_PATH" ]] && { echo -e "${RED}Error:${NC} Path $DESTINATION_PATH does not exist."; exit 1; }
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing $SCRIPT_NAME to $DESTINATION_PATH."
|
echo "Installing $SCRIPT_NAME to $DESTINATION_PATH."
|
||||||
sudo curl https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master/h2mm --output "$DESTINATION_PATH/$SCRIPT_NAME"
|
sudo curl "$REPO_URL"/h2mm --output "$DESTINATION_PATH/$SCRIPT_NAME"
|
||||||
sudo chmod +x "$DESTINATION_PATH/$SCRIPT_NAME"
|
sudo chmod +x "$DESTINATION_PATH/$SCRIPT_NAME"
|
||||||
|
|
||||||
if [[ ! -x "$(command -v $SCRIPT_NAME)" ]]; then
|
if [[ ! -x "$(command -v $SCRIPT_NAME)" ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user