aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-03-31 21:06:39 -0400
committerB Stack <bgstack15@gmail.com>2019-03-31 21:06:39 -0400
commitc45979bfb538801dd84acb16b7b26583308ae446 (patch)
tree20ab4d383f3954067f4eb1d5b32652f005c302f9
parentadd makefile and other package-ready elements (diff)
downloadbeyond-the-titanic-master.tar.gz
beyond-the-titanic-master.tar.bz2
beyond-the-titanic-master.zip
use $HOME-based play directoryHEADmaster
* modify script to copy the game to a $HOME subdirectory so the game has read-write access to the data files and savegame directory.
-rw-r--r--beyond-the-titanic14
-rw-r--r--beyond-the-titanic.desktop2
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
bgstack15