aboutsummaryrefslogtreecommitdiff
path: root/beyond-the-titanic
blob: 867fec06757f41a990f6e3be12da69cef58e7390 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
# File: /usr/bin/beyond-the-titanic
# Author: bgstack15
# Startdate: 2019-03-31 17:55
# Title: Beyond the Titanic
# Package;
# Purpose: Runs BEYOND from the correct location
# History:
# Usage: Normally called by /usr/share/applications/beyond-the-titanic.desktop
# Reference:
#    https://stackoverflow.com/questions/2924697/how-does-one-output-bold-text-in-bash
# Improve:
# Documentation:
# Dependencies:
#    file /etc/default/beyond-the-titanic
#    tput

# 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_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 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 ;
   fi
fi

# start game
cd "${BEYOND_PLAY_DIR}"
./BEYOND

# return terminal text to normal style
tput sgr0
bgstack15