5f019de
#!/bin/bash
5f019de
5f019de
set -e
5f019de
1ab05d8
# First check if a system-wide doom1.wad is installed and if it is
1ab05d8
# use that instead of downloading
1ab05d8
if [ -f /usr/share/games/doom/doom1.wad ]; then
1ab05d8
  exec /usr/bin/vavoom -iwaddir /usr/share/games/doom -doom "$@"
1ab05d8
elif [ -f /usr/share/doom/doom1.wad ]; then
1ab05d8
  exec /usr/bin/vavoom -iwaddir /usr/share/doom -doom "$@"
609a41f
fi
609a41f
5f019de
if [ ! -f ~/.vavoom/doom-shareware/doom1.wad ]; then
5f019de
  set +e
5f019de
  /usr/share/autodl/AutoDL.py /usr/share/vavoom/doom.autodlrc
5f019de
  STATUS=$?
5f019de
  set -e
5f019de
  # status 2 means download was ok, but the user choice not to start the game
5f019de
  if [ "$STATUS" = "0" -o  "$STATUS" = "2" ]; then
5f019de
    cd ~/.vavoom/doom-shareware
5f019de
    unzip -u doom19s.zip 'DOOMS_19.?'
5f019de
    cat DOOMS_19.1 DOOMS_19.2 > doom.zip
5f019de
    unzip -u -L doom.zip doom1.wad
5f019de
    rm doom19s.zip DOOMS_19.1 DOOMS_19.2 doom.zip
5f019de
  fi
5f019de
  if [ "$STATUS" != "0" ]; then
5f019de
    exit $STATUS
5f019de
  fi
5f019de
fi
5f019de
5f019de
exec /usr/bin/vavoom -iwaddir ~/.vavoom/doom-shareware -doom "$@"