minor fixes
This commit is contained in:
@@ -4,7 +4,6 @@ Description=GZW EAC fix - post-update cache patch
|
|||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=@@INSTALL_DIR@@/fix.sh
|
ExecStart=@@INSTALL_DIR@@/fix.sh
|
||||||
Environment=DISPLAY=:0
|
PassEnvironment=DBUS_SESSION_BUS_ADDRESS DISPLAY WAYLAND_DISPLAY XDG_RUNTIME_DIR
|
||||||
PassEnvironment=DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR
|
|
||||||
StandardOutput=journal
|
StandardOutput=journal
|
||||||
StandardError=journal
|
StandardError=journal
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ INSTALL_DIR="@@INSTALL_DIR@@"
|
|||||||
NOTIFY="@@NOTIFY@@"
|
NOTIFY="@@NOTIFY@@"
|
||||||
LOG_MAX_LINES="@@LOG_MAX_LINES@@"
|
LOG_MAX_LINES="@@LOG_MAX_LINES@@"
|
||||||
POLL_INTERVAL="@@POLL_INTERVAL@@"
|
POLL_INTERVAL="@@POLL_INTERVAL@@"
|
||||||
POST_RESTORE_WAIT="@@POST_RESTORE_WAIT@@"
|
|
||||||
|
|
||||||
GAME_SUBPATH="common/Gray Zone Warfare/GZW/Content/SKALLA/PrebuildWorldData/World/cache"
|
GAME_SUBPATH="common/Gray Zone Warfare/GZW/Content/SKALLA/PrebuildWorldData/World/cache"
|
||||||
MANIFEST_NAME="appmanifest_${STEAM_APP_ID}.acf"
|
MANIFEST_NAME="appmanifest_${STEAM_APP_ID}.acf"
|
||||||
@@ -22,8 +21,6 @@ EAC_FILES=(
|
|||||||
LOG_FILE="$INSTALL_DIR/${SERVICE_NAME}.log"
|
LOG_FILE="$INSTALL_DIR/${SERVICE_NAME}.log"
|
||||||
STATE_FILE="$INSTALL_DIR/.last_known_state"
|
STATE_FILE="$INSTALL_DIR/.last_known_state"
|
||||||
|
|
||||||
# ─── logging ──────────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
@@ -72,8 +69,6 @@ _notify() {
|
|||||||
notify-send -a "$SERVICE_NAME" "$1" "$2" 2>/dev/null || true
|
notify-send -a "$SERVICE_NAME" "$1" "$2" 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
# ─── auto-detect steam library ────────────────────────────────────────────────
|
|
||||||
|
|
||||||
find_steam_library() {
|
find_steam_library() {
|
||||||
local bases=(
|
local bases=(
|
||||||
"$HOME/.local/share/Steam"
|
"$HOME/.local/share/Steam"
|
||||||
@@ -113,11 +108,10 @@ MANIFEST="$STEAM_APPS/$MANIFEST_NAME"
|
|||||||
|
|
||||||
log_info "GZW found at: $CACHE_DIR"
|
log_info "GZW found at: $CACHE_DIR"
|
||||||
|
|
||||||
# ─── build state detection ────────────────────────────────────────────────────
|
# Build State Detection:
|
||||||
#
|
|
||||||
# Fingerprint = buildid + all InstalledDepots manifest IDs (sorted).
|
# Fingerprint = buildid + all InstalledDepots manifest IDs (sorted).
|
||||||
# Depot manifests rotate on every content update even if the buildid doesn't.
|
# Depot manifests rotate on every content update even if the buildid doesn't.
|
||||||
# If fingerprint matches last run, skip the fix — nothing was actually updated.
|
# If fingerprint matches last run, skip the fix - nothing was actually updated.
|
||||||
|
|
||||||
read_game_state() {
|
read_game_state() {
|
||||||
local acf="$1"
|
local acf="$1"
|
||||||
@@ -153,10 +147,10 @@ if [[ -n "$LAST_STATE" ]]; then
|
|||||||
log_info " Previous: $LAST_STATE"
|
log_info " Previous: $LAST_STATE"
|
||||||
log_info " Current: $CURRENT_STATE"
|
log_info " Current: $CURRENT_STATE"
|
||||||
else
|
else
|
||||||
log_info "No previous state — running fix and recording baseline."
|
log_info "No previous state - running fix and recording baseline."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ─── fix ──────────────────────────────────────────────────────────────────────
|
# applying fix (remove -> regenerate -> lock)
|
||||||
|
|
||||||
_notify -i dialog-information "Applying EAC cache fix..."
|
_notify -i dialog-information "Applying EAC cache fix..."
|
||||||
|
|
||||||
@@ -183,8 +177,6 @@ done
|
|||||||
log_info "Flushing disk after restore..."
|
log_info "Flushing disk after restore..."
|
||||||
sync
|
sync
|
||||||
|
|
||||||
sleep "$POST_RESTORE_WAIT"
|
|
||||||
|
|
||||||
log_info "Setting files read-only..."
|
log_info "Setting files read-only..."
|
||||||
for f in "${EAC_FILES[@]}"; do
|
for f in "${EAC_FILES[@]}"; do
|
||||||
chmod 400 "$CACHE_DIR/$f"
|
chmod 400 "$CACHE_DIR/$f"
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ SERVICE_NAME="@@SERVICE_NAME@@"
|
|||||||
INSTALL_DIR="@@INSTALL_DIR@@"
|
INSTALL_DIR="@@INSTALL_DIR@@"
|
||||||
MANIFEST_PATH="@@MANIFEST_PATH@@"
|
MANIFEST_PATH="@@MANIFEST_PATH@@"
|
||||||
|
|
||||||
|
|
||||||
LOG_FILE="$INSTALL_DIR/${SERVICE_NAME}.log"
|
LOG_FILE="$INSTALL_DIR/${SERVICE_NAME}.log"
|
||||||
FIX_SCRIPT="$INSTALL_DIR/fix.sh"
|
FIX_SCRIPT="$INSTALL_DIR/fix.sh"
|
||||||
|
|
||||||
@@ -47,6 +46,6 @@ log_info "Watching: $MANIFEST_PATH"
|
|||||||
|
|
||||||
inotifywait -m -e close_write "$MANIFEST_PATH" 2>/dev/null \
|
inotifywait -m -e close_write "$MANIFEST_PATH" 2>/dev/null \
|
||||||
| while read -r _dir _event _file; do
|
| while read -r _dir _event _file; do
|
||||||
log_info "Manifest changed — invoking fix..."
|
log_info "Manifest changed - invoking fix..."
|
||||||
bash "$FIX_SCRIPT"
|
bash "$FIX_SCRIPT"
|
||||||
done
|
done
|
||||||
|
|||||||
2
setup.sh
2
setup.sh
@@ -12,7 +12,6 @@ INSTALL_DIR="$HOME/.local/share/gzw-eac-fix"
|
|||||||
NOTIFY="false" # set to true to enable desktop notifications via notify-send
|
NOTIFY="false" # set to true to enable desktop notifications via notify-send
|
||||||
LOG_MAX_LINES="200" # max lines kept in the log file
|
LOG_MAX_LINES="200" # max lines kept in the log file
|
||||||
POLL_INTERVAL="3" # seconds between file-exists checks after steam validate
|
POLL_INTERVAL="3" # seconds between file-exists checks after steam validate
|
||||||
POST_RESTORE_WAIT="2" # seconds to wait after files reappear before chmod
|
|
||||||
|
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
@@ -119,7 +118,6 @@ substitute() {
|
|||||||
-e "s|@@NOTIFY@@|${NOTIFY}|g" \
|
-e "s|@@NOTIFY@@|${NOTIFY}|g" \
|
||||||
-e "s|@@LOG_MAX_LINES@@|${LOG_MAX_LINES}|g" \
|
-e "s|@@LOG_MAX_LINES@@|${LOG_MAX_LINES}|g" \
|
||||||
-e "s|@@POLL_INTERVAL@@|${POLL_INTERVAL}|g" \
|
-e "s|@@POLL_INTERVAL@@|${POLL_INTERVAL}|g" \
|
||||||
-e "s|@@POST_RESTORE_WAIT@@|${POST_RESTORE_WAIT}|g" \
|
|
||||||
"$src" > "$dst"
|
"$src" > "$dst"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user