forked from pryans/kcd-cheat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·72 lines (58 loc) · 1.89 KB
/
release.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
#!/bin/bash -xe
MOD_NAME="Cheat"
MOD_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
MOD_DESC="https://www.nexusmods.com/kingdomcomedeliverance/mods/106"
MOD_AUTHOR="spraguep"
MOD_CLASS=""
function packageRelease() {
local NOKEYS="${1}"
SRC_DIR="${MOD_DIR}/Source"
REL_DIR="${MOD_DIR}/Release"
PKG_DIR="${MOD_DIR}/Package"
TMP_DIR="${MOD_DIR}/Temp"
VERSION_MAJOR=$(grep "cheat.versionMajor =" "${SRC_DIR}/Scripts/Startup/main.lua" | sed 's/[^0-9]*//g')
VERSION_MINOR=$(grep "cheat.versionMinor =" "${SRC_DIR}/Scripts/Startup/main.lua" | sed 's/[^0-9]*//g')
VERSION="${VERSION_MAJOR}.${VERSION_MINOR}"
# Delete package folder if it already exists
if [[ -d "${PKG_DIR}" ]]; then
rm -rf "${PKG_DIR}"
fi
# Setup package folder structure
mkdir -p "${PKG_DIR}/${MOD_NAME}/Data"
# Create manifest file
cat <<EOF > "${PKG_DIR}/${MOD_NAME}/mod.manifest"
<?xml version="1.0" encoding="utf-8"?>
<kcd_mod>
<info>
<name>${MOD_NAME}</name>
<description>${MOD_DESC}</description>
<author>${MOD_AUTHOR}</author>
<version>${VERSION}</version>
<created_on>$(date)</created_on>
</info>
</kcd_mod>
EOF
# clone source dir
mkdir -p "${TMP_DIR}"
cp -r "${SRC_DIR}" "${TMP_DIR}"
# delete default profile?
if [[ "${NOKEYS}" == "TRUE" ]]; then
rm -rf "${TMP_DIR}/Source/Libs/Config/defaultProfile.xml"
MOD_CLASS="-NOKEYS"
fi
# Create new data pak file
cd "${TMP_DIR}/Source"
7za a -mx=0 -tzip "${PKG_DIR}/${MOD_NAME}/Data/data.pak" ./*
# Remove old release package
if [[ -f "${REL_DIR}/${MOD_NAME}${MOD_CLASS}-${VERSION}.zip" ]]; then
rm "${REL_DIR}/${MOD_NAME}${MOD_CLASS}-${VERSION}.zip"
fi
# Create new release package
mkdir -p "${REL_DIR}"
cd "${PKG_DIR}"
7za a -tzip "${REL_DIR}/${MOD_NAME}${MOD_CLASS}-${VERSION}.zip" ./*
}
# normal release
packageRelease "FALSE"
# release without key bindings
packageRelease "TRUE"