From 03876f202ed097427bd9ae1503b26bba3f1cddd0 Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Tue, 12 Nov 2024 17:54:01 +0100 Subject: [PATCH] Fix xbassets file. Add config for mod sync --- Dockerfile | 7 ++++-- copy-mods.sh | 5 +++++ docker-compose.yml | 54 +++++++++++++++++++++++++--------------------- install.sh | 39 ++++++++++++++++++++++----------- start.sh | 8 +------ 5 files changed, 68 insertions(+), 45 deletions(-) create mode 100644 copy-mods.sh diff --git a/Dockerfile b/Dockerfile index 1b49bb3..527c728 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,8 @@ RUN apt-get install -y \ curl \ wget \ build-essential \ - jq + jq \ + rsync RUN mkdir -p /steamcmd RUN mkdir -p /starbound @@ -40,8 +41,10 @@ RUN /steamcmd/steamcmd.sh +force_install_dir /starbound/ +quit COPY start.sh /start.sh COPY install.sh /install.sh +COPY copy-mods.sh /copy-mods.sh RUN chmod +x install.sh && \ - chmod +x start.sh + chmod +x start.sh && \ + chmod +x copy-mods.sh ENTRYPOINT ["./start.sh"] \ No newline at end of file diff --git a/copy-mods.sh b/copy-mods.sh new file mode 100644 index 0000000..7b2c7d4 --- /dev/null +++ b/copy-mods.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "Copying mods from /starbound/steamapps/workshop/content/211820/ to /starbound/mods/" +rsync -a --info=progress2 /starbound/steamapps/workshop/content/211820/ /starbound/mods/ +echo "Finished" \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 7704fba..d1ac6e5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,35 +1,41 @@ +x-common-base-config: &common-base-config + build: . + environment: + - TZ=Europe/London + volumes: + - steam-data:/root/Steam + - type: bind + source: D:/temp/starbound + target: /starbound + bind: + create_host_path: true + network_mode: bridge + +x-common-config: &common-config + <<: *common-base-config + #environment: + # - STEAM_USER=your_username_here + # - STEAM_PASS=your_password_here + services: install: - build: . - environment: - - TZ=Europe/London - volumes: - - steam-data:/root/Steam - - type: bind - source: D:/temp/starbound - target: /starbound - bind: - create_host_path: true + <<: *common-config tty: true stdin_open: true entrypoint: ./install.sh - network_mode: bridge + install-skip-verify: + <<: *common-config + tty: true + stdin_open: true + entrypoint: ./install.sh --skip-verify + install-workshop-mods: + <<: *common-base-config + entrypoint: ./copy-mods.sh server: - build: . - environment: - - TZ=Europe/London - volumes: - - steam-data:/root/Steam - - type: bind - source: D:/temp/starbound - target: /starbound - bind: - create_host_path: true + <<: *common-base-config ports: - - '28015:28015/udp' - - '28016:28016/udp' + - '21025:21025/tcp' restart: unless-stopped - network_mode: bridge volumes: steam-data: \ No newline at end of file diff --git a/install.sh b/install.sh index 91c36cc..5b9d702 100644 --- a/install.sh +++ b/install.sh @@ -1,19 +1,34 @@ #!/bin/bash -read -p "Enter Steam username: " STEAM_USER -read -sp "Enter Steam password: " STEAM_PASSWORD +skip_verify=false +for arg in "$@"; do + if [ "$arg" == "--skip-verify" ]; then + skip_verify=true + break + fi +done + +if [ -z "$STEAM_USER" ]; then + read -p "Enter Steam username: " STEAM_USER +fi + +if [ -z "$STEAM_PASS" ]; then + read -sp "Enter Steam password: " STEAM_PASS +fi echo -/steamcmd/steamcmd.sh \ - +force_install_dir /starbound/ \ - +login "$STEAM_USER" "$STEAM_PASSWORD" \ - +app_update 211820 validate \ - +quit +if [ "$skip_verify" = false ]; then + /steamcmd/steamcmd.sh \ + +force_install_dir /starbound/ \ + +login "$STEAM_USER" "$STEAM_PASS" \ + +app_update 211820 validate \ + +quit -# Check if the SteamCMD login was successful -if [ $? -ne 0 ]; then - echo "SteamCMD failed. Check the output for more details." - exit 1 + # Check if the SteamCMD login was successful + if [ $? -ne 0 ]; then + echo "SteamCMD failed. Check the output for more details." + exit 1 + fi fi response=$(curl -s "https://api.github.com/repos/xStarbound/xStarbound/releases/latest") @@ -28,7 +43,7 @@ if [ -n "$download_url" ]; then curl -L "$download_url" -o /tmp/linux-static.tar.gz echo "Downloading assets.pak from the latest release..." - curl -L "$download_url" -o /tmp/assets.pak + curl -L "$assets_url" -o /tmp/assets.pak echo "Creating server folder" mkdir -p /starbound/server diff --git a/start.sh b/start.sh index c7ee18d..b18c1ee 100644 --- a/start.sh +++ b/start.sh @@ -2,10 +2,4 @@ cd /starbound/server chmod +x xserver.sh -./xserver.sh - -while : -do - echo "Press [CTRL+C] to stop.." - sleep 1 -done \ No newline at end of file +./xserver.sh \ No newline at end of file