fix errors and typo
This commit is contained in:
parent
84a98edc02
commit
53216d2ced
53
builder
53
builder
@ -18,7 +18,6 @@ source "$ScriptDir/helper.lib"
|
|||||||
# Common
|
# Common
|
||||||
SteamPath=$(reg_readkey "HKCU\Software\Valve\Steam" "SteamPath")
|
SteamPath=$(reg_readkey "HKCU\Software\Valve\Steam" "SteamPath")
|
||||||
DocumentsPath=$(reg_readkey "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Personal")
|
DocumentsPath=$(reg_readkey "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Personal")
|
||||||
WorkDir="$(dirname "$(readlink -e "$0")")"
|
|
||||||
ThirdPartyBin="$ScriptDir/3rd-party-bin"
|
ThirdPartyBin="$ScriptDir/3rd-party-bin"
|
||||||
|
|
||||||
# Usefull KF2 executables / Paths / Configs
|
# Usefull KF2 executables / Paths / Configs
|
||||||
@ -55,8 +54,7 @@ KFPublishConfig="$KFPublish/Config"
|
|||||||
KFPublishLocalization="$KFPublish/Localization"
|
KFPublishLocalization="$KFPublish/Localization"
|
||||||
|
|
||||||
# Tmp files
|
# Tmp files
|
||||||
MutWsInfoName="wsinfo.txt"
|
MutWsInfo="$KFDoc/wsinfo.txt"
|
||||||
MutWsInfo="$KFDoc/$MutWsInfoName"
|
|
||||||
KFEditorConfBackup="$KFEditorConf.backup"
|
KFEditorConfBackup="$KFEditorConf.backup"
|
||||||
|
|
||||||
function show_help ()
|
function show_help ()
|
||||||
@ -83,7 +81,7 @@ EOF
|
|||||||
function show_version ()
|
function show_version ()
|
||||||
{
|
{
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
$ScriptName $(git describe)
|
$ScriptName $(git describe 2> /dev/null)
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +109,7 @@ function init_build ()
|
|||||||
|
|
||||||
:> "$MutBuildConfig"
|
:> "$MutBuildConfig"
|
||||||
|
|
||||||
while read Package
|
while read -r Package
|
||||||
do
|
do
|
||||||
if [[ -z "$PackageList" ]]; then
|
if [[ -z "$PackageList" ]]; then
|
||||||
PackageList="$Package"
|
PackageList="$Package"
|
||||||
@ -129,6 +127,7 @@ function read_build_settings ()
|
|||||||
if ! [[ -f "$MutBuildConfig" ]]; then init_build; fi
|
if ! [[ -f "$MutBuildConfig" ]]; then init_build; fi
|
||||||
|
|
||||||
if bash -n "$MutBuildConfig"; then
|
if bash -n "$MutBuildConfig"; then
|
||||||
|
# shellcheck source=./.shellcheck/build.ini
|
||||||
source "$MutBuildConfig"
|
source "$MutBuildConfig"
|
||||||
else
|
else
|
||||||
echo "$MutBuildConfig broken! Check this file before continue or create new one using $0 --init-build"
|
echo "$MutBuildConfig broken! Check this file before continue or create new one using $0 --init-build"
|
||||||
@ -141,6 +140,7 @@ function read_test_settings ()
|
|||||||
if ! [[ -f "$MutTestConfig" ]]; then init_test; fi
|
if ! [[ -f "$MutTestConfig" ]]; then init_test; fi
|
||||||
|
|
||||||
if bash -n "$MutTestConfig"; then
|
if bash -n "$MutTestConfig"; then
|
||||||
|
# shellcheck source=./.shellcheck/test.ini
|
||||||
source "$MutTestConfig"
|
source "$MutTestConfig"
|
||||||
else
|
else
|
||||||
echo "$MutTestConfig broken! Check this file before continue or create new one using $0 --init-test"
|
echo "$MutTestConfig broken! Check this file before continue or create new one using $0 --init-test"
|
||||||
@ -150,20 +150,22 @@ function read_test_settings ()
|
|||||||
|
|
||||||
function merge_packages () # $1: Mutator name
|
function merge_packages () # $1: Mutator name
|
||||||
{
|
{
|
||||||
|
local ModificationTime=""
|
||||||
local UpkList=""
|
local UpkList=""
|
||||||
|
local PID=""
|
||||||
|
|
||||||
cp -f "$KFUnpublishScript/$1.u" "$KFWin64"
|
cp -f "$KFUnpublishScript/$1.u" "$KFWin64"
|
||||||
|
|
||||||
while read Upk
|
while read -r Upk
|
||||||
do
|
do
|
||||||
cp -f "$MutSource/$1/$Upk" "$KFWin64"
|
cp -f "$MutSource/$1/$Upk" "$KFWin64"
|
||||||
UpkList="$UpkList $Upk"
|
UpkList="$UpkList $Upk"
|
||||||
done < <(find "$MutSource/$1" -type f -name '*.upk' -printf "%f\n")
|
done < <(find "$MutSource/$1" -type f -name '*.upk' -printf "%f\n")
|
||||||
|
|
||||||
if [[ -n "$UpkList" ]]; then
|
if [[ -n "$UpkList" ]]; then
|
||||||
local ModificationTime=$(stat -c %y "$KFWin64/$1.u")
|
ModificationTime=$(stat -c %y "$KFWin64/$1.u")
|
||||||
CMD //C "cd "$(cygpath -w "$KFWin64")" && $(basename "$KFEditorMergePackages") make $UpkList $1.u" &
|
CMD //C "cd \"$(cygpath -w "$KFWin64")\" && $(basename \""$KFEditorMergePackages"\") make $UpkList $1.u" &
|
||||||
local PID="$!"
|
PID="$!"
|
||||||
while ps -p "$PID" &> /dev/null
|
while ps -p "$PID" &> /dev/null
|
||||||
do
|
do
|
||||||
if [[ "$ModificationTime" != "$(stat -c %y "$KFWin64/$1.u")" ]]; then # file changed
|
if [[ "$ModificationTime" != "$(stat -c %y "$KFWin64/$1.u")" ]]; then # file changed
|
||||||
@ -189,6 +191,8 @@ function compiled ()
|
|||||||
|
|
||||||
function compile ()
|
function compile ()
|
||||||
{
|
{
|
||||||
|
local PID=""
|
||||||
|
|
||||||
read_build_settings
|
read_build_settings
|
||||||
|
|
||||||
if ! command -v multini &> /dev/null; then
|
if ! command -v multini &> /dev/null; then
|
||||||
@ -208,9 +212,10 @@ function compile ()
|
|||||||
|
|
||||||
mkdir -p "$KFUnpublishPackages" "$KFUnpublishScript"
|
mkdir -p "$KFUnpublishPackages" "$KFUnpublishScript"
|
||||||
|
|
||||||
pushd "$MutSource"
|
for Package in $PackageBuildOrder
|
||||||
find $PackageBuildOrder -type f -name '*.upk' -exec cp -f {} "$KFUnpublishPackages" \;
|
do
|
||||||
popd
|
find "$MutSource/$Package" -type f -name '*.upk' -exec cp -f {} "$KFUnpublishPackages" \;
|
||||||
|
done
|
||||||
|
|
||||||
if [[ -d "$MutLocalization" ]]; then
|
if [[ -d "$MutLocalization" ]]; then
|
||||||
mkdir -p "$KFUnpublishLocalization"
|
mkdir -p "$KFUnpublishLocalization"
|
||||||
@ -223,7 +228,7 @@ function compile ()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
CMD //C "$(cygpath -w "$KFEditor")" make -stripsource -useunpublished &
|
CMD //C "$(cygpath -w "$KFEditor")" make -stripsource -useunpublished &
|
||||||
local PID="$!"
|
PID="$!"
|
||||||
while ps -p "$PID" &> /dev/null
|
while ps -p "$PID" &> /dev/null
|
||||||
do
|
do
|
||||||
if compiled; then kill "$PID"; break; fi
|
if compiled; then kill "$PID"; break; fi
|
||||||
@ -258,6 +263,8 @@ function brewed ()
|
|||||||
|
|
||||||
function brew ()
|
function brew ()
|
||||||
{
|
{
|
||||||
|
local PID=""
|
||||||
|
|
||||||
read_build_settings
|
read_build_settings
|
||||||
|
|
||||||
if ! compiled ; then
|
if ! compiled ; then
|
||||||
@ -269,8 +276,8 @@ function brew ()
|
|||||||
|
|
||||||
mkdir -p "$KFPublishBrewedPC"
|
mkdir -p "$KFPublishBrewedPC"
|
||||||
|
|
||||||
CMD //C "cd "$(cygpath -w "$KFWin64")" && "$(basename "$KFEditor")" brewcontent -platform=PC $PackageUpload -useunpublished" &
|
CMD //C "cd \"$(cygpath -w "$KFWin64")\" && \"$(basename "$KFEditor")\" brewcontent -platform=PC $PackageUpload -useunpublished" &
|
||||||
local PID="$!"
|
PID="$!"
|
||||||
while ps -p "$PID" &> /dev/null
|
while ps -p "$PID" &> /dev/null
|
||||||
do
|
do
|
||||||
if brewed; then kill "$PID"; break; fi
|
if brewed; then kill "$PID"; break; fi
|
||||||
@ -312,6 +319,8 @@ function brew_manual ()
|
|||||||
|
|
||||||
function upload ()
|
function upload ()
|
||||||
{
|
{
|
||||||
|
local PreparedWsDir=""
|
||||||
|
|
||||||
read_build_settings
|
read_build_settings
|
||||||
|
|
||||||
if ! compiled ; then
|
if ! compiled ; then
|
||||||
@ -335,7 +344,7 @@ function upload ()
|
|||||||
publish_common
|
publish_common
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local PreparedWsDir=$(mktemp -d -u -p "$KFDoc")
|
PreparedWsDir=$(mktemp -d -u -p "$KFDoc")
|
||||||
|
|
||||||
cat > "$MutWsInfo" <<EOF
|
cat > "$MutWsInfo" <<EOF
|
||||||
\$Description \"$(cat "$MutPubContent/description.txt")\"
|
\$Description \"$(cat "$MutPubContent/description.txt")\"
|
||||||
@ -348,7 +357,7 @@ EOF
|
|||||||
|
|
||||||
cp -rf "$KFPublish"/* "$PreparedWsDir"
|
cp -rf "$KFPublish"/* "$PreparedWsDir"
|
||||||
|
|
||||||
CMD //C "$(cygpath -w "$KFWorkshop")" "$MutWsInfoName"
|
CMD //C "$(cygpath -w "$KFWorkshop")" "$(basename "$MutWsInfo")"
|
||||||
|
|
||||||
rm -rf "$PreparedWsDir"
|
rm -rf "$PreparedWsDir"
|
||||||
rm -f "$MutWsInfo"
|
rm -f "$MutWsInfo"
|
||||||
@ -362,7 +371,7 @@ function init_test ()
|
|||||||
for Package in $PackageUpload
|
for Package in $PackageUpload
|
||||||
do
|
do
|
||||||
# find available mutators
|
# find available mutators
|
||||||
while read MutClass
|
while read -r MutClass
|
||||||
do
|
do
|
||||||
if [[ -z "$AviableMutators" ]]; then
|
if [[ -z "$AviableMutators" ]]; then
|
||||||
AviableMutators="$Package.$MutClass"
|
AviableMutators="$Package.$MutClass"
|
||||||
@ -372,12 +381,12 @@ function init_test ()
|
|||||||
done < <(grep -rihPo '\s.+extends\s(KF)?Mutator' "$MutSource/$Package" | awk '{ print $1 }')
|
done < <(grep -rihPo '\s.+extends\s(KF)?Mutator' "$MutSource/$Package" | awk '{ print $1 }')
|
||||||
|
|
||||||
# find available gamemodes
|
# find available gamemodes
|
||||||
while read GamemodeClass
|
while read -r GamemodeClass
|
||||||
do
|
do
|
||||||
if [[ -z "$AviableGamemodes" ]]; then
|
if [[ -z "$AviableGamemodes" ]]; then
|
||||||
AviableGamemodes="$Package.$MutClass"
|
AviableGamemodes="$Package.$GamemodeClass"
|
||||||
else
|
else
|
||||||
AviableGamemodes="$AviableGamemodes,$Package.$MutClass"
|
AviableGamemodes="$AviableGamemodes,$Package.$GamemodeClass"
|
||||||
fi
|
fi
|
||||||
done < <(grep -rihPo '\s.+extends\sKFGameInfo_' "$MutSource/$Package" | awk '{ print $1 }')
|
done < <(grep -rihPo '\s.+extends\sKFGameInfo_' "$MutSource/$Package" | awk '{ print $1 }')
|
||||||
done
|
done
|
||||||
@ -430,7 +439,7 @@ function run_test ()
|
|||||||
|
|
||||||
if ! brewed; then UseUnpublished="-useunpublished"; fi
|
if ! brewed; then UseUnpublished="-useunpublished"; fi
|
||||||
|
|
||||||
CMD //C "$(cygpath -w "$KFGame")" $Map?Difficulty=$Difficulty?GameLength=$GameLength?Game=$Game?Mutator=$Mutators?$Args $UseUnpublished -log
|
CMD //C "$(cygpath -w "$KFGame")" "$Map?Difficulty=$Difficulty?GameLength=$GameLength?Game=$Game?Mutator=$Mutators?$Args" "$UseUnpublished" -log
|
||||||
}
|
}
|
||||||
|
|
||||||
export PATH="$PATH:$ThirdPartyBin"
|
export PATH="$PATH:$ThirdPartyBin"
|
||||||
|
Loading…
Reference in New Issue
Block a user