Upload files to "bin"
This commit is contained in:
63
bin/install-bl
Normal file
63
bin/install-bl
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd /home/container
|
||||||
|
|
||||||
|
echo "Installing Blockland..."
|
||||||
|
|
||||||
|
curl -fsSL -A "blocklandWIN/2.0" \
|
||||||
|
-o /tmp/latest-manifest.dat \
|
||||||
|
http://update.blockland.us/latestVersion.php
|
||||||
|
|
||||||
|
download_url=$(head -n 1 /tmp/latest-manifest.dat | cut -f 2)
|
||||||
|
|
||||||
|
tail -n +2 /tmp/latest-manifest.dat | tr '\r\n\t' '\0' | \
|
||||||
|
xargs -0 -n 2 -P "${BL_INST_NUM_PROC:-4}" sh -c '
|
||||||
|
file="./$2"
|
||||||
|
curl -fsSL -A "blocklandWIN/2.0" --create-dirs -o "$file" "$1/$3"
|
||||||
|
' _ "$download_url"
|
||||||
|
|
||||||
|
if [[ "${BL_PATCH_ENABLE:-0}" -eq 1 ]]; then
|
||||||
|
/usr/local/bin/patch-bl
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${BL_UNZIP_ADDONS:-0}" -eq 1 ]; then
|
||||||
|
echo "Processing Add-Ons zips..."
|
||||||
|
|
||||||
|
cd "$HOME/Add-Ons" || exit 1
|
||||||
|
|
||||||
|
for zip in *.zip; do
|
||||||
|
[ -f "$zip" ] || continue
|
||||||
|
|
||||||
|
addon_name="${zip%.zip}"
|
||||||
|
|
||||||
|
echo "Extracting $zip..."
|
||||||
|
|
||||||
|
# Extract into a temp directory first
|
||||||
|
mkdir -p "__tmp_extract__"
|
||||||
|
unzip -o "$zip" -d "__tmp_extract__" >/dev/null
|
||||||
|
|
||||||
|
# Count top-level items in extraction
|
||||||
|
item_count=$(find "__tmp_extract__" -mindepth 1 -maxdepth 1 | wc -l)
|
||||||
|
|
||||||
|
if [ "$item_count" -eq 1 ]; then
|
||||||
|
first_item=$(find "__tmp_extract__" -mindepth 1 -maxdepth 1)
|
||||||
|
|
||||||
|
if [ -d "$first_item" ]; then
|
||||||
|
# Proper folder structure, just move it
|
||||||
|
mv "$first_item" .
|
||||||
|
else
|
||||||
|
# Single loose file — fix structure
|
||||||
|
mkdir -p "$addon_name"
|
||||||
|
mv "$first_item" "$addon_name"/
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Multiple loose files — put them in folder
|
||||||
|
mkdir -p "$addon_name"
|
||||||
|
mv "__tmp_extract__"/* "$addon_name"/
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf "__tmp_extract__"
|
||||||
|
rm -f "$zip"
|
||||||
|
done
|
||||||
|
fi
|
||||||
22
bin/patch-bl
Normal file
22
bin/patch-bl
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd /home/container
|
||||||
|
|
||||||
|
echo "Patching Blockland..."
|
||||||
|
|
||||||
|
if [ -n "$BL_PATCH_EXE_URL" ]; then
|
||||||
|
curl -fsSLJ --clobber -o Blockland.exe "$BL_PATCH_EXE_URL"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$BL_PATCH_LOADER_URL" ]; then
|
||||||
|
curl -fsSLJ --clobber -o RedBlocklandLoader.dll "$BL_PATCH_LOADER_URL"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$BL_PATCH_WINEFIX_URL" ]; then
|
||||||
|
mkdir -p ./modules
|
||||||
|
curl -fsSLJ --clobber \
|
||||||
|
--output-dir ./modules/ \
|
||||||
|
-o WineFix.dll \
|
||||||
|
"$BL_PATCH_WINEFIX_URL"
|
||||||
|
fi
|
||||||
93
bin/run-bl
Normal file
93
bin/run-bl
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd /home/container || {
|
||||||
|
echo "ERROR: /home/container does not exist"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install if needed
|
||||||
|
if [[ "$BL_INST_FORCE" == "1" ]] || [ ! -f "Blockland.exe" ]; then
|
||||||
|
source /usr/local/bin/install-bl
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Required vars
|
||||||
|
[ -z "$BL_PORT" ] && echo "Missing BL_PORT" && exit 1
|
||||||
|
[ -z "$BL_GAMEMODE" ] && echo "Missing BL_GAMEMODE" && exit 1
|
||||||
|
[ -z "$BL_SERVER_NAME" ] && echo "Missing BL_SERVER_NAME" && exit 1
|
||||||
|
|
||||||
|
if [[ "$BL_DEDI_LAN" == "1" ]]; then
|
||||||
|
dedi="dedicatedLAN"
|
||||||
|
else
|
||||||
|
[ -z "$BL_DTOKEN" ] && echo "Missing BL_DTOKEN" && exit 1
|
||||||
|
dedi="dedicated"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create wine prefix if missing
|
||||||
|
if [ ! -d "$HOME/.wine" ]; then
|
||||||
|
echo "Creating wine prefix..."
|
||||||
|
wineboot -i
|
||||||
|
sleep 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${BL_UNZIP_ADDONS:-0}" -eq 1 ]; then
|
||||||
|
echo "Processing Add-Ons zips..."
|
||||||
|
|
||||||
|
cd "$HOME/Add-Ons" || exit 1
|
||||||
|
|
||||||
|
for zip in *.zip; do
|
||||||
|
[ -f "$zip" ] || continue
|
||||||
|
|
||||||
|
addon_name="${zip%.zip}"
|
||||||
|
|
||||||
|
echo "Extracting $zip..."
|
||||||
|
|
||||||
|
# Extract into a temp directory first
|
||||||
|
mkdir -p "__tmp_extract__"
|
||||||
|
unzip -o "$zip" -d "__tmp_extract__" >/dev/null
|
||||||
|
|
||||||
|
# Count top-level items in extraction
|
||||||
|
item_count=$(find "__tmp_extract__" -mindepth 1 -maxdepth 1 | wc -l)
|
||||||
|
|
||||||
|
if [ "$item_count" -eq 1 ]; then
|
||||||
|
first_item=$(find "__tmp_extract__" -mindepth 1 -maxdepth 1)
|
||||||
|
|
||||||
|
if [ -d "$first_item" ]; then
|
||||||
|
# Proper folder structure, just move it
|
||||||
|
mv "$first_item" .
|
||||||
|
else
|
||||||
|
# Single loose file — fix structure
|
||||||
|
mkdir -p "$addon_name"
|
||||||
|
mv "$first_item" "$addon_name"/
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Multiple loose files — put them in folder
|
||||||
|
mkdir -p "$addon_name"
|
||||||
|
mv "__tmp_extract__"/* "$addon_name"/
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf "__tmp_extract__"
|
||||||
|
rm -f "$zip"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure we're in the correct directory
|
||||||
|
cd "$HOME" || exit 1
|
||||||
|
|
||||||
|
if [ ! -f "Blockland.exe" ]; then
|
||||||
|
echo "Blockland.exe not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Launching Blockland..."
|
||||||
|
|
||||||
|
exec xvfb-run -a wine "Blockland.exe" \
|
||||||
|
ptlaaxobimwroe \
|
||||||
|
-${dedi} \
|
||||||
|
-port "$BL_PORT" \
|
||||||
|
-dtoken "$BL_DTOKEN" \
|
||||||
|
-gamemode "$BL_GAMEMODE" \
|
||||||
|
-serverName "$BL_SERVER_NAME" \
|
||||||
|
-maxPlayers "$BL_MAX_PLAYERS" \
|
||||||
|
$BL_EXTRA_ARGS
|
||||||
Reference in New Issue
Block a user