diff --git a/.gitignore b/.gitignore index 6f431db9..07cf065e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ TODO .sbin .config .tmp +.save World locale/ *~ diff --git a/Makefile b/Makefile index 90e09727..7c4e3f49 100644 --- a/Makefile +++ b/Makefile @@ -55,8 +55,8 @@ tests-zsh: clean ./"game shell (1).sh" -Zdq -c 'gsh systemconfig; for _ in $$(seq 42); do gsh goal|cat; gsh test --abort; gsh auto --abort; done; gsh stat' clean: - rm -rf i18n/*~ locale gameshell.tgz gameshell.sh gameshell-save*.sh scripts/boxes-data.awk - rm -rf .bin .config .sbin .tmp World + rm -rf i18n/*~ locale gameshell gameshell.tar gameshell.tgz gameshell.sh gameshell-save*.sh scripts/boxes-data.awk + rm -rf .bin .config .sbin .tmp .save World rm -rf "game shell"* .PHONY: clean new FORCE diff --git a/lib/header.sh b/lib/header.sh index db2613f8..18384155 100644 --- a/lib/header.sh +++ b/lib/header.sh @@ -160,6 +160,7 @@ NB_LINES=$(awk '/^##START_OF_GAMESHELL_ARCHIVE##/ {print NR + 1; exit 0; }' "$GS if [ "$GSH_EXTRACT" = "true" ] then + echo $NB_LINES tail -n+"$NB_LINES" "$GSH_EXEC_DIR/$GSH_EXEC_FILE" > "$GSH_EXEC_DIR/${GSH_EXEC_FILE%.*}.tgz" echo "Archive saved in $GSH_EXEC_DIR/${GSH_EXEC_FILE%.*}.tgz" exit 0 @@ -190,6 +191,10 @@ fi # and add a safeguard so we can check we are not removing another directory touch "$GSH_ROOT/.gsh_root-$$" +# add a .save file so that we save the directory into a self extracting archive +# when exiting +touch "$GSH_ROOT/.save" + tail -n+"$NB_LINES" "$GSH_EXEC_DIR/$GSH_EXEC_FILE" > "$GSH_ROOT/gameshell.tgz" tar -zx -C "$GSH_ROOT" -f "$GSH_ROOT/gameshell.tgz" rm "$GSH_ROOT/gameshell.tgz" diff --git a/start.sh b/start.sh index ba55ddbb..7623831c 100755 --- a/start.sh +++ b/start.sh @@ -506,9 +506,6 @@ cd "$GSH_HOME" export GSH_UID=$(cat "$GSH_CONFIG/uid") date "+%Y-%m-%d %H:%M:%S" | sed 's/^/#>>> /' >> "$GSH_CONFIG/missions.log" -# put a ".save" file to indicate the archive needs to be saved on exit -touch "$GSH_ROOT/.save" - # if the user uses a special TERMINFO entry, it might not be found because # GameShell redefines HOME if [ -z "$TERMINFO" ]