112 Commits

Author SHA1 Message Date
v4n 9bfa8923fe chore: deprecate 2025-09-29 21:19:38 +03:00
v4n 87ec07b10a docs: improve (#95)
* docs: rewrite help commands

* docs: rewrite README.md

* docs: remove you language

* refactor: started parse refactor
2025-09-29 21:18:54 +03:00
v4n 687bdf6709 fix: modpack command works 2025-09-29 09:32:45 +03:00
v4n 3bf4a5e542 fix: modpack commands are separate (#93) 2025-09-21 07:20:58 +03:00
v4n c72ceb899e fix: nexus downloaded file http encoding 2025-09-16 22:49:21 +03:00
v4n 7c9544f419 fix: pick variant wrong labels 2025-09-16 17:10:50 +03:00
v4n 9627ee199f fix: pick variant wrong labels 2025-09-16 15:39:28 +03:00
v4n 53d9f8a093 fix: pick variant wrong labels 2025-09-16 15:35:54 +03:00
v4n 96163fc7d9 fix: remove SteamOS prompt in favor of automatic detection (#87) 2025-09-16 15:05:08 +03:00
v4n 84cbc80eb2 fix: pick variant empty folder 2025-09-16 14:53:31 +03:00
v4n 423ea1280d fix: pick variant exclusion 2025-09-16 14:45:06 +03:00
v4n 05548ca460 docs: add changelogs link 2025-09-16 14:17:55 +03:00
v4n 30649e0312 feat: enhance variant picker (#86)
* fix: variant display is more clear

* fix: unable to install all variants

* feat: select variants with ranges and exclusions
2025-09-16 14:13:51 +03:00
v4n c3d76c625c fix: help command stops displaying an error (#84) 2025-08-28 20:40:47 +03:00
v4n a9a17a7617 fix: /tmp no longer clogged by random leftover mods (#82) 2025-08-28 20:35:23 +03:00
v4n 711d416e49 fix: order command changing indexes wrong (#79) 2025-08-01 16:17:20 +03:00
v4n a9e11211f4 fix: wrong mod name when using Nexus integration 2025-07-21 15:52:13 +03:00
v4n 1d35ac00d7 fix: remove nexus-update from help (#75)
* fix: remove nexus-update from help

* bump: version
2025-07-18 15:31:23 +03:00
v4n 5b10fbf364 fix: error when updating on steam deck (#72) 2025-07-12 12:36:12 +03:00
v4n 1f2a34dc5b fix: additional help 2025-07-09 20:50:57 +03:00
v4n 159dd47851 fix: help messages/docs 2025-07-09 20:39:32 +03:00
v4n 73cd330ab0 fix: docs 2025-06-30 22:31:51 +03:00
v4n 2efed53b4c fix: enable command no longer changes order (#70) 2025-06-30 13:17:31 +03:00
v4n b501f642c9 fix: no sudo if path writable (#68) 2025-06-28 16:43:29 +03:00
v4n 28684be2de fix: disable command reaching file char limit (#66) 2025-06-23 09:44:20 +03:00
v4n 397b50bc19 code: database headers are universal 2025-06-21 12:41:09 +03:00
v4n 61a15ef816 fix: order command works again 2025-06-21 11:55:49 +03:00
v4n d435bb35ac fix: color 2025-06-21 11:47:18 +03:00
v4n a75d92252e fix: list verbose mode not crashing 2025-06-21 11:46:11 +03:00
v4n 2c51e2bfd3 fix: version number url 2025-06-20 15:18:18 +03:00
v4n 1c1235c85e fix: remove nexus upgrade delay (#63) 2025-06-20 15:07:11 +03:00
v4n 7cedfcb451 feat: added rename command (#62) 2025-06-20 11:10:41 +03:00
v4n 0fdc5a2306 fix: nexus integration does not quit prematurely 2025-05-17 14:23:44 +03:00
v4n 13dc822fd9 fix: nexus integration on Steam Deck (#55) 2025-05-16 16:59:14 +03:00
F. St. 35302aa7c7 fix: print parent folder of mod variants (#52)
* Print parent folder of mod variants

Because some mods have multiple variants with the same name.
As is, it is impossible to tell them apart in the selection.
This commit changes the selection to also print the parent folder of the
variants.

* remove the name of the mod zip/dir itself because it not necessary

---------

Co-authored-by: v4n <105587619+v4n00@users.noreply.github.com>
2025-04-19 14:57:20 +03:00
v4n ebadc049e7 fix: confirm after auto-finding HD2 path (#51) 2025-04-17 17:41:56 +03:00
v4n 649404c2d4 fix: sanitize file name of commas (fixes #48) (#49) 2025-04-16 14:54:59 +03:00
v4n 737fa01c11 feat: 7z file format support (#47) 2025-04-15 18:06:54 +03:00
v4n 0ac711085b fix: date invalid issue (fixes #46) 2025-04-15 17:56:06 +03:00
v4n 146b711a9b feat: nexus mods integration (#44)
* progress

* working download

* save details in db, display them

* progress

* progress

* progress

* progress

* i guess it's shippable

* final commit
2025-04-11 23:29:06 +03:00
v4n 5aafd2f16b fix: detailed instructions on installing in case of error 2025-04-03 00:24:02 +03:00
v4n c30d2a46a5 feat: modpack list verbose mode & improvements (#35) 2025-03-22 21:21:13 +02:00
v4n b6e92e2918 feat: install rar mods (#34) 2025-03-22 20:23:21 +02:00
v4n afbb6d3a0c fix: steam deck forgot to source bashrc 2025-03-22 19:46:07 +02:00
v4n f87b2709b0 bump: version 2025-03-20 11:54:20 +02:00
v4n 7666638328 feat: export can specify path (#33) 2025-03-20 11:53:52 +02:00
v4n 5f7f2a261a fix: mods db was deleted due to incorrect pipe 2025-03-19 23:24:34 +02:00
v4n efe8720507 fix: added temporary backup making in case mods get deleted 2025-03-19 23:01:18 +02:00
v4n cb71852068 fix: prompts for install script 2025-03-19 20:25:44 +02:00
v4n 26031c0381 version 0.4.0 release 2025-03-19 20:20:12 +02:00
Daedalusspacegames 9c73be1cb7 fix: modify date syntax to enhance compatibility with alternate coreutils implementations, such as [uutils](https://github.com/uutils/coreutils) (#29) 2025-03-19 12:10:17 +02:00
v4n a8e94c19fb feat: command to change load order of mods (#27)
* progress

* progress

* feat: progress

* progress

* done, needs more testing, pr -> change all functions to require -n before specifying name -> v0.4 (reindex db)

* testing done
2025-03-18 16:18:48 +02:00
v4n 6b968172ea fix: updating now works properly 2025-03-10 21:42:55 +02:00
v4n b3bc91522f do not update 2025-03-10 21:14:37 +02:00
v4n a7936c90bd fix: stop latest update 2025-03-10 21:07:03 +02:00
v4n 4d1af7e4a0 feat: modpack-create can select individual mods (#26) 2025-03-10 21:01:06 +02:00
v4n 0eff8afe6b fix: turned code into fn 2025-03-08 00:38:04 +02:00
v4n 3593e32a7b fix: upgrade mods was overwriting files 2025-03-07 23:24:30 +02:00
v4n 797739ea7a fix: uninstall correctly reindexes (fix #21) 2025-03-07 22:57:14 +02:00
v4n df006a7430 fix: infite loop while enabling (#25) 2025-03-07 18:20:34 +02:00
v4n 344e4348d4 fix: non important sed error 2025-03-06 04:09:45 +02:00
v4n 719217d00b bump: version 2025-03-06 01:29:45 +02:00
v4n b1930811f9 fix: segfault from infinite recursion 2025-03-06 01:29:14 +02:00
v4n d1ca18b563 bump: downgrade because of seg fault 2025-03-06 00:59:58 +02:00
v4n 5d91190dbf fix: code cleanup 2025-03-06 00:12:59 +02:00
v4n 28122ee332 feat: list is now compact, added verbose option 2025-03-05 19:09:57 +02:00
v4n 56bb73784e fix: directory checking in wrong place 2025-03-02 15:38:07 +02:00
v4n 0d8f22a2d0 fix: variants fix 2025-02-21 17:15:35 +02:00
v4n 3c6238f8d2 fix: show variants better 2025-02-21 16:16:42 +02:00
v4n a031230117 fix: bash black magic 2025-02-21 16:06:20 +02:00
v4n 77ae53ffa7 fix: weird update bug 2025-02-21 14:03:49 +02:00
v4n c23c57e16c fix: weird update bug 2025-02-21 14:01:36 +02:00
v4n 898400e526 fix: whitespace in help msg 2025-02-21 13:48:50 +02:00
v4n c45f5860d8 bump: version 2025-02-21 13:44:18 +02:00
v4n 838c834cc2 feat: easily install multiple variants (#20)
* feat: easily install multiple variants

* fix: filter only dirs that have patches
2025-02-21 13:16:29 +02:00
v4n 7b8b2fda8f fix: console output, formatting 2025-02-21 12:46:46 +02:00
Catherine Guelque 0485b56df5 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>
2025-02-17 18:07:54 +02:00
v4n d18a9cdccf fix: formatting 2025-02-06 20:13:45 +02:00
v4n c74f4a8a00 fix: whitespace, version bump for earlier commit 2025-02-06 20:12:27 +02:00
Matt Cavanagh 9f592e7ce2 feat: added .editorconfig to ensure consistency across IDEs and to prevent line ending oopsies (#17) 2025-02-06 19:47:37 +02:00
v4n 21b1822006 fix: uninstall correctly downgrades 2025-02-06 19:43:30 +02:00
v4n dbcc7d1e96 fix: CRLF -> LF 2025-02-06 03:34:33 +02:00
v4n 09c40aa25f bump: version 2025-02-05 23:32:50 +02:00
Matt Cavanagh 1a01034816 feat: added self update mechanism (#15)
* feat: Added self update mechanism

* fix: Formatting

* fix: Formatting again

* fix: Arghhh INDENTATION

* feat: Updated readme with new command

* feat: Added shortcut command

* feat: Added more detail to the readme

* feat: Removed the check for the last update file. It seems a bit pointless to delay checking for it, it's curling github so it's not like it's a DDOS concern, and it could be the tool is getting updated often, why delay their updates? It's also just a curl, it's very inexpensive.

* feat: Removed REPO_URL, it was unused

* feat: Reverted version testing change (oops)

* feat: checking for updates timed at 1 hour

* fix: info messages formatting

---------

Co-authored-by: v4n <105587619+v4n00@users.noreply.github.com>
2025-02-05 23:29:21 +02:00
v4n 83e2161456 code: removed unnecessary parameter passing 2025-02-05 17:09:15 +02:00
Luca Saalfeld a2b904caa2 feat: prevent the same mod from being installed multiple times (#14)
* prevent the same mod from being installed multiple times

* use flag instead of variable for exit check
2025-02-05 16:59:00 +02:00
v4n 9f622ca130 bump: version 2025-02-05 16:27:04 +02:00
v4n 0ab273977e fix: function return typo, trailing slashes removed from paths (#13) 2025-02-05 16:23:32 +02:00
Luca Saalfeld 388afe69b7 fix: bash date comparison (#12) 2025-02-05 15:22:10 +02:00
v4n 3f0305c741 feat: steam deck install 2025-02-03 02:08:50 +02:00
v4n 1a6a13a621 fix: enable/disable logic 2025-02-03 01:49:41 +02:00
Harsh Shandilya 23cb0646bf Use portable shebangs (#7)
* h2mm: use portable shebang

* install.sh: use portable shebang
2025-01-28 11:49:51 +02:00
v4n 6768cab391 fix: disabling/enabling correctly downgrades/upgrades 2025-01-27 00:10:44 +02:00
v4n 35902f1f8f fix: downgrade logic 2025-01-23 09:29:48 +02:00
v4n 55f382a8e5 Merge pull request #3 from v4n00/dev
Add modpack managing
2025-01-22 21:09:07 +02:00
v4n c1785b5323 feat: added modpack management 2025-01-22 21:07:20 +02:00
v4n 115e8acac3 Merge pull request #2 from v4n00/dev
Install mods in batches
2025-01-17 20:46:05 +02:00
v4n 8b06d76c31 fix: downgrade mod logic 2025-01-17 20:40:03 +02:00
v4n fc7ccc2f7c info: version bump 2025-01-17 17:42:04 +02:00
v4n f763d96797 docs: updated for multiple installs 2025-01-17 17:40:36 +02:00
v4n 83260e9961 feat: install multiple mods at once 2025-01-17 16:59:36 +02:00
v4n 36fc676ce0 Merge branch 'master' into dev 2025-01-17 11:55:58 +02:00
v4n 911a9b86ff compatibility: easier for WSL, read now accepts autocompletion 2025-01-17 11:41:18 +02:00
v4n f9c047078d docs: update, install timeout 2025-01-17 10:06:13 +02:00
v4n c80812476b docs: updated 2025-01-16 17:36:27 +02:00
v4n 740b0edd98 fix: docs for help, backup before upgrading script 2025-01-16 17:08:34 +02:00
v4n cc91661663 code: work on cleaner code 2025-01-16 14:57:43 +02:00
v4n 7b25b235fa Merge pull request #1 from v4n00/dev
Version 0.2.0
2025-01-16 13:53:54 +02:00
v4n a6d0bcfb5f feat: installer treat breaking changes 2025-01-16 13:49:16 +02:00
v4n a46776838a feat: enable/disable functionality 2025-01-16 11:22:19 +02:00
v4n 6bcad99bec feat: changed from zip to tar.gz 2025-01-16 09:40:49 +02:00
v4n 8d6591a19d feat: update functionality testing 2025-01-16 09:24:19 +02:00
6 changed files with 2351 additions and 499 deletions
+6
View File
@@ -0,0 +1,6 @@
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
+2
View File
@@ -2,3 +2,5 @@
!h2mm !h2mm
!install.sh !install.sh
!README.md !README.md
!version
!.editorconfig
+47 -90
View File
@@ -1,120 +1,77 @@
# Helldivers 2 Mod Manager CLI # Helldivers 2 Mod Manager CLI
- [Helldivers 2 Mod Manager CLI](#helldivers-2-mod-manager-cli) ## Deprecation notice
- [Installation](#installation)
- [Usage](#usage)
- [Available commands](#available-commands)
- [Basic usage](#basic-usage)
- [Install a mod](#install-a-mod)
- [Uninstall a mod](#uninstall-a-mod)
- [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. > [!Caution]
> This project is deprecated as of 30/09/2025 in favor of [Arsenal](https://www.nexusmods.com/helldivers2/mods/4664)'s 0.30.0 release, a GUI mod manager that supports every feature of Helldivers 2 Mod Manager CLI and more, on Linux.
**Thank you for the support up until now and make sure to check out Arsenal!**
## Overview
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
To install/update Helldivers 2 Mod Manager CLI run the following command in your terminal: Pre-requisites:
- The `unzip` package must be installed for ZIP archives.
- The `unarchiver` package is recommended for RAR and 7Z archives.
To install Helldivers 2 Mod Manager CLI run the following command in the 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.
## 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` - Install a mod with files ## Available commands
- `uninstall` - Uninstall a mod by name
- `list` - List all installed mods
- `export <zip_name>` - Export installed mods to a zip file
- `import <zip_name>` - Import mods from a zip file
- `reset` - Reset all installed mods
- `help` - Display the help message
### Basic 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
#### Install a mod ## Examples
```bash
h2mm install /path/to/mod.zip
h2mm install /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* # using a wildcard to include all files
```
Important: If the mod has more than 1 variant, you need to install the one you want by unarchiving it separately.
#### Uninstall a mod
```bash
h2mm uninstall "Example mod"
h2mm uninstall -i 1 # uninstall mod with index 1
```
#### 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 uninstall --index 3
h2mm modpack create "Example modpack"
h2mm modpack switch "Example modpack"
``` ```
## Advanced usage > 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.
>
> 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`.
### Shortcuts ## Nexus Mods integration
You can use the short form of the commands to save some time. The shortcuts are: 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.
- `i` for `install`
- `u` for `uninstall`
- `l` for `list`
- `ex` for `export`
- `im` for `import`
- `r` for `reset`
### 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.
This will serve as either a backup or a way to have multiple mod setups.
```bash
h2mm export modpack1.zip
h2mm import modpack2.zip
```
### Resetting all installed mods
You can reset all installed mods by running the following command. This will remove all installed mods and the database, in case things go wild.
```bash
h2mm reset
```
### Database location and details
The database is stored in the `Helldivers 2` install directory, under the `data` folder with the name `mods.csv`, where the mods are also installed. The database is a simple CSV file which you can use to manually manage mods if needed, you can mostly use it to rename or reorder mods.
## 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
- [ ] ! Enable/disable mods
- [ ] !! Easier way to change mod presets
- [ ] !! Change to `.tar.xz` for exporting and importing
- [ ] !!! Find a way to make use of `manifest.json` and simplify installing variants
+2036 -320
View File
File diff suppressed because it is too large Load Diff
+192 -22
View File
@@ -1,41 +1,211 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e
RED='\033[0;31m' RED='\033[0;31m'
GREEN='\033[0;32m'
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"
if [ "$(id -u)" -eq 0 ]; then function log() {
echo "Run me as normal user, not as root." local type="$1"
shift
case "$type" in
INFO)
echo -e "$*" >&2
;;
ERROR)
echo -e "${RED}[ERROR]${NC} $*" >&2
;;
PROMPT)
echo -ne "$*" >&2
;;
esac
}
# --- Main ---
log INFO "Running h2mm CLI Installer (https://github.com/v4n00/h2mm-cli)"
# breaking changes hash table
breaking_changes_patches=(
["2"]='sed -i "s/^\([0-9]\+\),/\1,ENABLED,/" "$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"'
["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
installed_version=""
latest_version=""
if [[ -x "$(command -v h2mm)" ]]; then
installed_version=$(h2mm --version)
# if installed version isn't x.x.x crash
if [[ ! "$installed_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
log ERROR "Installed version is not in the correct format."
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 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
echo -e "!!! ${RED}WARNING${NC} !!!" latest_version=$(curl -sS "$REPO_URL"/version)
echo -e "This script will install Helldivers 2 Mod Manager CLI for Linux to $DESTINATION_PATH/$SCRIPT_NAME." if [[ "$latest_version" == "$installed_version" ]]; then
echo -e "Running this script will require sudo permissions. ${RED}DO NOT TRUST${NC} random scripts from the internet." log INFO "You are reinstalling version ${GREEN}$installed_version${NC}."
echo -e "If you want to review the script before running it, check out the mod repository for yourself:" else
echo -e "https://github.com/v4n00/h2mm-cli" log INFO "You are upgrading from ${ORANGE}$installed_version${NC} -> ${GREEN}$latest_version${NC}."
echo fi
fi
read -p "Install the script to $DESTINATION_PATH or specify another path (must be included in \$PATH)? (Y/path): " response # if steam os, set destination path to ~/.local/bin
steamos=false
if [[ -f "/etc/os-release" ]]; then
if grep -q "ID=steamos" /etc/os-release; then
steamos=true
fi
fi
if [[ $steamos == true ]]; then
# steam os
DESTINATION_PATH="$HOME/.local/bin"
log INFO "Detected SteamOS, setting installation path to ${ORANGE}$DESTINATION_PATH${NC}."
mkdir -p "$DESTINATION_PATH"
# check if ~/.local/bin is in PATH
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
# add ~/.local/bin to 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 PROMPT "Do you want to automatically add ${ORANGE}$DESTINATION_PATH${NC} to your \$PATH in ~/.bashrc? (Y/n): "
IFS= read -e response
if [[ "$response" == "y" || "$response" = "Y" || -z "$response" ]]; then
echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> "$HOME/.bashrc"
[[ $? -ne 0 ]] && { log ERROR "Failed to add $DESTINATION_PATH to \$PATH in ~/.bashrc." ; exit 1; }
source "$HOME/.bashrc"
export PATH="$HOME/.local/bin:$PATH" # fallback kinda in case sourcing fails
log INFO "Added ${ORANGE}$DESTINATION_PATH${NC} to your \$PATH in ~/.bashrc."
fi
fi
else
# not steam os
# set another path if needed
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
if [[ "$response" != "y" && "$response" != "Y" && -n "$response" ]]; then if [[ "$response" != "y" && "$response" != "Y" && -n "$response" ]]; then
DESTINATION_PATH=$(eval echo "$response") DESTINATION_PATH="$response"
if [[ ! -d "$DESTINATION_PATH" ]]; then [[ ! -d "$DESTINATION_PATH" ]] && { log ERROR "Path $DESTINATION_PATH does not exist." ; exit 1; }
echo -e "${RED}Error:${NC} Path $DESTINATION_PATH does not exist. Exiting..."
exit 1
fi fi
fi fi
echo "Installing $SCRIPT_NAME to $DESTINATION_PATH." # handle breaking changes
sudo curl https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master/h2mm --output "$DESTINATION_PATH/$SCRIPT_NAME" installed_major=$(echo "$installed_version" | awk -F. '{print $2}')
sudo chmod +x "$DESTINATION_PATH/$SCRIPT_NAME" latest_major=$(echo "$latest_version" | awk -F. '{print $2}')
if [[ ! -x "$(command -v $SCRIPT_NAME)" ]]; then if [[ $latest_major -gt $installed_major ]]; then
echo -e "${RED}Error:${NC} Installation failed." log INFO ""
exit 1 log INFO "${GREEN}IMPORTANT${NC}: Major version upgrade detected. 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."
# make backup
h2mm export
# check if game directory is in ~/.config/h2mm/h2path
if [[ -f "$HOME/.config/h2mm/h2path" ]]; then
game_dir=$(cat "$HOME/.config/h2mm/h2path")
[[ ! -d "$game_dir" ]] && { log ERROR "Helldivers 2 data directory is not valid: $game_dir." ; exit 1; }
else
log INFO "Searching for the Helldivers 2 data directory... (10 seconds timeout)"
game_dir=$(timeout 10 find "$HOME" -type d -path "*/Steam/steamapps/common/Helldivers\ 2/data" 2>/dev/null | head -n 1)
fi fi
echo "Helldivers 2 Mod Manager CLI installed successfully to $DESTINATION_PATH/$SCRIPT_NAME. Use it by running '$SCRIPT_NAME'." # if not found, prompt user
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 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; }
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
[[ ! -f "$game_dir/mods.csv" ]] && { log ERROR "mods.csv not found in $game_dir." ; exit 1; }
# iterate from installed major number to latest major number
for ((i = installed_major + 1; i <= latest_major; i++)); do
if [[ -n "${breaking_changes_patches[$i]}" ]]; then
# apply breaking changes patch
eval $(echo "${breaking_changes_patches[$i]}" | sed "s:\$1:$game_dir:g")
else
log INFO "No breaking changes for version $i."
continue
fi
if [[ $? -ne 0 ]]; then
log ERROR "Failed to apply breaking changes patch for version $i. Do you want to continue? (Y/n): "
read -er response
[[ "$response" != "y" && "$response" != "Y" && -n "$response" ]] && { log INFO "Exiting." ; exit 1; }
else
log INFO "Version upgrade fix ${GREEN}successfully${NC} applied for version $i."
fi
done
log INFO ""
fi
# install
log INFO "Installing h2mm to ${ORANGE}$DESTINATION_PATH${NC}."
# 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 ""
[[ ! -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 "${GREEN}IMPORTANT${NC}: To install mods, you need to have installed:"
log INFO " -> \"unzip\" package for .zip 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 ""
log INFO "Use the mod manager by running 'h2mm' in your terminal."
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!"
+1
View File
@@ -0,0 +1 @@
0.7.0