forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setuphgamelaunch.sh
98 lines (86 loc) · 2.4 KB
/
setuphgamelaunch.sh
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/sh
if [ -z "$1" ]
then
echo "No argument supplied"
echo "Please provide the full path to the destination directory as an argument"
exit 1
fi
if (pwd | grep "Cataclysm-DDA/tools")
then
cd ..
else
if (ls Cataclysm-DDA)
then
echo "Cataclysm-DDA already exists"
else
echo "Cloning Cataclysm-DDA"
git clone https://github.com/CleverRaven/Cataclysm-DDA
fi
cd Cataclysm-DDA
fi
make
cd ..
if (ls Hgamelaunch)
then
echo "Hgamelaunch already exists"
else
echo "Cloning Hgamelaunch"
git clone https://github.com/C0DEHERO/Hgamelaunch
fi
cd Hgamelaunch
echo "Building Hgamelaunch"
cabal sandbox init
cabal install --only-dependencies
cabal configure
cabal build
# Setup folder structure
#ROOTDIR = $1
mkdir -p $1
echo "Copying bin to $1"
cp ./dist/build/Hgamelaunch/Hgamelaunch $1
echo "Copying config dir to $1/config"
cp -rn ./config $1
cp -r ./config/examples $1
echo "Copying license to $1"
cp ./LICENSE.md $1
echo "Copying readme to $1"
cp ./README.md $1
# Copying game files
cd ../Cataclysm-DDA
mkdir -p $1/cdda
cp ./cataclysm $1/cdda/
mkdir -p $1/share/cataclysm-dda
mkdir -p $1/share/save
mkdir -p $1/share/memorial
cp -r ./data/. $1/share/cataclysm-dda
cp -r ./gfx $1/share/cataclysm-dda
cp -r ./lang $1/share/cataclysm-dda
# Copying games.json
cd $1
ROOTPATH=$(echo "$1/" | sed -e 's/[\/&]/\\&/g')
echo "Copying games.json"
if (ls ./config/games.json)
then
cp ./config/examples/Cataclysm-DDA/games.json ./config/games.json.new
sed -i "s/!rootpath/$ROOTPATH/g" ./config/games.json.new
echo "New config has been copied to $1/config/games.json.new"
else
cp ./config/examples/Cataclysm-DDA/games.json ./config/
sed -i "s/!rootpath/$ROOTPATH/g" ./config/games.json
fi
# Making admin userdir
mkdir -p $1/userdata/cdda/admin/
mkdir -p $1/userdata/cdda/admin/ttyrec
# Creating the directories for ttrecs in progress
mkdir -p $1/cdda-inprogress/
mkdir -p $1/cdda-shared-inprogress/
echo "FINISHED! Hgamelaunch was installed into $1"
echo "The admin login is:"
echo "username: admin"
echo "password: admin"
echo "Please make sure to change the password before opening the server to the public!"
echo "You can also add, remove, or configure game launchers in config/games.json"
echo "Make sure to stick to the format, otherwise it won't be read"
echo "You might also want to change the banners located in config/banners"
echo "After you configured Hgamelaunch you need to set up an ssh server."
echo "I assume that you know how to do that."