Ensure required variables are defined before running scripts.
This commit is contained in:
parent
76585aab79
commit
9078ff73c7
19
Makefile
19
Makefile
@ -34,7 +34,20 @@ HAS_LUAC = $(shell command -v luac 2> /dev/null)
|
|||||||
LUA_FILES = $(shell find mods/*/maps/* -iname '*.lua')
|
LUA_FILES = $(shell find mods/*/maps/* -iname '*.lua')
|
||||||
PROJECT_DIRS = $(shell dirname $$(find . -iname "*.csproj" -not -path "$(ENGINE_DIRECTORY)/*"))
|
PROJECT_DIRS = $(shell dirname $$(find . -iname "*.csproj" -not -path "$(ENGINE_DIRECTORY)/*"))
|
||||||
|
|
||||||
engine:
|
variables:
|
||||||
|
@if [ -z "$(MOD_ID)" ] || [ -z "$(ENGINE_DIRECTORY)" ];then \
|
||||||
|
echo "Required mod.config variables are missing:"; \
|
||||||
|
if [ -z "$(MOD_ID)" ]; then \
|
||||||
|
echo " MOD_ID"; \
|
||||||
|
fi; \
|
||||||
|
if [ -z "$(ENGINE_DIRECTORY)" ]; then \
|
||||||
|
echo " ENGINE_DIRECTORY"; \
|
||||||
|
fi; \
|
||||||
|
echo "Repair your mod.config (or user.config) and try again."; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
engine: variables
|
||||||
@./fetch-engine.sh || (printf "Unable to continue without engine files\n"; exit 1)
|
@./fetch-engine.sh || (printf "Unable to continue without engine files\n"; exit 1)
|
||||||
@cd $(ENGINE_DIRECTORY) && make core
|
@cd $(ENGINE_DIRECTORY) && make core
|
||||||
|
|
||||||
@ -60,13 +73,13 @@ endif
|
|||||||
@cd $(ENGINE_DIRECTORY) && make clean
|
@cd $(ENGINE_DIRECTORY) && make clean
|
||||||
@printf "The engine has been cleaned.\n"
|
@printf "The engine has been cleaned.\n"
|
||||||
|
|
||||||
version:
|
version: variables
|
||||||
@awk '{sub("Version:.*$$","Version: $(VERSION)"); print $0}' $(MANIFEST_PATH) > $(MANIFEST_PATH).tmp && \
|
@awk '{sub("Version:.*$$","Version: $(VERSION)"); print $0}' $(MANIFEST_PATH) > $(MANIFEST_PATH).tmp && \
|
||||||
awk '{sub("/[^/]*: User$$", "/$(VERSION): User"); print $0}' $(MANIFEST_PATH).tmp > $(MANIFEST_PATH) && \
|
awk '{sub("/[^/]*: User$$", "/$(VERSION): User"); print $0}' $(MANIFEST_PATH).tmp > $(MANIFEST_PATH) && \
|
||||||
rm $(MANIFEST_PATH).tmp
|
rm $(MANIFEST_PATH).tmp
|
||||||
@printf "Version changed to $(VERSION).\n"
|
@printf "Version changed to $(VERSION).\n"
|
||||||
|
|
||||||
check-scripts:
|
check-scripts: variables
|
||||||
ifeq ("$(HAS_LUAC)","")
|
ifeq ("$(HAS_LUAC)","")
|
||||||
@printf "'luac' not found.\n" && exit 1
|
@printf "'luac' not found.\n" && exit 1
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -5,6 +5,18 @@
|
|||||||
command -v curl >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires curl."; exit 1; }
|
command -v curl >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires curl."; exit 1; }
|
||||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||||
|
|
||||||
|
require_variables() {
|
||||||
|
missing=""
|
||||||
|
for i in "$@"; do
|
||||||
|
eval check="\$$i"
|
||||||
|
[ -z "${check}" ] && missing="${missing} ${i}\n"
|
||||||
|
done
|
||||||
|
if [ ! -z "${missing}" ]; then
|
||||||
|
echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
TEMPLATE_LAUNCHER=$(python -c "import os; print(os.path.realpath('$0'))")
|
TEMPLATE_LAUNCHER=$(python -c "import os; print(os.path.realpath('$0'))")
|
||||||
TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}")
|
TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}")
|
||||||
|
|
||||||
@ -16,6 +28,8 @@ if [ -f "${TEMPLATE_ROOT}/user.config" ]; then
|
|||||||
. "${TEMPLATE_ROOT}/user.config"
|
. "${TEMPLATE_ROOT}/user.config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
require_variables "MOD_ID" "ENGINE_VERSION" "ENGINE_DIRECTORY"
|
||||||
|
|
||||||
CURRENT_ENGINE_VERSION=$(cat "${ENGINE_DIRECTORY}/VERSION" 2> /dev/null)
|
CURRENT_ENGINE_VERSION=$(cat "${ENGINE_DIRECTORY}/VERSION" 2> /dev/null)
|
||||||
|
|
||||||
if [ -f "${ENGINE_DIRECTORY}/VERSION" ] && [ "${CURRENT_ENGINE_VERSION}" = "${ENGINE_VERSION}" ]; then
|
if [ -f "${ENGINE_DIRECTORY}/VERSION" ] && [ "${CURRENT_ENGINE_VERSION}" = "${ENGINE_VERSION}" ]; then
|
||||||
@ -23,6 +37,8 @@ if [ -f "${ENGINE_DIRECTORY}/VERSION" ] && [ "${CURRENT_ENGINE_VERSION}" = "${EN
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${AUTOMATIC_ENGINE_MANAGEMENT}" = "True" ]; then
|
if [ "${AUTOMATIC_ENGINE_MANAGEMENT}" = "True" ]; then
|
||||||
|
require_variables "AUTOMATIC_ENGINE_SOURCE" "AUTOMATIC_ENGINE_EXTRACT_DIRECTORY" "AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME"
|
||||||
|
|
||||||
echo "OpenRA engine version ${ENGINE_VERSION} is required."
|
echo "OpenRA engine version ${ENGINE_VERSION} is required."
|
||||||
|
|
||||||
if [ -d "${ENGINE_DIRECTORY}" ]; then
|
if [ -d "${ENGINE_DIRECTORY}" ]; then
|
||||||
|
|||||||
@ -10,12 +10,17 @@ set EnableSingleplayer=False
|
|||||||
set Password=""
|
set Password=""
|
||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
|
|
||||||
title %Name%
|
title %Name%
|
||||||
FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B)
|
FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B)
|
||||||
if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B))
|
if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B))
|
||||||
set MOD_SEARCH_PATHS=%~dp0mods,./mods
|
set MOD_SEARCH_PATHS=%~dp0mods,./mods
|
||||||
|
|
||||||
|
if "!MOD_ID!" == "" goto badconfig
|
||||||
|
if "!ENGINE_VERSION!" == "" goto badconfig
|
||||||
|
if "!ENGINE_DIRECTORY!" == "" goto badconfig
|
||||||
|
|
||||||
if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine
|
if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine
|
||||||
>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine
|
>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine
|
||||||
cd %ENGINE_DIRECTORY%
|
cd %ENGINE_DIRECTORY%
|
||||||
@ -29,3 +34,10 @@ echo Required engine files not found.
|
|||||||
echo Run `make all` in the mod directory to fetch and build the required files, then try again.
|
echo Run `make all` in the mod directory to fetch and build the required files, then try again.
|
||||||
pause
|
pause
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
|
:badconfig
|
||||||
|
echo Required mod.config variables are missing.
|
||||||
|
echo Ensure that MOD_ID ENGINE_VERSION and ENGINE_DIRECTORY are
|
||||||
|
echo defined in your mod.config (or user.config) and try again.
|
||||||
|
pause
|
||||||
|
exit /b
|
||||||
@ -8,6 +8,18 @@ set -e
|
|||||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||||
command -v mono >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires mono."; exit 1; }
|
command -v mono >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires mono."; exit 1; }
|
||||||
|
|
||||||
|
require_variables() {
|
||||||
|
missing=""
|
||||||
|
for i in "$@"; do
|
||||||
|
eval check="\$$i"
|
||||||
|
[ -z "${check}" ] && missing="${missing} ${i}\n"
|
||||||
|
done
|
||||||
|
if [ ! -z "${missing}" ]; then
|
||||||
|
echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
TEMPLATE_LAUNCHER=$(python -c "import os; print(os.path.realpath('$0'))")
|
TEMPLATE_LAUNCHER=$(python -c "import os; print(os.path.realpath('$0'))")
|
||||||
TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}")
|
TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}")
|
||||||
MOD_SEARCH_PATHS="${TEMPLATE_ROOT}/mods,./mods"
|
MOD_SEARCH_PATHS="${TEMPLATE_ROOT}/mods,./mods"
|
||||||
@ -20,6 +32,8 @@ if [ -f "${TEMPLATE_ROOT}/user.config" ]; then
|
|||||||
. "${TEMPLATE_ROOT}/user.config"
|
. "${TEMPLATE_ROOT}/user.config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
require_variables "MOD_ID" "ENGINE_VERSION" "ENGINE_DIRECTORY"
|
||||||
|
|
||||||
NAME="${Name:-"Dedicated Server"}"
|
NAME="${Name:-"Dedicated Server"}"
|
||||||
LAUNCH_MOD="${Mod:-"${MOD_ID}"}"
|
LAUNCH_MOD="${Mod:-"${MOD_ID}"}"
|
||||||
LISTEN_PORT="${ListenPort:-"1234"}"
|
LISTEN_PORT="${ListenPort:-"1234"}"
|
||||||
|
|||||||
@ -1,10 +1,16 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
title OpenRA
|
title OpenRA
|
||||||
|
|
||||||
FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B)
|
FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B)
|
||||||
if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B))
|
if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B))
|
||||||
set TEMPLATE_LAUNCHER=%0
|
set TEMPLATE_LAUNCHER=%0
|
||||||
set MOD_SEARCH_PATHS=%~dp0mods,./mods
|
set MOD_SEARCH_PATHS=%~dp0mods,./mods
|
||||||
|
|
||||||
|
if "!MOD_ID!" == "" goto badconfig
|
||||||
|
if "!ENGINE_VERSION!" == "" goto badconfig
|
||||||
|
if "!ENGINE_DIRECTORY!" == "" goto badconfig
|
||||||
|
|
||||||
set TEMPLATE_DIR=%CD%
|
set TEMPLATE_DIR=%CD%
|
||||||
if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine
|
if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine
|
||||||
>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine
|
>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine
|
||||||
@ -23,6 +29,13 @@ echo Run `make all` in the mod directory to fetch and build the required files,
|
|||||||
pause
|
pause
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
|
:badconfig
|
||||||
|
echo Required mod.config variables are missing.
|
||||||
|
echo Ensure that MOD_ID ENGINE_VERSION and ENGINE_DIRECTORY are
|
||||||
|
echo defined in your mod.config (or user.config) and try again.
|
||||||
|
pause
|
||||||
|
exit /b
|
||||||
|
|
||||||
:crashdialog
|
:crashdialog
|
||||||
echo ----------------------------------------
|
echo ----------------------------------------
|
||||||
echo OpenRA has encountered a fatal error.
|
echo OpenRA has encountered a fatal error.
|
||||||
|
|||||||
@ -4,6 +4,18 @@ set -e
|
|||||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||||
command -v mono >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires mono."; exit 1; }
|
command -v mono >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires mono."; exit 1; }
|
||||||
|
|
||||||
|
require_variables() {
|
||||||
|
missing=""
|
||||||
|
for i in "$@"; do
|
||||||
|
eval check="\$$i"
|
||||||
|
[ -z "${check}" ] && missing="${missing} ${i}\n"
|
||||||
|
done
|
||||||
|
if [ ! -z "${missing}" ]; then
|
||||||
|
echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
TEMPLATE_LAUNCHER=$(python -c "import os; print(os.path.realpath('$0'))")
|
TEMPLATE_LAUNCHER=$(python -c "import os; print(os.path.realpath('$0'))")
|
||||||
TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}")
|
TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}")
|
||||||
MOD_SEARCH_PATHS="${TEMPLATE_ROOT}/mods,./mods"
|
MOD_SEARCH_PATHS="${TEMPLATE_ROOT}/mods,./mods"
|
||||||
@ -16,6 +28,8 @@ if [ -f "${TEMPLATE_ROOT}/user.config" ]; then
|
|||||||
. "${TEMPLATE_ROOT}/user.config"
|
. "${TEMPLATE_ROOT}/user.config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
require_variables "MOD_ID" "ENGINE_VERSION" "ENGINE_DIRECTORY"
|
||||||
|
|
||||||
cd "${TEMPLATE_ROOT}"
|
cd "${TEMPLATE_ROOT}"
|
||||||
if [ ! -f "${ENGINE_DIRECTORY}/OpenRA.Game.exe" ] || [ "$(cat "${ENGINE_DIRECTORY}/VERSION")" != "${ENGINE_VERSION}" ]; then
|
if [ ! -f "${ENGINE_DIRECTORY}/OpenRA.Game.exe" ] || [ "$(cat "${ENGINE_DIRECTORY}/VERSION")" != "${ENGINE_VERSION}" ]; then
|
||||||
echo "Required engine files not found."
|
echo "Required engine files not found."
|
||||||
|
|||||||
21
make.ps1
21
make.ps1
@ -228,6 +228,27 @@ function ParseConfigFile($fileName)
|
|||||||
ReadConfigLine $line $name
|
ReadConfigLine $line $name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$missing = @()
|
||||||
|
foreach ($name in $names)
|
||||||
|
{
|
||||||
|
if (!([System.Environment]::GetEnvironmentVariable($name)))
|
||||||
|
{
|
||||||
|
$missing += $name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($missing)
|
||||||
|
{
|
||||||
|
echo "Required mod.config variables are missing:"
|
||||||
|
foreach ($m in $missing)
|
||||||
|
{
|
||||||
|
echo " $m"
|
||||||
|
}
|
||||||
|
echo "Repair your mod.config (or user.config) and try again."
|
||||||
|
WaitForInput
|
||||||
|
exit
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################
|
###############################################################
|
||||||
|
|||||||
@ -7,6 +7,18 @@ command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template require
|
|||||||
command -v tar >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires tar."; exit 1; }
|
command -v tar >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires tar."; exit 1; }
|
||||||
command -v curl >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires curl."; exit 1; }
|
command -v curl >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires curl."; exit 1; }
|
||||||
|
|
||||||
|
require_variables() {
|
||||||
|
missing=""
|
||||||
|
for i in "$@"; do
|
||||||
|
eval check="\$$i"
|
||||||
|
[ -z "${check}" ] && missing="${missing} ${i}\n"
|
||||||
|
done
|
||||||
|
if [ ! -z "${missing}" ]; then
|
||||||
|
echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [ $# -eq "0" ]; then
|
if [ $# -eq "0" ]; then
|
||||||
echo "Usage: `basename $0` version [outputdir]"
|
echo "Usage: `basename $0` version [outputdir]"
|
||||||
exit 1
|
exit 1
|
||||||
@ -23,6 +35,10 @@ if [ -f "${TEMPLATE_ROOT}/user.config" ]; then
|
|||||||
. "${TEMPLATE_ROOT}/user.config"
|
. "${TEMPLATE_ROOT}/user.config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
require_variables "MOD_ID" "ENGINE_DIRECTORY" "PACKAGING_DISPLAY_NAME" "PACKAGING_INSTALLER_NAME" \
|
||||||
|
"PACKAGING_APPIMAGE_DEPENDENCIES_TAG" "PACKAGING_APPIMAGE_DEPENDENCIES_SOURCE" "PACKAGING_APPIMAGE_DEPENDENCIES_TEMP_ARCHIVE_NAME" \
|
||||||
|
"PACKAGING_FAQ_URL"
|
||||||
|
|
||||||
TAG="$1"
|
TAG="$1"
|
||||||
if [ $# -eq "1" ]; then
|
if [ $# -eq "1" ]; then
|
||||||
OUTPUTDIR=$(python -c "import os; print(os.path.realpath('.'))")
|
OUTPUTDIR=$(python -c "import os; print(os.path.realpath('.'))")
|
||||||
|
|||||||
@ -6,6 +6,18 @@ command -v make >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires
|
|||||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||||
command -v curl >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires curl."; exit 1; }
|
command -v curl >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires curl."; exit 1; }
|
||||||
|
|
||||||
|
require_variables() {
|
||||||
|
missing=""
|
||||||
|
for i in "$@"; do
|
||||||
|
eval check="\$$i"
|
||||||
|
[ -z "${check}" ] && missing="${missing} ${i}\n"
|
||||||
|
done
|
||||||
|
if [ ! -z "${missing}" ]; then
|
||||||
|
echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [ $# -eq "0" ]; then
|
if [ $# -eq "0" ]; then
|
||||||
echo "Usage: `basename $0` version [outputdir]"
|
echo "Usage: `basename $0` version [outputdir]"
|
||||||
exit 1
|
exit 1
|
||||||
@ -22,6 +34,10 @@ if [ -f "${TEMPLATE_ROOT}/user.config" ]; then
|
|||||||
. "${TEMPLATE_ROOT}/user.config"
|
. "${TEMPLATE_ROOT}/user.config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
require_variables "MOD_ID" "ENGINE_DIRECTORY" "PACKAGING_DISPLAY_NAME" "PACKAGING_INSTALLER_NAME" \
|
||||||
|
"PACKAGING_OSX_LAUNCHER_TAG" "PACKAGING_OSX_LAUNCHER_SOURCE" "PACKAGING_OSX_LAUNCHER_TEMP_ARCHIVE_NAME" \
|
||||||
|
"PACKAGING_FAQ_URL"
|
||||||
|
|
||||||
TAG="$1"
|
TAG="$1"
|
||||||
if [ $# -eq "1" ]; then
|
if [ $# -eq "1" ]; then
|
||||||
OUTPUTDIR=$(python -c "import os; print(os.path.realpath('.'))")
|
OUTPUTDIR=$(python -c "import os; print(os.path.realpath('.'))")
|
||||||
|
|||||||
@ -4,6 +4,18 @@ set -e
|
|||||||
command -v curl >/dev/null 2>&1 || { echo >&2 "Windows packaging requires curl."; exit 1; }
|
command -v curl >/dev/null 2>&1 || { echo >&2 "Windows packaging requires curl."; exit 1; }
|
||||||
command -v makensis >/dev/null 2>&1 || { echo >&2 "Windows packaging requires makensis."; exit 1; }
|
command -v makensis >/dev/null 2>&1 || { echo >&2 "Windows packaging requires makensis."; exit 1; }
|
||||||
|
|
||||||
|
require_variables() {
|
||||||
|
missing=""
|
||||||
|
for i in "$@"; do
|
||||||
|
eval check="\$$i"
|
||||||
|
[ -z "${check}" ] && missing="${missing} ${i}\n"
|
||||||
|
done
|
||||||
|
if [ ! -z "${missing}" ]; then
|
||||||
|
echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [ $# -eq "0" ]; then
|
if [ $# -eq "0" ]; then
|
||||||
echo "Usage: `basename $0` version [outputdir]"
|
echo "Usage: `basename $0` version [outputdir]"
|
||||||
exit 1
|
exit 1
|
||||||
@ -20,6 +32,10 @@ if [ -f "${TEMPLATE_ROOT}/user.config" ]; then
|
|||||||
. "${TEMPLATE_ROOT}/user.config"
|
. "${TEMPLATE_ROOT}/user.config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
require_variables "MOD_ID" "ENGINE_DIRECTORY" "PACKAGING_DISPLAY_NAME" "PACKAGING_INSTALLER_NAME" \
|
||||||
|
"PACKAGING_WINDOWS_LAUNCHER_NAME" "PACKAGING_WINDOWS_REGISTRY_KEY" "PACKAGING_WINDOWS_INSTALL_DIR_NAME" \
|
||||||
|
"PACKAGING_FAQ_URL" "PACKAGING_WEBSITE_URL" "PACKAGING_AUTHORS"
|
||||||
|
|
||||||
TAG="$1"
|
TAG="$1"
|
||||||
if [ $# -eq "1" ]; then
|
if [ $# -eq "1" ]; then
|
||||||
OUTPUTDIR=$(python -c "import os; print(os.path.realpath('.'))")
|
OUTPUTDIR=$(python -c "import os; print(os.path.realpath('.'))")
|
||||||
|
|||||||
12
utility.cmd
12
utility.cmd
@ -1,9 +1,14 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
|
|
||||||
FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B)
|
FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B)
|
||||||
if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B))
|
if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B))
|
||||||
set MOD_SEARCH_PATHS=%~dp0mods,./mods
|
set MOD_SEARCH_PATHS=%~dp0mods,./mods
|
||||||
|
|
||||||
|
if "!MOD_ID!" == "" goto badconfig
|
||||||
|
if "!ENGINE_VERSION!" == "" goto badconfig
|
||||||
|
if "!ENGINE_DIRECTORY!" == "" goto badconfig
|
||||||
|
|
||||||
title OpenRA.Utility.exe %MOD_ID%
|
title OpenRA.Utility.exe %MOD_ID%
|
||||||
|
|
||||||
set TEMPLATE_DIR=%CD%
|
set TEMPLATE_DIR=%CD%
|
||||||
@ -33,3 +38,10 @@ echo Required engine files not found.
|
|||||||
echo Run `make all` in the mod directory to fetch and build the required files, then try again.
|
echo Run `make all` in the mod directory to fetch and build the required files, then try again.
|
||||||
pause
|
pause
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
|
:badconfig
|
||||||
|
echo Required mod.config variables are missing.
|
||||||
|
echo Ensure that MOD_ID ENGINE_VERSION and ENGINE_DIRECTORY are
|
||||||
|
echo defined in your mod.config (or user.config) and try again.
|
||||||
|
pause
|
||||||
|
exit /b
|
||||||
14
utility.sh
14
utility.sh
@ -8,6 +8,18 @@ command -v make >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires
|
|||||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||||
command -v mono >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires mono."; exit 1; }
|
command -v mono >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires mono."; exit 1; }
|
||||||
|
|
||||||
|
require_variables() {
|
||||||
|
missing=""
|
||||||
|
for i in "$@"; do
|
||||||
|
eval check="\$$i"
|
||||||
|
[ -z "${check}" ] && missing="${missing} ${i}\n"
|
||||||
|
done
|
||||||
|
if [ ! -z "${missing}" ]; then
|
||||||
|
echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
TEMPLATE_LAUNCHER=$(python -c "import os; print(os.path.realpath('$0'))")
|
TEMPLATE_LAUNCHER=$(python -c "import os; print(os.path.realpath('$0'))")
|
||||||
TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}")
|
TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}")
|
||||||
MOD_SEARCH_PATHS="${TEMPLATE_ROOT}/mods,./mods"
|
MOD_SEARCH_PATHS="${TEMPLATE_ROOT}/mods,./mods"
|
||||||
@ -20,6 +32,8 @@ if [ -f "${TEMPLATE_ROOT}/user.config" ]; then
|
|||||||
. "${TEMPLATE_ROOT}/user.config"
|
. "${TEMPLATE_ROOT}/user.config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
require_variables "MOD_ID" "ENGINE_VERSION" "ENGINE_DIRECTORY"
|
||||||
|
|
||||||
LAUNCH_MOD="${Mod:-"${MOD_ID}"}"
|
LAUNCH_MOD="${Mod:-"${MOD_ID}"}"
|
||||||
|
|
||||||
cd "${TEMPLATE_ROOT}"
|
cd "${TEMPLATE_ROOT}"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user