From fd9a69c679f3ed6275219bb61da442628a0d4f05 Mon Sep 17 00:00:00 2001 From: kuwoyuki Date: Sun, 7 Dec 2025 17:11:07 +0600 Subject: [PATCH] zz --- binhost.sh | 13 +++++++++++-- serve.sh | 17 +++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/binhost.sh b/binhost.sh index dbc5b56..05c817d 100755 --- a/binhost.sh +++ b/binhost.sh @@ -9,6 +9,7 @@ CTX="${WORK_DIR}/ctx" IMAGE="docker.io/gentoo/stage3:amd64-desktop-openrc" CONTAINER_NAME="gentoo_builder" PROFILE="default/linux/amd64/23.0/desktop" +LOG_FILE="/var/log/gentoo_build.log" # inside container if [[ ! -d "$REPO/.git" ]]; then git clone "$REPO_URL" "$REPO" @@ -92,7 +93,8 @@ podman cp "$CTX/var/lib/portage/world" "$CONTAINER_NAME":/var/lib/portage/world echo "Starting Builder..." -podman exec -i "$CONTAINER_NAME" /bin/bash < /usr/local/bin/run_job.sh" +#!/bin/bash set -e source /etc/profile @@ -115,7 +117,14 @@ emerge --verbose --usepkg --buildpkg \ echo "Cleaning up.." emerge --depclean emaint binhost --fix +echo "[$(date)] Build Finished successfully." EOF -echo "Build complete." +echo "Triggering build in background..." + +podman exec -d "$CONTAINER_NAME" bash -c "chmod +x /usr/local/bin/run_job.sh && /usr/local/bin/run_job.sh > $LOG_FILE 2>&1" + +echo "Build is running in the background." +echo "To view progress, run:" +echo " podman exec -it $CONTAINER_NAME tail -f $LOG_FILE" diff --git a/serve.sh b/serve.sh index 6dda0a7..ee9f498 100755 --- a/serve.sh +++ b/serve.sh @@ -2,17 +2,17 @@ WEB_CONTAINER="gentoo_binhost_server" WEB_PORT="8080" +VOLUME_NAME="binpkgs" -echo "Checking Web Server..." +podman volume inspect "$VOLUME_NAME" >/dev/null 2>&1 || podman volume create "$VOLUME_NAME" if ! podman container exists "$WEB_CONTAINER"; then - echo "Starting Nginx binhost server on port $WEB_PORT..." - + echo "Creating Nginx binhost server on port $WEB_PORT..." podman run -d \ --name "$WEB_CONTAINER" \ --restart always \ -p "$WEB_PORT":80 \ - -v binpkgs:/usr/share/nginx/html:ro \ + -v "$VOLUME_NAME":/usr/share/nginx/html:ro \ nginx:alpine \ /bin/sh -c ' echo "server { @@ -23,6 +23,11 @@ if ! podman container exists "$WEB_CONTAINER"; then } }" > /etc/nginx/conf.d/default.conf && nginx -g "daemon off;"' else - podman start "$WEB_CONTAINER" >/dev/null 2>&1 - echo "Server is running at http://localhost:$WEB_PORT" + if [ "$(podman container inspect -f '{{.State.Running}}' "$WEB_CONTAINER")" != "true" ]; then + echo "Starting existing server..." + podman start "$WEB_CONTAINER" + fi fi + +echo "Binhost serving at http://localhost:$WEB_PORT" +