refactor: suppress output when enabling kiwix-serve service

This commit is contained in:
MickLesk
2026-06-03 09:25:24 +02:00
parent c1c9975771
commit 1215209488
2 changed files with 5 additions and 42 deletions

View File

@@ -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}"

View File

@@ -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