Preserve data across the Straywild transition

This commit is contained in:
Alexander Sellite 2026-08-25 22:18:20 -04:00
parent 737d1cf2e0
commit 98a27e2f53
28 changed files with 577 additions and 94 deletions

View file

@ -21,7 +21,11 @@ GAMEDIR="/${directory}/ports/straywild"
CONFDIR="$GAMEDIR/conf"
PORTS_ROOT="${GAMEDIR%/straywild}"
SAVEDIR="$PORTS_ROOT/saves/straywild"
LEGACY_GAMEDIR="$PORTS_ROOT/netfishing"
LEGACY_CONFDIR="$LEGACY_GAMEDIR/conf"
LEGACY_SAVEDIR="$PORTS_ROOT/saves/netfishing"
DATA_BOOTSTRAP_DIR="$CONFDIR/data/godot/app_userdata/straywild"
LEGACY_DATA_BOOTSTRAP_DIR="$CONFDIR/data/godot/app_userdata/NETFISHING"
GAME_EXECUTABLE="$GAMEDIR/straywild.aarch64"
GAME_LAUNCHER="$GAMEDIR/launch-straywild.sh"
GPTOKEYB_CONFIG="$GAMEDIR/straywild.gptk"
@ -33,13 +37,30 @@ HARBOURMASTER="$controlfolder/harbourmaster"
mkdir -p "$CONFDIR/data" "$CONFDIR/config" "$CONFDIR/cache" "$WESTON_DIR"
chmod +x "$GAME_EXECUTABLE"
# A renamed PortMaster entry installs beside the former NETfishing port. Copy
# its device-local configuration once and continue using its established save
# root when present. New installations use straywild paths exclusively.
if [ -d "$LEGACY_CONFDIR" ] && [ ! -f "$CONFDIR/.netfishing-imported" ]; then
cp -a "$LEGACY_CONFDIR/." "$CONFDIR/"
touch "$CONFDIR/.netfishing-imported"
fi
if [ ! -f "$SAVEDIR/straywild_data.json" ] \
&& [ ! -f "$SAVEDIR/netfishing_data.json" ] \
&& { [ -f "$LEGACY_SAVEDIR/straywild_data.json" ] \
|| [ -f "$LEGACY_SAVEDIR/netfishing_data.json" ]; }; then
SAVEDIR="$LEGACY_SAVEDIR"
fi
# straywild uses a predictable save directory beside the port instead of
# presenting a folder picker on a small screen. Preserve an established
# data-root choice when upgrading an existing installation.
straywild_DATA_ENVIRONMENT=()
if [ -f "$SAVEDIR/straywild_data.json" ] || {
if [ -f "$SAVEDIR/straywild_data.json" ] \
|| [ -f "$SAVEDIR/netfishing_data.json" ] || {
[ ! -f "$DATA_BOOTSTRAP_DIR/data_root_bootstrap.json" ] &&
[ ! -f "$DATA_BOOTSTRAP_DIR/data_root_bootstrap.json.backup" ]
[ ! -f "$DATA_BOOTSTRAP_DIR/data_root_bootstrap.json.backup" ] &&
[ ! -f "$LEGACY_DATA_BOOTSTRAP_DIR/data_root_bootstrap.json" ] &&
[ ! -f "$LEGACY_DATA_BOOTSTRAP_DIR/data_root_bootstrap.json.backup" ]
}; then
mkdir -p "$SAVEDIR"
straywild_DATA_ENVIRONMENT+=(