From 1a538adce717f126e6e22ac8dad1531eeaac8086 Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Sun, 15 Nov 2026 19:52:23 +0000 Subject: [PATCH] Add openlist (ct) --- ct/openlist.sh | 94 +++++++++++++++++++++++++++++++++++ install/openlist-install.sh | 98 +++++++++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+) create mode 100755 ct/openlist.sh create mode 100755 install/openlist-install.sh diff --git a/ct/openlist.sh b/ct/openlist.sh new file mode 100755 index 000000000..c38382fef --- /dev/null +++ b/ct/openlist.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +_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: uchouT (uchouT) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/OpenListTeam/OpenList/ + +APP="OpenList" +var_tags="${var_tags:-files;storage}" +var_cpu="${var_cpu:-1}" +var_arm64="${var_arm64:-yes}" +var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine 3.24 (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-512}" + var_disk="${var_disk:-4}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-1024}" + var_disk="${var_disk:-6}" + var_version="${var_version:-13}" +fi + +header_info "$APP" +variables +color +catch_errors + +update_deb_based() { + if [[ ! -f /opt/openlist/openlist ]]; then + msg_error "No OpenList Installation Found!" + exit 1 + fi + + if check_for_gh_release "openlist" "OpenListTeam/OpenList"; then + msg_info "Stopping OpenList" + systemctl stop openlist + msg_ok "Stopped OpenList" + + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "openlist" "OpenListTeam/OpenList" "prebuild" "latest" "/opt/openlist" "openlist-linux-musl-$(arch_resolve "amd64" "arm64").tar.gz" + + msg_info "Starting OpenList" + systemctl start openlist + msg_ok "Started OpenList" + msg_ok "Updated successfully!" + fi +} + +update_alpine() { + if [[ ! -f /opt/openlist/openlist ]]; then + msg_error "No OpenList Installation Found!" + exit 1 + fi + + msg_info "Updating Alpine Packages" + $STD apk -U upgrade + msg_ok "Updated Alpine Packages" + + if check_for_gh_release "openlist" "OpenListTeam/OpenList"; then + msg_info "Stopping OpenList" + $STD rc-service openlist stop + msg_ok "Stopped OpenList" + + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "openlist" "OpenListTeam/OpenList" "prebuild" "latest" "/opt/openlist" "openlist-linux-musl-$(arch_resolve "amd64" "arm64").tar.gz" + + msg_info "Starting OpenList" + $STD rc-service openlist start + msg_ok "Started OpenList" + msg_ok "Updated successfully!" + fi +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update +} + +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}:5244${CL}" +echo -e "${INFO}${YW}Credentials: /root/openlist.creds (inside the container)${CL}" diff --git a/install/openlist-install.sh b/install/openlist-install.sh new file mode 100755 index 000000000..16477f4b9 --- /dev/null +++ b/install/openlist-install.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: uchouT (uchouT) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/OpenListTeam/OpenList/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +setup_deb_based() { + fetch_and_deploy_gh_release "openlist" "OpenListTeam/OpenList" "prebuild" "latest" "/opt/openlist" "openlist-linux-musl-$(arch_resolve "amd64" "arm64").tar.gz" + + msg_info "Configuring OpenList" + ADMIN_PASS="$(random_password 16)" + $STD /opt/openlist/openlist --data /opt/openlist_data admin set "$ADMIN_PASS" + if [[ ! -f /opt/openlist_data/data.db ]]; then + msg_error "OpenList did not initialise its database" + exit 1 + fi + cat <~/openlist.creds +OpenList Credentials +Username: admin +Password: ${ADMIN_PASS} +EOF + chmod 600 ~/openlist.creds + msg_ok "Configured OpenList" + + msg_info "Creating Service" + cat </etc/systemd/system/openlist.service +[Unit] +Description=OpenList +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/openlist +ExecStart=/opt/openlist/openlist server --data /opt/openlist_data +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF + systemctl enable -q --now openlist + msg_ok "Created Service" +} + +setup_alpine() { + fetch_and_deploy_gh_release "openlist" "OpenListTeam/OpenList" "prebuild" "latest" "/opt/openlist" "openlist-linux-musl-$(arch_resolve "amd64" "arm64").tar.gz" + + msg_info "Configuring OpenList" + ADMIN_PASS="$(random_password 16)" + $STD /opt/openlist/openlist --data /opt/openlist_data admin set "$ADMIN_PASS" + if [[ ! -f /opt/openlist_data/data.db ]]; then + msg_error "OpenList did not initialise its database" + exit 1 + fi + cat <~/openlist.creds +OpenList Credentials +Username: admin +Password: ${ADMIN_PASS} +EOF + chmod 600 ~/openlist.creds + msg_ok "Configured OpenList" + + msg_info "Creating Service" + cat </etc/init.d/openlist +#!/sbin/openrc-run +name="openlist" +description="OpenList Daemon" +directory="/opt/openlist" +command="/opt/openlist/openlist" +command_args="server --data /opt/openlist_data" +command_background="yes" +pidfile="/run/openlist.pid" + +depend() { + need net +} +EOF + chmod +x /etc/init.d/openlist + $STD rc-update add openlist default + $STD rc-service openlist start + msg_ok "Created Service" +} + +run_os_setup + +motd_ssh +customize +cleanup_lxc