feat: update functionality testing

This commit is contained in:
v4n
2025-01-16 09:24:19 +02:00
parent efbd7d348c
commit 8d6591a19d
4 changed files with 42 additions and 4 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
*
!h2mm
!install.sh
!README.md
!README.md
!version
+2 -2
View File
@@ -89,8 +89,6 @@ You can use the short form of the commands to save some time. The shortcuts are:
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
@@ -115,6 +113,8 @@ Feel free to contribute to this project by creating a pull request or opening an
## Planned features
- [ ] ! Enable/disable mods
- [ ] ! Provide fixes for breaking updates
- [ ] ! Auto update 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
+37 -1
View File
@@ -1,5 +1,7 @@
#!/bin/bash
VERSION="0.1.6"
# --- Globals ---
RED='\033[0;31m'
@@ -11,6 +13,10 @@ H2PATH="${HOME}/.config/h2mm/h2path"
MODS_DIR=""
DB_FILE=""
LAST_UPDATE_FILE="${HOME}/.config/h2mm/last_update"
VERSION_URL="https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/dev/version"
REPO_URL="https://github.com/v4n00/h2mm-cli"
# --- Utility Functions ---
function get_filename_without_path() {
@@ -82,7 +88,7 @@ function initialize_directories() {
# --- Help Functions ---
function display_help() {
echo "Helldivers 2 Mod Manager v0.1.6"
echo "Helldivers 2 Mod Manager v${VERSION}"
echo "Usage: h2mm [command] [options]"
echo "Commands:"
echo " install Install a mod with files (short form: h2mm i)."
@@ -155,6 +161,35 @@ function display_import_help() {
# --- Main Functions ---
# Check for updates
function check_for_updates() {
if [[ -f "$LAST_UPDATE_FILE" ]]; then
last_update=$(cat "$LAST_UPDATE_FILE")
if [[ $(date +%Y-%m-%d) -gt $(date +%Y-%m-%d -d "$last_update + 7 days") ]]; then
return
fi
else
echo $(date +%Y-%m-%d) > "$LAST_UPDATE_FILE"
exit 0
fi
latest_version=$(curl -sS "$VERSION_URL")
if [[ $? -ne 0 ]]; then
echo "${RED}Error:${NC} Could not check for updates." >&2
return
fi
if [[ "$latest_version" != "$VERSION" ]]; then
echo -e "${RED}!${NC} A new version of h2mm is available: ${ORANGE}$VERSION${NC} -> ${GREEN}$latest_version${NC}" >&2
echo -e "${RED}!${NC} You can download it from: $REPO_URL" >&2
fi
echo $(date +%Y-%m-%d) > "$LAST_UPDATE_FILE"
}
# Mod management
function mod_reset() {
if [[ "$1" == "--help" || "$1" == "-h" ]]; then
display_reset_help
@@ -507,6 +542,7 @@ function main() {
command="$1"
shift
initialize_directories
check_for_updates
case "$command" in
install|i)
+1
View File
@@ -0,0 +1 @@
0.2.0