From 1215209488ebd1008133602df4ba3b5686a403a8 Mon Sep 17 00:00:00 2001 From: MickLesk Date: Wed, 3 Jun 2026 09:25:24 +0200 Subject: [PATCH] refactor: suppress output when enabling kiwix-serve service --- ct/kiwix.sh | 45 ++++------------------------------------ install/kiwix-install.sh | 2 +- 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/ct/kiwix.sh b/ct/kiwix.sh index cd7d2006..8f8f8a4c 100644 --- a/ct/kiwix.sh +++ b/ct/kiwix.sh @@ -57,44 +57,7 @@ function update_script() { start build_container -msg_info "Validating ZIM directory." -if [[ -z "${ZIM_DATA:-}" ]]; then - msg_error "ZIM_DATA cannot be empty. Please run with ZIM_DATA=/path/to/zims" - exit 1 -fi -if [[ ! -d "$ZIM_DATA" ]]; then - msg_error "Directory '$ZIM_DATA' does not exist." - exit 1 -fi -if ! ls "${ZIM_DATA}"/*.zim >/dev/null 2>&1; then - msg_error "No .zim files found in '$ZIM_DATA'" - exit 1 -fi -msg_ok "Using ZIM directory: ${ZIM_DATA}" - -msg_info "Configuring Bind Mount" - -if pct set $CTID -features mountidmap=1 2>/dev/null; then - msg_info "Enabled ID-mapped mounts (ownership preserved)" - pct set $CTID -mp0 "$ZIM_DATA,mp=/data,ro=1" - msg_ok "Bind Mount Configured (read-only, ownership preserved)" -else - msg_info "ID-mapped mounts not available, using standard mount" - msg_info "Note: Files will appear as nobody:nogroup inside container" - msg_info "Ensure ZIM files are world-readable: chmod -R a+rX ${ZIM_DATA}" - pct set $CTID -mp0 "$ZIM_DATA,mp=/data" - msg_ok "Bind Mount Configured (read-write mount, read-only service)" -fi - -msg_info "Starting Service" -pct exec $CTID -- systemctl start kiwix-serve -msg_ok "Started Service" - -msg_info "Setting Container Options" -pct set $CTID --onboot 1 -msg_ok "Container Options Set" - -msg_ok "Completed Successfully!\n" -IP=$(pct exec $CTID -- hostname -I | awk '{print $1}') -echo -e "${TAB}${GATEWAY}${BGN}Web Interface:${CL} ${BL}http://${IP}:8080${CL}" -echo -e "${TAB}${INFO}${BGN}ZIM Directory:${CL} ${ZIM_DATA} ${DGN}→${CL} ${BGN}/data${CL}" +msg_ok "Completed successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}" diff --git a/install/kiwix-install.sh b/install/kiwix-install.sh index 3dcb66c0..4efc58e8 100644 --- a/install/kiwix-install.sh +++ b/install/kiwix-install.sh @@ -44,7 +44,7 @@ RestartSec=5 [Install] WantedBy=multi-user.target EOF -systemctl enable kiwix-serve +systemctl enable -q kiwix-serve msg_ok "Created Service" motd_ssh