compatibility: easier for WSL, read now accepts autocompletion

This commit is contained in:
v4n
2025-01-17 11:41:18 +02:00
parent f9c047078d
commit 911a9b86ff
4 changed files with 76 additions and 76 deletions
+5 -3
View File
@@ -25,7 +25,7 @@ Helldivers 2 Mod Manager CLI is a command line interface for managing Helldivers
To install/update Helldivers 2 Mod Manager CLI run the following command in your terminal:
```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.
@@ -92,8 +92,10 @@ The script is developed and tested on Arch Linux, but it should work on other Li
Status of other platforms:
- Linux :white_check_mark:
- Steam Deck - Untested :grey_question:
- WSL - Untested, should work :grey_question:
- Steam Deck - untested (should work) :grey_question:
- 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
+3 -4
View File
@@ -1,6 +1,6 @@
#!/bin/bash
VERSION="0.2.1"
VERSION="0.2.2"
# --- Globals ---
@@ -73,8 +73,7 @@ function find_game_directory() {
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")
IFS= read -ep "Please enter the path to the Helldivers 2 data directory: " game_dir
if [[ ! -d "$game_dir" ]]; then
echo -e "${RED}Error${NC}: Provided path is not a valid directory." >&2
exit 1
@@ -212,7 +211,7 @@ function display_import_help() {
function check_for_updates() {
if [[ -f "$LAST_CHECKED_UPDATE_FILE" ]]; then
last_update=$(cat "$LAST_CHECKED_UPDATE_FILE")
if [[ $(date +%Y-%m-%d) -gt $(date +%Y-%m-%d -d "$last_update + 7 days") ]]; then
if [[ $(date +%Y-%m-%d) -gt $(date +%Y-%m-%d -d "$last_update + 3 days") ]]; then
return
fi
else
+8 -9
View File
@@ -34,7 +34,7 @@ breaking_changes_patches=(
["2"]='sed -i "s/^\([0-9]\+\),/\1,ENABLED,/" "$1/mods.csv"'
)
# Script
# Handle breaking changes
if [[ -x "$(command -v $SCRIPT_NAME)" ]]; then
installed_version=$($SCRIPT_NAME --version)
@@ -62,12 +62,11 @@ if [[ -x "$(command -v $SCRIPT_NAME)" ]]; then
search_dir="${HOME}"
target_dir="Steam/steamapps/common/Helldivers\ 2/data"
echo "Searching for the Helldivers 2 data directory... (20 seconds timeout)" >&2
game_dir=$(timeout 20 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")
IFS= read -ep "Please enter the path to the Helldivers 2 data directory: " game_dir
if [[ ! -d "$game_dir" ]]; then
echo -e "${RED}Error${NC}: Provided path is not a valid directory." >&2
exit 1
@@ -87,11 +86,11 @@ if [[ -x "$(command -v $SCRIPT_NAME)" ]]; then
[[ -n "${breaking_changes_patches[$i]}" ]] && eval $(echo "${breaking_changes_patches[$i]}" | sed "s:\$1:$game_dir:")
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): "
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; }
else
echo -e "Breaking changes patch for version $i applied ${GREEN}successfully${NC}."
echo -e "Breaking changes patch for version ${ORANGE}$i${NC} applied ${GREEN}successfully${NC}."
fi
done
fi
@@ -100,12 +99,12 @@ fi
# Install
read -p "Install the script to $DESTINATION_PATH or specify another path (must be included in \$PATH)? (Y/path): " response
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=$(eval echo "$response")
DESTINATION_PATH="$response"
if [[ ! -d "$DESTINATION_PATH" ]]; then
echo -e "${RED}Error:${NC} Path $DESTINATION_PATH does not exist. Exiting..."
echo -e "${RED}Error:${NC} Path $DESTINATION_PATH does not exist."
exit 1
fi
fi
+1 -1
View File
@@ -1 +1 @@
0.2.1
0.2.2