summaryrefslogtreecommitdiff
path: root/games/tomenet/tomenet.sh
blob: 464bb885179d4ce4dd95af0b9831916549b6081e (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
#!/bin/sh

GAMES_TOMENET=/usr/share/games/tomenet

if [ ! -e ${HOME}/.tomenet ]; then
  mkdir -p ${HOME}/.tomenet

  # Make a copy of the lib directory for the user
  cp -R ${GAMES_TOMENET}/lib ${HOME}/.tomenet/

  # Server configuration files
  cp ${GAMES_TOMENET}/tomenet.cfg ${GAMES_TOMENET}/forbidlist ${HOME}/.tomenet/

  # Create an account file
  touch ${HOME}/.tomenet/tomenet.acc

  # Create links for running the server in ${HOME}/.tomenet
  ln -s ${GAMES_TOMENET}/tomenet.server ${HOME}/.tomenet/tomenet.server
  ln -s ${GAMES_TOMENET}/evilmeta ${HOME}/.tomenet/evilmeta
fi

cd ${HOME}/.tomenet

# Point $TOMENET_PATH to the local lib directory
export TOMENET_PATH=${HOME}/.tomenet/lib

case $(basename $0) in
  tomenet)
    exec ${GAMES_TOMENET}/tomenet "$@"
    ;;
  tomnet.console)
    exec ${GAMES_TOMENET}/tomenet.console "$@"
    ;;
  tomenet.server)
    exec ${GAMES_TOMENET}/tomenet.server "$@"
    ;;
  accedit)
    exec ${GAMES_TOMENET}/accedit "$@"
    ;;
  evilmeta)
    exec ${GAMES_TOMENET}/evilmeta "$@"
    ;;
  esac