#!/bin/bash set -e if [ ! -d ~/.clonekeen ]; then mkdir ~/.clonekeen cp -p /usr/share/clonekeen/*.dat ~/.clonekeen cp -a /usr/share/clonekeen/data ~/.clonekeen fi # We have to do it like this to support migration from 0.8.3 to 0.8.4 if [ ! -f ~/.clonekeen/demolvl.ck1 ]; then cp -p /usr/share/clonekeen/demolvl.ck1 ~/.clonekeen fi if [ ! -f ~/.clonekeen/flags.ini ]; then cp -p /usr/share/clonekeen/flags.ini ~/.clonekeen fi if [ ! -f ~/.clonekeen/palette.ini ]; then cp -p /usr/share/clonekeen/palette.ini ~/.clonekeen fi if [ ! -d ~/.clonekeen/gfx ]; then mkdir ~/.clonekeen/gfx cp -p /usr/share/clonekeen/gfx/* ~/.clonekeen/gfx fi if [ ! -f ~/.clonekeen/data/storytxt.ck1 ]; then set +e /usr/share/autodl/AutoDL.py /usr/share/clonekeen/clonekeen.autodlrc STATUS=$? set -e # status 2 means download was ok, but the user choose not to start the game if [ "$STATUS" = "0" -o "$STATUS" = "2" ]; then cd ~/.clonekeen/data unzip -qq 1keen.zip CK1SW131.SHR /usr/libexec/clonekeen-extract CK1SW131.SHR > /dev/null rm 1keen.zip CK1SW131.SHR keen1.exe fi if [ "$STATUS" != "0" ]; then exit $STATUS fi fi if [ -f ~/.clonekeen/data/keen2.exe -a ! -f ~/.clonekeen/data/sounds.ck2 ]; then cd ~/.clonekeen/data /usr/libexec/clonekeen-extract-sounds keen2.exe > /dev/null fi if [ -f ~/.clonekeen/data/keen3.exe -a ! -f ~/.clonekeen/data/sounds.ck3 ]; then cd ~/.clonekeen/data /usr/libexec/clonekeen-extract-sounds keen3.exe > /dev/null fi cd ~/.clonekeen exec /usr/libexec/clonekeen "$@"