Merge branch 'main' of https://github.com/GoldenSpringness/ProxmoxVED into feature/sonobarr

updating code
This commit is contained in:
GoldenSpring 2025-12-26 01:12:30 +03:00
commit a0e6da9ddc
No known key found for this signature in database
GPG Key ID: 75701174BCB6A808
9 changed files with 4483 additions and 4380 deletions

64
ct/rustypaste.sh Normal file
View File

@ -0,0 +1,64 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: GoldenSpringness
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/orhun/rustypaste
APP="rustypaste"
var_tags="${var_tags:-pastebin;storage}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-512}"
var_disk="${var_disk:-20}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -f "/opt/rustypaste/target/release/rustypaste" ]]; then
msg_error "No rustypaste Installation Found!"
exit
fi
if check_for_gh_release "rustypaste" "orhun/rustypaste"; then
msg_info "Stopping rustypaste"
systemctl stop rustypaste
msg_ok "Stopped rustypaste"
msg_info "Creating Backup"
tar -czf "/opt/rustypaste_backup_$(date +%F).tar.gz" "/opt/rustypaste/upload"
msg_ok "Backup Created"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "rustypaste" "orhun/rustypaste" "tarball" "latest" "/opt/rustypaste"
msg_info "Updating rustypaste"
cd /opt/rustypaste
sed -i 's|^address = ".*"|address = "0.0.0.0:8000"|' config.toml
$STD cargo build --locked --release
msg_ok "Updated rustypaste"
msg_info "Starting rustypaste"
systemctl start rustypaste
msg_ok "Started rustypaste"
msg_ok "Update Successful"
fi
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}rustypaste setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8000${CL}"

View File

@ -8,11 +8,11 @@
"type": "addon", "type": "addon",
"updateable": true, "updateable": true,
"privileged": false, "privileged": false,
"interface_port": 9025, "interface_port": 9205,
"documentation": "https://github.com/xperimental/nextcloud-exporter", "documentation": "https://github.com/xperimental/nextcloud-exporter",
"website": "https://github.com/xperimental/nextcloud-exporter", "website": "https://github.com/xperimental/nextcloud-exporter",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/nextcloud.webp", "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/nextcloud.webp",
"config_path": "/opt/nextcloud-exporter.env", "config_path": "/etc/nextcloud-exporter.env",
"description": "Prometheus exporter for Nextcloud servers. ", "description": "Prometheus exporter for Nextcloud servers. ",
"install_methods": [ "install_methods": [
{ {
@ -25,17 +25,6 @@
"os": null, "os": null,
"version": null "version": null
} }
},
{
"type": "alpine",
"script": "tools/addon/nextcloud-exporter.sh",
"resources": {
"cpu": null,
"ram": null,
"hdd": null,
"os": null,
"version": null
}
} }
], ],
"default_credentials": { "default_credentials": {

View File

@ -0,0 +1,40 @@
{
"name": "RustyPaste",
"slug": "rustypaste",
"categories": [
12
],
"date_created": "2025-12-22",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 8000,
"documentation": "https://github.com/orhun/rustypaste",
"config_path": "/opt/rustypaste/config.toml",
"website": "https://github.com/orhun/rustypaste",
"logo": "https://github.com/orhun/rustypaste/raw/master/img/rustypaste_logo.png",
"description": "Rustypaste is a minimal file upload/pastebin service.",
"install_methods": [
{
"type": "default",
"script": "ct/rustypaste.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 20,
"os": "Debian",
"version": "13"
}
}
],
"default_credentials": {
"username": null,
"password": null
},
"notes": [
{
"text": "When updating the script it will backup the whole project including all the uploaded files, make sure to extract it to a safe location or remove",
"type": "info"
}
]
}

View File

@ -13,46 +13,47 @@ setting_up_container
network_check network_check
update_os update_os
msg_info "Installing Dependencies" #msg_info "Installing Dependencies"
$STD apt-get install -y \ #$STD apt-get install -y \
pkg-config \ # pkg-config \
libssl-dev \ # libssl-dev \
libc6-dev \ # libc6-dev \
libpq-dev \ # libpq-dev \
clang \ # clang \
llvm \ # llvm \
nettle-dev \ # nettle-dev \
build-essential \ # build-essential \
make # make
msg_ok "Installed Dependencies" #msg_ok "Installed Dependencies"
setup_rust #setup_rust
NODE_VERSION="22" NODE_MODULE="yarn" setup_nodejs #NODE_VERSION="22" NODE_MODULE="yarn" setup_nodejs
fetch_and_deploy_gh_release "hoodik" "hudikhq/hoodik" "tarball" "latest" "/opt/hoodik" #fetch_and_deploy_gh_release "hoodik" "hudikhq/hoodik" "tarball" "latest" "/opt/hoodik"
fetch_and_deploy_gh_release "hoodik" "hudikhq/hoodik" "prebuild" "latest" "/opt/hoodik" "*x86_64.tar.gz"
msg_info "Installing wasm-pack" #msg_info "Installing wasm-pack"
$STD cargo install wasm-pack #$STD cargo install wasm-pack
msg_ok "Installed wasm-pack" #msg_ok "Installed wasm-pack"
msg_info "Building Hoodik Frontend" #msg_info "Building Hoodik Frontend"
cd /opt/hoodik #cd /opt/hoodik
$STD yarn install --frozen-lockfile #$STD yarn install --frozen-lockfile
$STD yarn wasm-pack #$STD yarn wasm-pack
$STD yarn web:build #$STD yarn web:build
msg_ok "Built Hoodik Frontend" #msg_ok "Built Hoodik Frontend"
msg_info "Building Hoodik Backend" #msg_info "Building Hoodik Backend"
cd /opt/hoodik #cd /opt/hoodik
$STD cargo build --release #$STD cargo build --release
cp /opt/hoodik/target/release/hoodik /usr/local/bin/hoodik #cp /opt/hoodik/target/release/hoodik /usr/local/bin/hoodik
chmod +x /usr/local/bin/hoodik #chmod +x /usr/local/bin/hoodik
msg_ok "Built Hoodik Backend" #msg_ok "Built Hoodik Backend"
msg_info "Cleaning up build artifacts" #msg_info "Cleaning up build artifacts"
rm -rf /opt/hoodik/target #rm -rf /opt/hoodik/target
rm -rf /root/.cargo/registry #rm -rf /root/.cargo/registry
rm -rf /opt/hoodik/node_modules #rm -rf /opt/hoodik/node_modules
msg_ok "Cleaned up build artifacts" #msg_ok "Cleaned up build artifacts"
msg_info "Configuring Hoodik" msg_info "Configuring Hoodik"
mkdir -p /opt/hoodik_data mkdir -p /opt/hoodik_data
@ -80,7 +81,8 @@ Type=simple
User=root User=root
WorkingDirectory=/opt/hoodik_data WorkingDirectory=/opt/hoodik_data
EnvironmentFile=/opt/hoodik/.env EnvironmentFile=/opt/hoodik/.env
ExecStart=/usr/local/bin/hoodik #ExecStart=/usr/local/bin/hoodik
ExecStart=/opt/hoodik
Restart=always Restart=always
RestartSec=5 RestartSec=5

View File

@ -0,0 +1,48 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: GoldenSpringness
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://github.com/orhun/rustypaste
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y build-essential
msg_ok "Dependencies Installed Successfully"
RUST_VERSION="1.92.0" setup_rust
fetch_and_deploy_gh_release "rustypaste" "orhun/rustypaste" "tarball"
msg_info "Setting up rustypaste"
cd /opt/rustypaste
sed -i 's|^address = ".*"|address = "0.0.0.0:8000"|' config.toml
$STD cargo build --locked --release
msg_ok "Set up rustypaste"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/rustypaste.service
[Unit]
Description=rustypaste Service
After=network.target
[Service]
WorkingDirectory=/opt/rustypaste
ExecStart=/opt/rustypaste/target/release/rustypaste
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now rustypaste
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc

View File

@ -3728,7 +3728,7 @@ create_lxc_container() {
case "$PCT_OSTYPE" in case "$PCT_OSTYPE" in
debian | ubuntu | devuan) TEMPLATE_PATTERN="-standard_" ;; debian | ubuntu | devuan) TEMPLATE_PATTERN="-standard_" ;;
alpine | fedora | rocky | rockylinux | centos | almalinux | openeuler) TEMPLATE_PATTERN="-default_" ;; alpine | fedora | rocky | rockylinux | centos | almalinux | openeuler) TEMPLATE_PATTERN="-default_" ;;
gentoo) TEMPLATE_PATTERN="-current_" ;; gentoo) TEMPLATE_PATTERN="-current-openrc" ;;
opensuse) TEMPLATE_PATTERN="-default_" ;; opensuse) TEMPLATE_PATTERN="-default_" ;;
*) TEMPLATE_PATTERN="" ;; *) TEMPLATE_PATTERN="" ;;
esac esac

View File

@ -523,8 +523,11 @@ msg_info() {
if ! declare -p MSG_INFO_SHOWN &>/dev/null || ! declare -A MSG_INFO_SHOWN &>/dev/null; then if ! declare -p MSG_INFO_SHOWN &>/dev/null || ! declare -A MSG_INFO_SHOWN &>/dev/null; then
declare -gA MSG_INFO_SHOWN=() declare -gA MSG_INFO_SHOWN=()
fi fi
[[ -n "${MSG_INFO_SHOWN["$msg"]+x}" ]] && return # Sanitize message for use as associative array key (remove ANSI codes)
MSG_INFO_SHOWN["$msg"]=1 local sanitized_msg
sanitized_msg=$(printf '%s' "$msg" | sed 's/\x1b\[[0-9;]*m//g')
[[ -n "${MSG_INFO_SHOWN["$sanitized_msg"]+x}" ]] && return
MSG_INFO_SHOWN["$sanitized_msg"]=1
stop_spinner stop_spinner
SPINNER_MSG="$msg" SPINNER_MSG="$msg"
@ -569,7 +572,10 @@ msg_ok() {
stop_spinner stop_spinner
clear_line clear_line
echo -e "$CM ${GN}${msg}${CL}" echo -e "$CM ${GN}${msg}${CL}"
unset MSG_INFO_SHOWN["$msg"] # Sanitize message for use as associative array key (remove ANSI codes)
local sanitized_msg
sanitized_msg=$(printf '%s' "$msg" | sed 's/\x1b\[[0-9;]*m//g')
unset MSG_INFO_SHOWN["$sanitized_msg"]
} }
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@ -867,7 +867,7 @@ customize() {
cat >/etc/systemd/system/console-getty.service.d/override.conf <<'EOF' cat >/etc/systemd/system/console-getty.service.d/override.conf <<'EOF'
[Service] [Service]
ExecStart= ExecStart=
ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud 115200,38400,9600 $TERM ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud 115200,38400,9600 - $TERM
EOF EOF
# Enable console-getty for LXC web console (required on Fedora/RHEL) # Enable console-getty for LXC web console (required on Fedora/RHEL)
systemctl enable console-getty.service &>/dev/null || true systemctl enable console-getty.service &>/dev/null || true
@ -879,7 +879,7 @@ EOF
cat >/etc/systemd/system/container-getty@1.service.d/override.conf <<'EOF' cat >/etc/systemd/system/container-getty@1.service.d/override.conf <<'EOF'
[Service] [Service]
ExecStart= ExecStart=
ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 $TERM ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 - $TERM
EOF EOF
fi fi
@ -898,9 +898,10 @@ EOF
;; ;;
sysvinit) sysvinit)
# Devuan/older systems - just modify inittab, no telinit needed during install # Devuan/older systems - modify inittab with flexible runlevel matching
if [[ -f /etc/inittab ]]; then if [[ -f /etc/inittab ]]; then
sed -i 's|^1:2345:respawn:/sbin/getty.*|1:2345:respawn:/sbin/agetty --autologin root tty1 38400 linux|' /etc/inittab # Match various runlevel patterns (23, 2345, 12345, etc.) and both getty/agetty
sed -i 's|^1:[0-9]*:respawn:/sbin/a\?getty.*|1:2345:respawn:/sbin/agetty --autologin root tty1 38400 linux|' /etc/inittab
fi fi
;; ;;
esac esac

View File

@ -20,22 +20,15 @@ load_functions
VERBOSE=${var_verbose:-no} VERBOSE=${var_verbose:-no}
APP="nextcloud-exporter" APP="nextcloud-exporter"
APP_TYPE="tools" APP_TYPE="tools"
INSTALL_PATH="/opt/nextcloud-exporter" BINARY_PATH="/usr/bin/nextcloud-exporter"
CONFIG_PATH="/opt/nextcloud-exporter.env" CONFIG_PATH="/etc/nextcloud-exporter.env"
header_info SERVICE_PATH="/etc/systemd/system/nextcloud-exporter.service"
ensure_usr_local_bin_persist
# ============================================================================== # ==============================================================================
# OS DETECTION # OS DETECTION
# ============================================================================== # ==============================================================================
if [[ -f "/etc/alpine-release" ]]; then if ! grep -qE 'ID=debian|ID=ubuntu' /etc/os-release 2>/dev/null; then
OS="Alpine" echo -e "${CROSS} Unsupported OS detected. This script only supports Debian and Ubuntu."
SERVICE_PATH="/etc/init.d/nextcloud-exporter"
elif grep -qE 'ID=debian|ID=ubuntu' /etc/os-release; then
OS="Debian"
SERVICE_PATH="/etc/systemd/system/nextcloud-exporter.service"
else
echo -e "${CROSS} Unsupported OS detected. Exiting."
exit 1 exit 1
fi fi
@ -44,15 +37,14 @@ fi
# ============================================================================== # ==============================================================================
function uninstall() { function uninstall() {
msg_info "Uninstalling Nextcloud-Exporter" msg_info "Uninstalling Nextcloud-Exporter"
if [[ "$OS" == "Alpine" ]]; then
rc-service nextcloud-exporter stop &>/dev/null
rc-update del nextcloud-exporter &>/dev/null
rm -f "$SERVICE_PATH"
else
systemctl disable -q --now nextcloud-exporter systemctl disable -q --now nextcloud-exporter
rm -f "$SERVICE_PATH" rm -f "$SERVICE_PATH"
if dpkg -l | grep -q nextcloud-exporter; then
$STD apt-get remove -y nextcloud-exporter || $STD dpkg -r nextcloud-exporter
fi fi
rm -rf "$INSTALL_PATH" "$CONFIG_PATH"
rm -f "$CONFIG_PATH"
rm -f "/usr/local/bin/update_nextcloud-exporter" rm -f "/usr/local/bin/update_nextcloud-exporter"
rm -f "$HOME/.nextcloud-exporter" rm -f "$HOME/.nextcloud-exporter"
msg_ok "Nextcloud-Exporter has been uninstalled" msg_ok "Nextcloud-Exporter has been uninstalled"
@ -64,22 +56,13 @@ function uninstall() {
function update() { function update() {
if check_for_gh_release "nextcloud-exporter" "xperimental/nextcloud-exporter"; then if check_for_gh_release "nextcloud-exporter" "xperimental/nextcloud-exporter"; then
msg_info "Stopping service" msg_info "Stopping service"
if [[ "$OS" == "Alpine" ]]; then
rc-service nextcloud-exporter stop &>/dev/null
else
systemctl stop nextcloud-exporter systemctl stop nextcloud-exporter
fi
msg_ok "Stopped service" msg_ok "Stopped service"
fetch_and_deploy_gh_release "nextcloud-exporter" "xperimental/nextcloud-exporter" "prebuild" "latest" "nextcloud-exporter_*_amd64.deb" fetch_and_deploy_gh_release "nextcloud-exporter" "xperimental/nextcloud-exporter" "binary" "latest"
setup_go
msg_info "Starting service" msg_info "Starting service"
if [[ "$OS" == "Alpine" ]]; then
rc-service nextcloud-exporter start &>/dev/null
else
systemctl start nextcloud-exporter systemctl start nextcloud-exporter
fi
msg_ok "Started service" msg_ok "Started service"
msg_ok "Updated successfully" msg_ok "Updated successfully"
exit exit
@ -115,16 +98,15 @@ function install() {
NEXTCLOUD_TLS_SKIP_VERIFY="true" NEXTCLOUD_TLS_SKIP_VERIFY="true"
fi fi
fetch_and_deploy_gh_release "nextcloud-exporter" "xperimental/nextcloud-exporter" "prebuild" "latest" "nextcloud-exporter_*_amd64.deb" fetch_and_deploy_gh_release "nextcloud-exporter" "xperimental/nextcloud-exporter" "binary" "latest"
setup_go
msg_info "Creating configuration" msg_info "Creating configuration"
cat <<EOF >"$CONFIG_PATH" cat <<EOF >"$CONFIG_PATH"
# https://github.com/xperimental/nextcloud-exporter # https://github.com/xperimental/nextcloud-exporter
NEXTCLOUD_SERVER="${NEXTCLOUD_SERVER}" NEXTCLOUD_SERVER="${NEXTCLOUD_SERVER}"
NEXTCLOUD_AUTH_TOKEN="${NEXTCLOUD_AUTH_TOKEN}" NEXTCLOUD_AUTH_TOKEN="${NEXTCLOUD_AUTH_TOKEN:-}"
NEXTCLOUD_USERNAME="${NEXTCLOUD_USERNAME}" NEXTCLOUD_USERNAME="${NEXTCLOUD_USERNAME:-}"
NEXTCLOUD_PASSWORD="${NEXTCLOUD_PASSWORD}" NEXTCLOUD_PASSWORD="${NEXTCLOUD_PASSWORD:-}"
NEXTCLOUD_INFO_UPDATE=${NEXTCLOUD_INFO_UPDATE:-"true"} NEXTCLOUD_INFO_UPDATE=${NEXTCLOUD_INFO_UPDATE:-"true"}
NEXTCLOUD_INFO_APPS=${NEXTCLOUD_INFO_APPS:-"true"} NEXTCLOUD_INFO_APPS=${NEXTCLOUD_INFO_APPS:-"true"}
NEXTCLOUD_TLS_SKIP_VERIFY=${NEXTCLOUD_TLS_SKIP_VERIFY:-"false"} NEXTCLOUD_TLS_SKIP_VERIFY=${NEXTCLOUD_TLS_SKIP_VERIFY:-"false"}
@ -133,7 +115,6 @@ EOF
msg_ok "Created configuration" msg_ok "Created configuration"
msg_info "Creating service" msg_info "Creating service"
if [[ "$OS" == "Debian" ]]; then
cat <<EOF >"$SERVICE_PATH" cat <<EOF >"$SERVICE_PATH"
[Unit] [Unit]
Description=nextcloud-exporter Description=nextcloud-exporter
@ -141,9 +122,8 @@ After=network.target
[Service] [Service]
User=root User=root
WorkingDirectory=/opt/nextcloud-exporter
EnvironmentFile=$CONFIG_PATH EnvironmentFile=$CONFIG_PATH
ExecStart=/opt/nextcloud-exporter/nextcloud-exporter ExecStart=$BINARY_PATH
Restart=always Restart=always
[Install] [Install]
@ -151,34 +131,6 @@ WantedBy=multi-user.target
EOF EOF
systemctl daemon-reload systemctl daemon-reload
systemctl enable -q --now nextcloud-exporter systemctl enable -q --now nextcloud-exporter
else
cat <<EOF >"$SERVICE_PATH"
#!/sbin/openrc-run
name="nextcloud-exporter"
description="Nextcloud Exporter for Prometheus"
command="${INSTALL_PATH}/nextcloud-exporter"
command_background=true
directory="/opt/nextcloud-exporter"
pidfile="/run/\${RC_SVCNAME}.pid"
output_log="/var/log/nextcloud-exporter.log"
error_log="/var/log/nextcloud-exporter.log"
depend() {
need net
after firewall
}
start_pre() {
if [ -f "$CONFIG_PATH" ]; then
export \$(grep -v '^#' $CONFIG_PATH | xargs)
fi
}
EOF
chmod +x "$SERVICE_PATH"
$STD rc-update add nextcloud-exporter default
$STD rc-service nextcloud-exporter start
fi
msg_ok "Created and started service" msg_ok "Created and started service"
# Create update script # Create update script
@ -194,7 +146,7 @@ UPDATEEOF
echo "" echo ""
msg_ok "Nextcloud-Exporter installed successfully" msg_ok "Nextcloud-Exporter installed successfully"
msg_ok "Metrics: ${BL}http://${CURRENT_IP}:9205/metrics${CL}" msg_ok "Metrics: ${BL}http://${LOCAL_IP}:9205/metrics${CL}"
msg_ok "Config: ${BL}${CONFIG_PATH}${CL}" msg_ok "Config: ${BL}${CONFIG_PATH}${CL}"
} }
@ -203,10 +155,11 @@ UPDATEEOF
# ============================================================================== # ==============================================================================
header_info header_info
ensure_usr_local_bin_persist ensure_usr_local_bin_persist
import_local_ip
# Handle type=update (called from update script) # Handle type=update (called from update script)
if [[ "${type:-}" == "update" ]]; then if [[ "${type:-}" == "update" ]]; then
if [[ -d "$INSTALL_PATH" && -f "$INSTALL_PATH/nextcloud-exporter" ]]; then if [[ -f "$BINARY_PATH" ]]; then
update update
else else
msg_error "Nextcloud-Exporter is not installed. Nothing to update." msg_error "Nextcloud-Exporter is not installed. Nothing to update."
@ -216,7 +169,7 @@ if [[ "${type:-}" == "update" ]]; then
fi fi
# Check if already installed # Check if already installed
if [[ -d "$INSTALL_PATH" && -f "$INSTALL_PATH/nextcloud-exporter" ]]; then if [[ -f "$BINARY_PATH" ]]; then
msg_warn "Nextcloud-Exporter is already installed." msg_warn "Nextcloud-Exporter is already installed."
echo "" echo ""
@ -243,7 +196,7 @@ msg_warn "Nextcloud-Exporter is not installed."
echo "" echo ""
echo -e "${TAB}${INFO} This will install:" echo -e "${TAB}${INFO} This will install:"
echo -e "${TAB} - Nextcloud Exporter (Go binary)" echo -e "${TAB} - Nextcloud Exporter (Go binary)"
echo -e "${TAB} - Systemd/OpenRC service" echo -e "${TAB} - Systemd service"
echo "" echo ""
echo -n "${TAB}Install Nextcloud-Exporter? (y/N): " echo -n "${TAB}Install Nextcloud-Exporter? (y/N): "