-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
executable file
·159 lines (133 loc) · 3.58 KB
/
deploy.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/usr/bin/env bash
source ./CONFIG.inc
check() {
for d in . $KSP_DEV ; do
if [ ! -d "${d}/GameData/${TARGETBINDIR}/" ] ; then
rm -f "${d}/GameData/${TARGETBINDIR}/"
fi
mkdir -p "${d}/GameData/${TARGETBINDIR}"
if [[ ! -z "${PD_DLLS}" ]] ; then
mkdir -p "${d}/GameData/${TARGETBINDIR}/PluginData/"
fi
if [[ ! -z "${PD_SUB_DIRS}" ]] ; then
for dd in ${PD_SUB_DIRS} ; do
mkdir -p "${d}/GameData/${TARGETBINDIR}/PluginData/${dd}/"
done
fi
if [[ ! -z "${EXCEPTION_DIRS}" ]] ; then
for dd in ${EXCEPTION_DIRS} ; do
mkdir -p "${d}/GameData/${TARGETBINDIR}/${dd}/"
done
fi
rm -f ${d}/GameData/${TARGETBINDIR}/KSPe.Light.*
done
if [[ -d "./bin/Release" && -d "./bin/Debug" ]] ; then
echo "Conflicting Release and Debug dirs. Clean and rebuild!"
exit -1
fi
if [[ ! -d "./bin/Release" && ! -d "./bin/Debug" ]] ; then
echo "Absent Release and Debug dirs. Nothingn to do! Rebuild!"
exit -2
fi
}
deploy() {
local DLL=$1.dll
if [ -f "./bin/Release/${DLL}" ] ; then
cp "./bin/Release/${DLL}" "./GameData/${TARGETBINDIR}/"
if [ -d "${KSP_DEV}/GameData/${TARGETBINDIR}/" ] ; then
cp "./bin/Release/${DLL}" "${KSP_DEV}/GameData/${TARGETBINDIR}/"
fi
fi
if [ -f "./bin/Debug/${DLL}" ] ; then
if [ -d "${KSP_DEV}/GameData/${TARGETBINDIR}/" ] ; then
cp "./bin/Debug/${DLL}" "${KSP_DEV}/GameData/${TARGETBINDIR}/"
fi
fi
}
deploy_lib() {
local DLL=$1.dll
if [ -f "./bin/Release/${DLL}" ] ; then
cp "./bin/Release/${DLL}" "${LIB}"
fi
}
deploy_plugindata() {
local DLL=$1.dll
if [ -f "./bin/Release/${DLL}" ] ; then
for d in . ${KSP_DEV} ; do
cp "./bin/Release/${DLL}" "${d}/GameData/${TARGETBINDIR}/PluginData"
done
fi
if [ -f "./bin/Debug/${DLL}" ] ; then
if [ ! -z ${KSP_DEV} ] ; then
cp "./bin/Debug/${DLL}" "${KSP_DEV}/GameData/${TARGETBINDIR}/PluginData"
fi
fi
}
deploy_plugindata_sub() {
local DLL=$1.dll
local TARGET=${PD_SUB_RULES[$1]}.dll
if [ -f "./bin/Release/${DLL}" ] ; then
for d in . ${KSP_DEV} ; do
cp "./bin/Release/${DLL}" "${d}/GameData/${TARGETBINDIR}/PluginData/${TARGET}"
done
fi
if [ -f "./bin/Debug/${DLL}" ] ; then
if [ ! -z ${KSP_DEV} ] ; then
cp "./bin/Debug/${DLL}" "${KSP_DEV}/GameData/${TARGETBINDIR}/PluginData/${TARGET}"
fi
fi
}
deploy_plugindata_ex() {
local DLL=$1.dll
local TARGET=${EXCEPTION_RULES[$1]}/$DLL
if [ -f "./bin/Release/${DLL}" ] ; then
for d in . ${KSP_DEV} ; do
cp "./bin/Release/${DLL}" "${d}/GameData/${TARGETBINDIR}/${TARGET}"
done
fi
if [ -f "./bin/Debug/${DLL}" ] ; then
if [ ! -z ${KSP_DEV} ] ; then
cp "./bin/Debug/${DLL}" "${KSP_DEV}/GameData/${TARGETBINDIR}/${TARGET}"
fi
fi
}
deploy_gamedata() {
local PLACE=$1
local DLL=$2.dll
if [ -f "./bin/Release/${DLL}" ] ; then
for d in . ${KSP_DEV} ; do
cp "./bin/Release/${DLL}" "${d}/GameData/${PLACE}_${DLL}"
done
fi
if [ -f "./bin/Debug/${DLL}" ] ; then
if [ ! -z ${KSP_DEV} ] ; then
cp "./bin/Debug/${DLL}" "${KSP_DEV}/GameData/${PLACE}_$DLL"
fi
fi
}
VERSIONFILE=${PACKAGE}.version
check
cp $VERSIONFILE "./GameData/${TARGETDIR}"
cp CHANGE_LOG.md "./GameData/${TARGETDIR}"
cp README.md "./GameData/${TARGETDIR}"
cp LICENSE* "./GameData/${TARGETDIR}"
cp NOTICE "./GameData/${TARGETDIR}"
for dll in $LIB_DLLS ; do
deploy_lib $dll
done
for dll in $DLLS ; do
deploy $dll
done
for dll in $PD_DLLS ; do
deploy_plugindata $dll
done
for dll in ${!PD_SUB_RULES[@]} ; do
deploy_plugindata_sub $dll
done
for dll in $GD_DLLS ; do
deploy_gamedata $GD_PRIORITY $dll
done
for dll in ${!EXCEPTION_RULES[@]} ; do
deploy_plugindata_ex $dll
done
echo "${VERSION} Deployed into ${KSP_DEV}"