-
Notifications
You must be signed in to change notification settings - Fork 6
/
package.sh
executable file
·107 lines (77 loc) · 2.41 KB
/
package.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
99
100
101
102
103
104
105
106
107
#!/usr/bin/env bash
set -euxo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$DIR"
make_zip() {
dir="$1"
zipfile="$2"
if [ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]; then
zipfile=`cygpath -w "$zipfile"`
dir=`cygpath -w "$dir"`
"$DIR/7z1900-extra/7za.exe" a "$zipfile" "$dir"
else
zip -r "$zipfile" "$dir"
fi
}
package_common() {
cp -r "$DIR/images" .
cp -r "$DIR/resources" .
cp "$DIR/"*.py .
}
package_win() {
mkdir -p packages/windows/dungeons_and_directories/assets
pushd packages/windows/dungeons_and_directories/assets
mkdir python
cd python
unzip ../../../../../python-3.8.3-embed-amd64.zip
cd ..
package_common
cd ..
cp -r ../../../run_windows.bat run_dungeons_and_directories.bat
cp -r ../../../uninstall_windows.bat uninstall.bat
popd
cd packages/windows
make_zip dungeons_and_directories "$DIR/packages/dungeons_and_directories_windows_amd64.zip"
cd ..
rm -rf windows
cd ..
}
package_linux() {
mkdir -p packages/linux/dungeons_and_directories/assets
pushd packages/linux/dungeons_and_directories/assets
package_common
cd ..
echo '#!/bin/bash' >> run_dungeons_and_directories.sh
echo 'DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"' >> run_dungeons_and_directories.sh
echo 'cd "$DIR"' >> run_dungeons_and_directories.sh
echo './assets/game.py' >> run_dungeons_and_directories.sh
chmod +x run_dungeons_and_directories.sh
echo 'Please run the game in a terminal!' > readme_really_short_i_swear.txt
popd
cd packages/linux
make_zip dungeons_and_directories "$DIR/packages/dungeons_and_directories_linux.zip"
cd ..
rm -rf linux
cd ..
}
package_osx() {
mkdir -p packages/osx/dungeons_and_directories.app/Contents/MacOS/assets
pushd packages/osx/dungeons_and_directories.app/Contents/MacOS/assets
package_common
cd ..
echo '#!/bin/bash' >> dungeons_and_directories
echo 'DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"' >> dungeons_and_directories
echo 'cd "$DIR"' >> dungeons_and_directories
echo 'open -a Terminal ./assets/game.py' >> dungeons_and_directories
chmod +x dungeons_and_directories
popd
cd packages/osx
make_zip dungeons_and_directories.app "$DIR/packages/dungeons_and_directories_osx.zip"
cd ..
rm -rf osx
cd ..
}
if [ -e packages ]; then rm -rf packages; fi
package_win
package_linux
package_osx