diff --git a/ct/openlist.sh b/ct/openlist.sh index e19755edaa..f96a80b7e1 100755 --- a/ct/openlist.sh +++ b/ct/openlist.sh @@ -15,7 +15,7 @@ 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)") + "alpine" "Alpine 3.24 (smaller footprint)") fi if [[ "${var_os:-}" == "alpine" ]]; then @@ -33,13 +33,6 @@ variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources - run_os_update -} - update_deb_based() { if [[ ! -f /opt/openlist/openlist ]]; then msg_error "No OpenList Installation Found!" @@ -84,6 +77,13 @@ update_alpine() { fi } +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update +} + start build_container description diff --git a/install/openlist-install.sh b/install/openlist-install.sh index 0c69eac607..aad6828f9d 100755 --- a/install/openlist-install.sh +++ b/install/openlist-install.sh @@ -13,25 +13,25 @@ setting_up_container network_check update_os -fetch_and_deploy_gh_release "openlist" "OpenListTeam/OpenList" "prebuild" "latest" "/opt/openlist" "openlist-linux-musl-$(arch_resolve "amd64" "arm64").tar.gz" +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 "Setting up 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 + 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 "Set up OpenList" + chmod 600 ~/openlist.creds + msg_ok "Configured OpenList" -setup_deb_based() { - msg_info "Creating OpenList Service" + msg_info "Creating Service" cat </etc/systemd/system/openlist.service [Unit] Description=OpenList @@ -49,37 +49,46 @@ RestartSec=5 WantedBy=multi-user.target EOF systemctl enable -q --now openlist - msg_ok "Created OpenList Service" + msg_ok "Created Service" } setup_alpine() { - msg_info "Creating OpenList Service" - cat <<'EOF' >/etc/init.d/openlist -#!/sbin/openrc-run -name="OpenList" -description="OpenList - a file list program that supports multiple storages" + 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" -supervisor=supervise-daemon -directory="/opt/openlist" -output_log="/var/log/openlist.log" -error_log="/var/log/openlist.log" -respawn_delay=10 +command_background="yes" +pidfile="/run/openlist.pid" depend() { - need net - after firewall -} - -start_pre() { - checkpath -f -m 0640 "$output_log" + need net } EOF chmod +x /etc/init.d/openlist $STD rc-update add openlist default $STD rc-service openlist start - msg_ok "Created OpenList Service" + msg_ok "Created Service" } run_os_setup