init_project

This commit is contained in:
2026-09-06 01:25:18 +03:00
commit a816b838d9
7 changed files with 281 additions and 0 deletions
Executable
+44
View File
@@ -0,0 +1,44 @@
#!/bin/sh
set -eu
SAVE_FILE="/factorio/saves/world.zip"
SETTINGS_FILE="/factorio/config/server-settings.json"
mkdir -p \
/factorio/saves \
/factorio/config
if [ ! -f "$SETTINGS_FILE" ]; then
cat > "$SETTINGS_FILE" <<'EOF'
{
"name": "Factorio Server",
"description": "Automatically generated Factorio world",
"max_players": 10,
"visibility": {
"public": false,
"lan": true
},
"game_password": "",
"allow_commands": "admins-only",
"autosave_interval": 10,
"autosave_slots": 3,
"auto_pause": true
}
EOF
fi
if [ ! -f "$SAVE_FILE" ]; then
echo "Save file not found. Creating a new Factorio world..."
/opt/factorio/bin/x64/factorio \
--create "$SAVE_FILE"
echo "New world created: $SAVE_FILE"
else
echo "Using existing world: $SAVE_FILE"
fi
exec /opt/factorio/bin/x64/factorio "$@"