1#!/bin/sh 2 3if [ -z "$1" ] 4 then 5 echo "No argument supplied" 6 echo "Please provide the full path to the destination directory as an argument" 7 exit 1 8fi 9 10if (pwd | grep "Cataclysm-DDA/tools") 11then 12cd .. 13else 14if (ls Cataclysm-DDA) 15then 16echo "Cataclysm-DDA already exists" 17else 18echo "Cloning Cataclysm-DDA" 19git clone https://github.com/CleverRaven/Cataclysm-DDA 20fi 21cd Cataclysm-DDA 22fi 23 24make 25 26cd .. 27 28if (ls Hgamelaunch) 29then 30echo "Hgamelaunch already exists" 31else 32echo "Cloning Hgamelaunch" 33git clone https://github.com/C0DEHERO/Hgamelaunch 34fi 35cd Hgamelaunch 36 37echo "Building Hgamelaunch" 38cabal sandbox init 39cabal install --only-dependencies 40cabal configure 41cabal build 42 43# Setup folder structure 44#ROOTDIR = $1 45mkdir -p $1 46echo "Copying bin to $1" 47cp ./dist/build/Hgamelaunch/Hgamelaunch $1 48echo "Copying config dir to $1/config" 49cp -rn ./config $1 50cp -r ./config/examples $1 51echo "Copying license to $1" 52cp ./LICENSE.md $1 53echo "Copying readme to $1" 54cp ./README.md $1 55 56# Copying game files 57cd ../Cataclysm-DDA 58mkdir -p $1/cdda 59cp ./cataclysm $1/cdda/ 60mkdir -p $1/share/cataclysm-dda 61mkdir -p $1/share/save 62mkdir -p $1/share/memorial 63cp -r ./data/. $1/share/cataclysm-dda 64cp -r ./gfx $1/share/cataclysm-dda 65cp -r ./lang $1/share/cataclysm-dda 66 67# Copying games.json 68cd $1 69ROOTPATH=$(echo "$1/" | sed -e 's/[\/&]/\\&/g') 70echo "Copying games.json" 71if (ls ./config/games.json) 72then 73cp ./config/examples/Cataclysm-DDA/games.json ./config/games.json.new 74sed -i "s/!rootpath/$ROOTPATH/g" ./config/games.json.new 75echo "New config has been copied to $1/config/games.json.new" 76else 77cp ./config/examples/Cataclysm-DDA/games.json ./config/ 78sed -i "s/!rootpath/$ROOTPATH/g" ./config/games.json 79fi 80 81# Making admin userdir 82mkdir -p $1/userdata/cdda/admin/ 83mkdir -p $1/userdata/cdda/admin/ttyrec 84 85# Creating the directories for ttrecs in progress 86mkdir -p $1/cdda-inprogress/ 87mkdir -p $1/cdda-shared-inprogress/ 88 89echo "FINISHED! Hgamelaunch was installed into $1" 90echo "The admin login is:" 91echo "username: admin" 92echo "password: admin" 93echo "Please make sure to change the password before opening the server to the public!" 94echo "You can also add, remove, or configure game launchers in config/games.json" 95echo "Make sure to stick to the format, otherwise it won't be read" 96echo "You might also want to change the banners located in config/banners" 97echo "After you configured Hgamelaunch you need to set up an ssh server." 98echo "I assume that you know how to do that." 99