From c45979bfb538801dd84acb16b7b26583308ae446 Mon Sep 17 00:00:00 2001 From: B Stack Date: Sun, 31 Mar 2019 21:06:39 -0400 Subject: use $HOME-based play directory * modify script to copy the game to a $HOME subdirectory so the game has read-write access to the data files and savegame directory. --- beyond-the-titanic | 14 +++++++++++--- beyond-the-titanic.desktop | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/beyond-the-titanic b/beyond-the-titanic index 6a1ce22..867fec0 100644 --- a/beyond-the-titanic +++ b/beyond-the-titanic @@ -17,14 +17,22 @@ # load variables from defaults file test -r "/etc/default/beyond-the-titanic" && . /etc/default/beyond-the-titanic 1>/dev/null 2>&1 -test -z "${BEYOND_DIR}" && BEYOND_DIR=/usr/share/beyond-the-titanic +test -z "${BEYOND_SRC_DIR}" && BEYOND_SRC_DIR=/usr/share/beyond-the-titanic +test -z "${BEYOND_PLAY_DIR}" && BEYOND_PLAY_DIR=~/.local/share/beyond-the-titanic + +# prepare play directory, because the game needs write access to the data files, as well as to the directory for saving the game +mkdir -p "${BEYOND_PLAY_DIR}" 2>/dev/null +chmod 0700 "${BEYOND_PLAY_DIR}" +cp -pr "${BEYOND_SRC_DIR}"/* "${BEYOND_PLAY_DIR}" +chmod 0600 "${BEYOND_PLAY_DIR}"/* +chmod 0700 "${BEYOND_PLAY_DIR}/BEYOND" # warn about screen size if not correct if test -z "${BEYOND_SILENT}" ; then ___cols="$( tput cols 2>/dev/null )" ___lines="$( tput lines 2>/dev/null )" - if "${___cols}" != "80" || "${___lines}" != "24" ; + if test "${___cols}" != "80" || test "${___lines}" != "24" ; then printf "The game recommends using a terminal size of exactly 80 columns by 24 lines. Set BEYOND_SILENT=1 to suppress this message.\nPress enter to continue. " read ___foo ; @@ -32,7 +40,7 @@ then fi # start game -cd "${BEYOND_DIR}" +cd "${BEYOND_PLAY_DIR}" ./BEYOND # return terminal text to normal style diff --git a/beyond-the-titanic.desktop b/beyond-the-titanic.desktop index a7f585e..75df004 100644 --- a/beyond-the-titanic.desktop +++ b/beyond-the-titanic.desktop @@ -4,7 +4,7 @@ Name=Beyond the Titanic Exec=/usr/bin/beyond-the-titanic Type=Application StartupNotify=true -Path=/usr/share/beyond-the-titanic +Path=/usr/bin Icon=beyond-the-titanic StartupWMClass=BEYOND Comment=Text adventure game from 1988 -- cgit