From 441b6a3610e4dac8b5b5df0c5bee9baae003d312 Mon Sep 17 00:00:00 2001 From: Ruben Bosch Date: Sun, 22 Nov 2026 23:02:27 +0100 Subject: [PATCH] feat: add OpenBooks support --- ct/openbooks.sh | 57 ++++++++++++++++++++++++++++++++++ install/openbooks-install.sh | 57 ++++++++++++++++++++++++++++++++++ json/openbooks.json | 60 ++++++++++++++++++++++++++++++++++++ 3 files changed, 174 insertions(+) create mode 100644 ct/openbooks.sh create mode 100644 install/openbooks-install.sh create mode 100644 json/openbooks.json diff --git a/ct/openbooks.sh b/ct/openbooks.sh new file mode 100644 index 0000000000..1ec073d9c3 --- /dev/null +++ b/ct/openbooks.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main" +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") +# Copyright (c) 2021-2026 community-scripts ORG +# Author: Rubueno +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://github.com/evan-buss/openbooks + +APP="OpenBooks" +var_tags="${var_tags:-ebooks;irc}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-512}" +var_disk="${var_disk:-4}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_arm64="${var_arm64:-yes}" # upstream ships openbooks_linux_arm (GOARCH=arm64) +var_unprivileged="${var_unprivileged:-1}" +export var_openbooks_name="${var_openbooks_name:-}" +export var_openbooks_persist="${var_openbooks_persist:-}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -f /opt/openbooks/openbooks ]]; then + msg_error "No OpenBooks Installation Found!" + exit + fi + if check_for_gh_release "openbooks" "evan-buss/openbooks"; then + msg_info "Stopping Service" + systemctl stop openbooks + msg_ok "Stopped Service" + + fetch_and_deploy_gh_release "openbooks" "evan-buss/openbooks" "singlefile" "latest" "/opt/openbooks" "$(arch_resolve "openbooks_linux" "openbooks_linux_arm")" + + msg_info "Starting Service" + systemctl start openbooks + msg_ok "Started Service" + msg_ok "Updated successfully!" + fi + exit +} + +start +build_container +description + +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 "${GATEWAY}${BGN}http://${IP}:5228${CL}" diff --git a/install/openbooks-install.sh b/install/openbooks-install.sh new file mode 100644 index 0000000000..e01b1af01e --- /dev/null +++ b/install/openbooks-install.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# Copyright (c) 2021-2026 community-scripts ORG +# Author: Rubueno +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://github.com/evan-buss/openbooks + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +fetch_and_deploy_gh_release "openbooks" "evan-buss/openbooks" "singlefile" "latest" "/opt/openbooks" "$(arch_resolve "openbooks_linux" "openbooks_linux_arm")" + +if [[ -z "${var_openbooks_persist:-}" ]]; then + if prompt_confirm "Keep downloaded books in /opt/openbooks/books?" "y" 60; then + var_openbooks_persist="yes" + else + var_openbooks_persist="no" + fi +fi + +msg_info "Configuring OpenBooks" +mkdir -p /opt/openbooks/books +cat </opt/openbooks/.env +IRC_NAME=${var_openbooks_name:-openbooks_$(openssl rand -hex 3)} +OPENBOOKS_ARGS=$([[ "$var_openbooks_persist" == "yes" ]] && echo "--persist" || true) +EOT +msg_ok "Configured OpenBooks" + +msg_info "Creating Service" +cat </etc/systemd/system/openbooks.service +[Unit] +Description=OpenBooks +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +Environment=HOME=/opt/openbooks +EnvironmentFile=/opt/openbooks/.env +WorkingDirectory=/opt/openbooks +ExecStart=/opt/openbooks/openbooks server --name \${IRC_NAME} --port 5228 --dir /opt/openbooks/books \$OPENBOOKS_ARGS +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOT +systemctl enable -q --now openbooks +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc diff --git a/json/openbooks.json b/json/openbooks.json new file mode 100644 index 0000000000..d552ee67d0 --- /dev/null +++ b/json/openbooks.json @@ -0,0 +1,60 @@ +{ + "name": "OpenBooks", + "slug": "openbooks", + "categories": [11, 13], + "date_created": "2026-11-22", + "type": "ct", + "platforms": ["pve"], + "updateable": true, + "privileged": false, + "interface_port": 5228, + "documentation": "https://github.com/evan-buss/openbooks#readme", + "website": "https://evan-buss.github.io/openbooks/", + "repository": "https://github.com/evan-buss/openbooks", + "architectures": ["amd64", "arm64"], + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/openbooks.webp", + "description": "OpenBooks is a web interface for searching and downloading eBooks from IRC Highway. It hides the IRC bots and commands behind a search page and saves the downloaded books to disk.", + "install_methods": [ + { + "type": "default", + "script": "ct/openbooks.sh", + "config_path": "/opt/openbooks/.env", + "resources": { + "cpu": 1, + "ram": 512, + "hdd": 4, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "app_vars": [ + { + "name": "var_openbooks_name", + "label": "IRC nickname", + "type": "text", + "help": "Nickname used on IRC Highway. Leave empty for a random openbooks_xxxxxx name. Can be changed later in /opt/openbooks/.env" + }, + { + "name": "var_openbooks_persist", + "label": "Keep downloaded books on disk", + "type": "boolean", + "default": "yes", + "help": "yes: books are saved in /opt/openbooks/books. no: books are only sent to the browser and deleted afterwards. Change OPENBOOKS_ARGS in /opt/openbooks/.env later." + } + ], + "notes": [ + { + "text": "The web UI has no login. Keep it on your LAN or put it behind a reverse proxy with authentication.", + "type": "warning" + }, + { + "text": "With persistent storage on, downloaded books are kept in /opt/openbooks/books.", + "type": "info" + } + ] +}