From 09f27d411da5ad63cdda806f49cd051a8b194851 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 13 Mar 2025 10:24:27 +0100 Subject: [PATCH 01/62] CRLF -> LF + NFS FUSE CIFS Feature --- misc/build.func | 1884 ++++++++++++++++++++++++----------------------- 1 file changed, 943 insertions(+), 941 deletions(-) diff --git a/misc/build.func b/misc/build.func index dd4e142..c70624c 100644 --- a/misc/build.func +++ b/misc/build.func @@ -5,837 +5,840 @@ # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE variables() { - NSAPP=$(echo ${APP,,} | tr -d ' ') # This function sets the NSAPP variable by converting the value of the APP variable to lowercase and removing any spaces. - var_install="${NSAPP}-install" # sets the var_install variable by appending "-install" to the value of NSAPP. - INTEGER='^[0-9]+([.][0-9]+)?$' # it defines the INTEGER regular expression pattern. - PVEHOST_NAME=$(hostname) # gets the Proxmox Hostname and sets it to Uppercase - DIAGNOSTICS="yes" # sets the DIAGNOSTICS variable to "yes", used for the API call. - METHOD="default" # sets the METHOD variable to "default", used for the API call. - RANDOM_UUID="$(cat /proc/sys/kernel/random/uuid)" # generates a random UUID and sets it to the RANDOM_UUID variable. + NSAPP=$(echo ${APP,,} | tr -d ' ') # This function sets the NSAPP variable by converting the value of the APP variable to lowercase and removing any spaces. + var_install="${NSAPP}-install" # sets the var_install variable by appending "-install" to the value of NSAPP. + INTEGER='^[0-9]+([.][0-9]+)?$' # it defines the INTEGER regular expression pattern. + PVEHOST_NAME=$(hostname) # gets the Proxmox Hostname and sets it to Uppercase + DIAGNOSTICS="yes" # sets the DIAGNOSTICS variable to "yes", used for the API call. + METHOD="default" # sets the METHOD variable to "default", used for the API call. + RANDOM_UUID="$(cat /proc/sys/kernel/random/uuid)" # generates a random UUID and sets it to the RANDOM_UUID variable. } source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/api.func) # This function sets various color variables using ANSI escape codes for formatting text in the terminal. color() { - # Colors - YW=$(echo "\033[33m") - YWB=$(echo "\033[93m") - BL=$(echo "\033[36m") - RD=$(echo "\033[01;31m") - BGN=$(echo "\033[4;92m") - GN=$(echo "\033[1;92m") - DGN=$(echo "\033[32m") + # Colors + YW=$(echo "\033[33m") + YWB=$(echo "\033[93m") + BL=$(echo "\033[36m") + RD=$(echo "\033[01;31m") + BGN=$(echo "\033[4;92m") + GN=$(echo "\033[1;92m") + DGN=$(echo "\033[32m") - # Formatting - CL=$(echo "\033[m") - UL=$(echo "\033[4m") - BOLD=$(echo "\033[1m") - BFR="\\r\\033[K" - HOLD=" " - TAB=" " + # Formatting + CL=$(echo "\033[m") + UL=$(echo "\033[4m") + BOLD=$(echo "\033[1m") + BFR="\\r\\033[K" + HOLD=" " + TAB=" " - # Icons - CM="${TAB}βœ”οΈ${TAB}${CL}" - CROSS="${TAB}βœ–οΈ${TAB}${CL}" - INFO="${TAB}πŸ’‘${TAB}${CL}" - OS="${TAB}πŸ–₯️${TAB}${CL}" - OSVERSION="${TAB}🌟${TAB}${CL}" - CONTAINERTYPE="${TAB}πŸ“¦${TAB}${CL}" - DISKSIZE="${TAB}πŸ’Ύ${TAB}${CL}" - CPUCORE="${TAB}🧠${TAB}${CL}" - RAMSIZE="${TAB}πŸ› οΈ${TAB}${CL}" - SEARCH="${TAB}πŸ”${TAB}${CL}" - VERIFYPW="${TAB}πŸ”${TAB}${CL}" - CONTAINERID="${TAB}πŸ†”${TAB}${CL}" - HOSTNAME="${TAB}🏠${TAB}${CL}" - BRIDGE="${TAB}πŸŒ‰${TAB}${CL}" - NETWORK="${TAB}πŸ“‘${TAB}${CL}" - GATEWAY="${TAB}🌐${TAB}${CL}" - DISABLEIPV6="${TAB}🚫${TAB}${CL}" - DEFAULT="${TAB}βš™οΈ${TAB}${CL}" - MACADDRESS="${TAB}πŸ”—${TAB}${CL}" - VLANTAG="${TAB}🏷️${TAB}${CL}" - ROOTSSH="${TAB}πŸ”‘${TAB}${CL}" - CREATING="${TAB}πŸš€${TAB}${CL}" - ADVANCED="${TAB}🧩${TAB}${CL}" + # Icons + CM="${TAB}βœ”οΈ${TAB}${CL}" + CROSS="${TAB}βœ–οΈ${TAB}${CL}" + INFO="${TAB}πŸ’‘${TAB}${CL}" + OS="${TAB}πŸ–₯️${TAB}${CL}" + OSVERSION="${TAB}🌟${TAB}${CL}" + CONTAINERTYPE="${TAB}πŸ“¦${TAB}${CL}" + DISKSIZE="${TAB}πŸ’Ύ${TAB}${CL}" + CPUCORE="${TAB}🧠${TAB}${CL}" + RAMSIZE="${TAB}πŸ› οΈ${TAB}${CL}" + SEARCH="${TAB}πŸ”${TAB}${CL}" + VERIFYPW="${TAB}πŸ”${TAB}${CL}" + CONTAINERID="${TAB}πŸ†”${TAB}${CL}" + HOSTNAME="${TAB}🏠${TAB}${CL}" + BRIDGE="${TAB}πŸŒ‰${TAB}${CL}" + NETWORK="${TAB}πŸ“‘${TAB}${CL}" + GATEWAY="${TAB}🌐${TAB}${CL}" + DISABLEIPV6="${TAB}🚫${TAB}${CL}" + DEFAULT="${TAB}βš™οΈ${TAB}${CL}" + MACADDRESS="${TAB}πŸ”—${TAB}${CL}" + VLANTAG="${TAB}🏷️${TAB}${CL}" + ROOTSSH="${TAB}πŸ”‘${TAB}${CL}" + CREATING="${TAB}πŸš€${TAB}${CL}" + ADVANCED="${TAB}🧩${TAB}${CL}" + CIFS="${TAB}πŸ”Œ${TAB}${CL}" + FUSE="${TAB}πŸ”§${TAB}${CL}" + NFS="${TAB}πŸ“‚${TAB}${CL}" } # This function enables error handling in the script by setting options and defining a trap for the ERR signal. catch_errors() { - set -Eeuo pipefail - trap 'error_handler $LINENO "$BASH_COMMAND"' ERR + set -Eeuo pipefail + trap 'error_handler $LINENO "$BASH_COMMAND"' ERR } # This function is called when an error occurs. It receives the exit code, line number, and command that caused the error, and displays an error message. error_handler() { - source /dev/stdin <<<$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/api.func) - if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID >/dev/null; then kill $SPINNER_PID >/dev/null; fi - printf "\e[?25h" - local exit_code="$?" - local line_number="$1" - local command="$2" - local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" - post_update_to_api "failed" "${command}" - echo -e "\n$error_message\n" + source /dev/stdin <<<$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/api.func) + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID >/dev/null; then kill $SPINNER_PID >/dev/null; fi + printf "\e[?25h" + local exit_code="$?" + local line_number="$1" + local command="$2" + local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" + post_update_to_api "failed" "${command}" + echo -e "\n$error_message\n" } # This function displays an informational message with logging support. start_spinner() { - local msg="$1" - local frames=('β ‹' 'β ™' 'β Ή' 'β Έ' 'β Ό' 'β ΄' 'β ¦' 'β §' 'β ‡' '⠏') - local spin_i=0 - local interval=0.1 - local term_width=$(tput cols) + local msg="$1" + local frames=('β ‹' 'β ™' 'β Ή' 'β Έ' 'β Ό' 'β ΄' 'β ¦' 'β §' 'β ‡' '⠏') + local spin_i=0 + local interval=0.1 + local term_width=$(tput cols) - { - while [ "${SPINNER_ACTIVE:-1}" -eq 1 ]; do - printf "\r\e[2K${frames[spin_i]} ${YW}%b${CL}" "$msg" >&2 - spin_i=$(((spin_i + 1) % ${#frames[@]})) - sleep "$interval" - done - } & + { + while [ "${SPINNER_ACTIVE:-1}" -eq 1 ]; do + printf "\r\e[2K${frames[spin_i]} ${YW}%b${CL}" "$msg" >&2 + spin_i=$(((spin_i + 1) % ${#frames[@]})) + sleep "$interval" + done + } & - SPINNER_PID=$! + SPINNER_PID=$! } msg_info() { - local msg="$1" - if [ "${SPINNER_ACTIVE:-0}" -eq 1 ]; then - return - fi + local msg="$1" + if [ "${SPINNER_ACTIVE:-0}" -eq 1 ]; then + return + fi - SPINNER_ACTIVE=1 - start_spinner "$msg" + SPINNER_ACTIVE=1 + start_spinner "$msg" } msg_ok() { - if [ -n "${SPINNER_PID:-}" ] && ps -p "$SPINNER_PID" >/dev/null 2>&1; then - kill "$SPINNER_PID" >/dev/null 2>&1 - wait "$SPINNER_PID" 2>/dev/null || true - fi + if [ -n "${SPINNER_PID:-}" ] && ps -p "$SPINNER_PID" >/dev/null 2>&1; then + kill "$SPINNER_PID" >/dev/null 2>&1 + wait "$SPINNER_PID" 2>/dev/null || true + fi - local msg="$1" - printf "\r\e[2K${CM}${GN}%b${CL}\n" "$msg" >&2 - unset SPINNER_PID - SPINNER_ACTIVE=0 + local msg="$1" + printf "\r\e[2K${CM}${GN}%b${CL}\n" "$msg" >&2 + unset SPINNER_PID + SPINNER_ACTIVE=0 - log_message "OK" "$msg" + log_message "OK" "$msg" } msg_error() { - if [ -n "${SPINNER_PID:-}" ] && ps -p "$SPINNER_PID" >/dev/null 2>&1; then - kill "$SPINNER_PID" >/dev/null 2>&1 - wait "$SPINNER_PID" 2>/dev/null || true - fi + if [ -n "${SPINNER_PID:-}" ] && ps -p "$SPINNER_PID" >/dev/null 2>&1; then + kill "$SPINNER_PID" >/dev/null 2>&1 + wait "$SPINNER_PID" 2>/dev/null || true + fi - local msg="$1" - printf "\r\e[2K${CROSS}${RD}%b${CL}\n" "$msg" >&2 - unset SPINNER_PID - SPINNER_ACTIVE=0 - log_message "ERROR" "$msg" + local msg="$1" + printf "\r\e[2K${CROSS}${RD}%b${CL}\n" "$msg" >&2 + unset SPINNER_PID + SPINNER_ACTIVE=0 + log_message "ERROR" "$msg" } log_message() { - local level="$1" - local message="$2" - local timestamp - local logdate - timestamp=$(date '+%Y-%m-%d %H:%M:%S') - logdate=$(date '+%Y-%m-%d') + local level="$1" + local message="$2" + local timestamp + local logdate + timestamp=$(date '+%Y-%m-%d %H:%M:%S') + logdate=$(date '+%Y-%m-%d') - LOGDIR="/usr/local/community-scripts/logs" - mkdir -p "$LOGDIR" + LOGDIR="/usr/local/community-scripts/logs" + mkdir -p "$LOGDIR" - LOGFILE="${LOGDIR}/${logdate}_${NSAPP}.log" - echo "$timestamp - $level: $message" >>"$LOGFILE" + LOGFILE="${LOGDIR}/${logdate}_${NSAPP}.log" + echo "$timestamp - $level: $message" >>"$LOGFILE" } # Check if the shell is using bash shell_check() { - if [[ "$(basename "$SHELL")" != "bash" ]]; then - clear - msg_error "Your default shell is currently not set to Bash. To use these scripts, please switch to the Bash shell." - echo -e "\nExiting..." - sleep 2 - exit - fi + if [[ "$(basename "$SHELL")" != "bash" ]]; then + clear + msg_error "Your default shell is currently not set to Bash. To use these scripts, please switch to the Bash shell." + echo -e "\nExiting..." + sleep 2 + exit + fi } # Run as root only root_check() { - if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then - clear - msg_error "Please run this script as root." - echo -e "\nExiting..." - sleep 2 - exit - fi + if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then + clear + msg_error "Please run this script as root." + echo -e "\nExiting..." + sleep 2 + exit + fi } # This function checks the version of Proxmox Virtual Environment (PVE) and exits if the version is not supported. pve_check() { - if ! pveversion | grep -Eq "pve-manager/8\.[1-3](\.[0-9]+)*"; then - msg_error "${CROSS}${RD}This version of Proxmox Virtual Environment is not supported" - echo -e "Requires Proxmox Virtual Environment Version 8.1 or later." - echo -e "Exiting..." - sleep 2 - exit - fi + if ! pveversion | grep -Eq "pve-manager/8\.[1-3](\.[0-9]+)*"; then + msg_error "${CROSS}${RD}This version of Proxmox Virtual Environment is not supported" + echo -e "Requires Proxmox Virtual Environment Version 8.1 or later." + echo -e "Exiting..." + sleep 2 + exit + fi } # When a node is running tens of containers, it's possible to exceed the kernel's cryptographic key storage allocations. # These are tuneable, so verify if the currently deployment is approaching the limits, advise the user on how to tune the limits, and exit the script. # https://cleveruptime.com/docs/files/proc-key-users | https://docs.kernel.org/security/keys/core.html maxkeys_check() { - # Read kernel parameters - per_user_maxkeys=$(cat /proc/sys/kernel/keys/maxkeys 2>/dev/null || echo 0) - per_user_maxbytes=$(cat /proc/sys/kernel/keys/maxbytes 2>/dev/null || echo 0) + # Read kernel parameters + per_user_maxkeys=$(cat /proc/sys/kernel/keys/maxkeys 2>/dev/null || echo 0) + per_user_maxbytes=$(cat /proc/sys/kernel/keys/maxbytes 2>/dev/null || echo 0) - # Exit if kernel parameters are unavailable - if [[ "$per_user_maxkeys" -eq 0 || "$per_user_maxbytes" -eq 0 ]]; then - echo -e "${CROSS}${RD} Error: Unable to read kernel parameters. Ensure proper permissions.${CL}" - exit 1 - fi + # Exit if kernel parameters are unavailable + if [[ "$per_user_maxkeys" -eq 0 || "$per_user_maxbytes" -eq 0 ]]; then + echo -e "${CROSS}${RD} Error: Unable to read kernel parameters. Ensure proper permissions.${CL}" + exit 1 + fi - # Fetch key usage for user ID 100000 (typical for containers) - used_lxc_keys=$(awk '/100000:/ {print $2}' /proc/key-users 2>/dev/null || echo 0) - used_lxc_bytes=$(awk '/100000:/ {split($5, a, "/"); print a[1]}' /proc/key-users 2>/dev/null || echo 0) + # Fetch key usage for user ID 100000 (typical for containers) + used_lxc_keys=$(awk '/100000:/ {print $2}' /proc/key-users 2>/dev/null || echo 0) + used_lxc_bytes=$(awk '/100000:/ {split($5, a, "/"); print a[1]}' /proc/key-users 2>/dev/null || echo 0) - # Calculate thresholds and suggested new limits - threshold_keys=$((per_user_maxkeys - 100)) - threshold_bytes=$((per_user_maxbytes - 1000)) - new_limit_keys=$((per_user_maxkeys * 2)) - new_limit_bytes=$((per_user_maxbytes * 2)) + # Calculate thresholds and suggested new limits + threshold_keys=$((per_user_maxkeys - 100)) + threshold_bytes=$((per_user_maxbytes - 1000)) + new_limit_keys=$((per_user_maxkeys * 2)) + new_limit_bytes=$((per_user_maxbytes * 2)) - # Check if key or byte usage is near limits - failure=0 - if [[ "$used_lxc_keys" -gt "$threshold_keys" ]]; then - echo -e "${CROSS}${RD} Warning: Key usage is near the limit (${used_lxc_keys}/${per_user_maxkeys}).${CL}" - echo -e "${INFO} Suggested action: Set ${GN}kernel.keys.maxkeys=${new_limit_keys}${CL} in ${BOLD}/etc/sysctl.d/98-community-scripts.conf${CL}." - failure=1 - fi - if [[ "$used_lxc_bytes" -gt "$threshold_bytes" ]]; then - echo -e "${CROSS}${RD} Warning: Key byte usage is near the limit (${used_lxc_bytes}/${per_user_maxbytes}).${CL}" - echo -e "${INFO} Suggested action: Set ${GN}kernel.keys.maxbytes=${new_limit_bytes}${CL} in ${BOLD}/etc/sysctl.d/98-community-scripts.conf${CL}." - failure=1 - fi + # Check if key or byte usage is near limits + failure=0 + if [[ "$used_lxc_keys" -gt "$threshold_keys" ]]; then + echo -e "${CROSS}${RD} Warning: Key usage is near the limit (${used_lxc_keys}/${per_user_maxkeys}).${CL}" + echo -e "${INFO} Suggested action: Set ${GN}kernel.keys.maxkeys=${new_limit_keys}${CL} in ${BOLD}/etc/sysctl.d/98-community-scripts.conf${CL}." + failure=1 + fi + if [[ "$used_lxc_bytes" -gt "$threshold_bytes" ]]; then + echo -e "${CROSS}${RD} Warning: Key byte usage is near the limit (${used_lxc_bytes}/${per_user_maxbytes}).${CL}" + echo -e "${INFO} Suggested action: Set ${GN}kernel.keys.maxbytes=${new_limit_bytes}${CL} in ${BOLD}/etc/sysctl.d/98-community-scripts.conf${CL}." + failure=1 + fi - # Provide next steps if issues are detected - if [[ "$failure" -eq 1 ]]; then - echo -e "${INFO} To apply changes, run: ${BOLD}service procps force-reload${CL}" - exit 1 - fi + # Provide next steps if issues are detected + if [[ "$failure" -eq 1 ]]; then + echo -e "${INFO} To apply changes, run: ${BOLD}service procps force-reload${CL}" + exit 1 + fi - echo -e "${CM}${GN} All kernel key limits are within safe thresholds.${CL}" + echo -e "${CM}${GN} All kernel key limits are within safe thresholds.${CL}" } # This function checks the system architecture and exits if it's not "amd64". arch_check() { - if [ "$(dpkg --print-architecture)" != "amd64" ]; then - echo -e "\n ${INFO}${YWB}This script will not work with PiMox! \n" - echo -e "\n ${YWB}Visit https://github.com/asylumexp/Proxmox for ARM64 support. \n" - echo -e "Exiting..." - sleep 2 - exit - fi + if [ "$(dpkg --print-architecture)" != "amd64" ]; then + echo -e "\n ${INFO}${YWB}This script will not work with PiMox! \n" + echo -e "\n ${YWB}Visit https://github.com/asylumexp/Proxmox for ARM64 support. \n" + echo -e "Exiting..." + sleep 2 + exit + fi } # Function to get the current IP address based on the distribution get_current_ip() { - if [ -f /etc/os-release ]; then - # Check for Debian/Ubuntu (uses hostname -I) - if grep -qE 'ID=debian|ID=ubuntu' /etc/os-release; then - CURRENT_IP=$(hostname -I | awk '{print $1}') - # Check for Alpine (uses ip command) - elif grep -q 'ID=alpine' /etc/os-release; then - CURRENT_IP=$(ip -4 addr show eth0 | awk '/inet / {print $2}' | cut -d/ -f1 | head -n 1) - else - CURRENT_IP="Unknown" + if [ -f /etc/os-release ]; then + # Check for Debian/Ubuntu (uses hostname -I) + if grep -qE 'ID=debian|ID=ubuntu' /etc/os-release; then + CURRENT_IP=$(hostname -I | awk '{print $1}') + # Check for Alpine (uses ip command) + elif grep -q 'ID=alpine' /etc/os-release; then + CURRENT_IP=$(ip -4 addr show eth0 | awk '/inet / {print $2}' | cut -d/ -f1 | head -n 1) + else + CURRENT_IP="Unknown" + fi fi - fi - echo "$CURRENT_IP" + echo "$CURRENT_IP" } # Function to update the IP address in the MOTD file update_motd_ip() { - MOTD_FILE="/etc/motd" + MOTD_FILE="/etc/motd" - if [ -f "$MOTD_FILE" ]; then - # Remove existing IP Address lines to prevent duplication - sed -i '/IP Address:/d' "$MOTD_FILE" + if [ -f "$MOTD_FILE" ]; then + # Remove existing IP Address lines to prevent duplication + sed -i '/IP Address:/d' "$MOTD_FILE" - IP=$(get_current_ip) - # Add the new IP address - echo -e "${TAB}${NETWORK}${YW} IP Address: ${GN}${IP}${CL}" >>"$MOTD_FILE" - fi + IP=$(get_current_ip) + # Add the new IP address + echo -e "${TAB}${NETWORK}${YW} IP Address: ${GN}${IP}${CL}" >>"$MOTD_FILE" + fi } # Function to download & save header files get_header() { - local app_name=$(echo ${APP,,} | tr -d ' ') - local header_url="https://github.com/community-scripts/ProxmoxVED/raw/main/ct/headers/${app_name}" - local local_header_path="/usr/local/community-scripts/headers/${app_name}" + local app_name=$(echo ${APP,,} | tr -d ' ') + local header_url="https://github.com/community-scripts/ProxmoxVED/raw/main/ct/headers/${app_name}" + local local_header_path="/usr/local/community-scripts/headers/${app_name}" - mkdir -p "/usr/local/community-scripts/headers" + mkdir -p "/usr/local/community-scripts/headers" - # Check if local file already present - if [ ! -f "$local_header_path" ]; then - wget -qO "$local_header_path" "$header_url" - if [ $? -ne 0 ]; then - echo -e "${WARN}${BOLD}${YLW}Failed to download header for ${app_name}. No header will be displayed.${CL}" - return 1 + # Check if local file already present + if [ ! -f "$local_header_path" ]; then + wget -qO "$local_header_path" "$header_url" + if [ $? -ne 0 ]; then + echo -e "${WARN}${BOLD}${YLW}Failed to download header for ${app_name}. No header will be displayed.${CL}" + return 1 + fi fi - fi - cat "$local_header_path" + cat "$local_header_path" } # This function sets the APP-Name into an ASCII Header in Slant, figlet needed on proxmox main node. header_info() { - local app_name=$(echo ${APP,,} | tr -d ' ') - local header_content + local app_name=$(echo ${APP,,} | tr -d ' ') + local header_content - # Download & save Header-File locally - header_content=$(get_header "$app_name") - if [ $? -ne 0 ]; then - # Fallback: Doesn't show Header - return 0 - fi + # Download & save Header-File locally + header_content=$(get_header "$app_name") + if [ $? -ne 0 ]; then + # Fallback: Doesn't show Header + return 0 + fi - # Show ASCII-Header - term_width=$(tput cols 2>/dev/null || echo 120) - clear - echo "$header_content" + # Show ASCII-Header + term_width=$(tput cols 2>/dev/null || echo 120) + clear + echo "$header_content" } # This function checks if the script is running through SSH and prompts the user to confirm if they want to proceed or exit. ssh_check() { - if [ -n "${SSH_CLIENT:+x}" ]; then - if whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "SSH DETECTED" --yesno "It's advisable to utilize the Proxmox shell rather than SSH, as there may be potential complications with variable retrieval. Proceed using SSH?" 10 72; then - whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox --title "Proceed using SSH" "You've chosen to proceed using SSH. If any issues arise, please run the script in the Proxmox shell before creating a repository issue." 10 72 - else - clear - echo "Exiting due to SSH usage. Please consider using the Proxmox shell." - exit + if [ -n "${SSH_CLIENT:+x}" ]; then + if whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "SSH DETECTED" --yesno "It's advisable to utilize the Proxmox shell rather than SSH, as there may be potential complications with variable retrieval. Proceed using SSH?" 10 72; then + whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox --title "Proceed using SSH" "You've chosen to proceed using SSH. If any issues arise, please run the script in the Proxmox shell before creating a repository issue." 10 72 + else + clear + echo "Exiting due to SSH usage. Please consider using the Proxmox shell." + exit + fi fi - fi } base_settings() { - # Default Settings - CT_TYPE="1" - DISK_SIZE="4" - CORE_COUNT="1" - RAM_SIZE="1024" - VERBOSE="${1:-no}" - PW="" - CT_ID=$NEXTID - HN=$NSAPP - BRG="vmbr0" - NET="dhcp" - IPv6="dhcp" - IPv6GW="" - GATE="" - APT_CACHER="" - APT_CACHER_IP="" - DISABLEIP6="no" - MTU="" - SD="" - NS="" - MAC="" - VLAN="" - SSH="no" - SSH_AUTHORIZED_KEY="" - TAGS="community-script-dev;" + # Default Settings + CT_TYPE="1" + DISK_SIZE="4" + CORE_COUNT="1" + RAM_SIZE="1024" + VERBOSE="${1:-no}" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + BRG="vmbr0" + NET="dhcp" + IPv6="dhcp" + IPv6GW="" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + SSH_AUTHORIZED_KEY="" + TAGS="community-script-dev;" - # Override default settings with variables from ct script - CT_TYPE=${var_unprivileged:-$CT_TYPE} - DISK_SIZE=${var_disk:-$DISK_SIZE} - CORE_COUNT=${var_cpu:-$CORE_COUNT} - RAM_SIZE=${var_ram:-$RAM_SIZE} - VERB=${var_verbose:-$VERBOSE} - TAGS="${TAGS}${var_tags:-}" + # Override default settings with variables from ct script + CT_TYPE=${var_unprivileged:-$CT_TYPE} + DISK_SIZE=${var_disk:-$DISK_SIZE} + CORE_COUNT=${var_cpu:-$CORE_COUNT} + RAM_SIZE=${var_ram:-$RAM_SIZE} + VERB=${var_verbose:-$VERBOSE} + TAGS="${TAGS}${var_tags:-}" - # Since these 2 are only defined outside of default_settings function, we add a temporary fallback. TODO: To align everything, we should add these as constant variables (e.g. OSTYPE and OSVERSION), but that would currently require updating the default_settings function for all existing scripts - if [ -z "$var_os" ]; then - var_os="debian" - fi - if [ -z "$var_version" ]; then - var_version="12" - fi + # Since these 2 are only defined outside of default_settings function, we add a temporary fallback. TODO: To align everything, we should add these as constant variables (e.g. OSTYPE and OSVERSION), but that would currently require updating the default_settings function for all existing scripts + if [ -z "$var_os" ]; then + var_os="debian" + fi + if [ -z "$var_version" ]; then + var_version="12" + fi } # This function displays the default values for various settings. echo_default() { - # Convert CT_TYPE to description - CT_TYPE_DESC="Unprivileged" - if [ "$CT_TYPE" -eq 0 ]; then - CT_TYPE_DESC="Privileged" - fi + # Convert CT_TYPE to description + CT_TYPE_DESC="Unprivileged" + if [ "$CT_TYPE" -eq 0 ]; then + CT_TYPE_DESC="Privileged" + fi - # Output the selected values with icons - echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os${CL}" - echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}" - echo -e "${CONTAINERTYPE}${BOLD}${DGN}Container Type: ${BGN}$CT_TYPE_DESC${CL}" - echo -e "${DISKSIZE}${BOLD}${DGN}Disk Size: ${BGN}${DISK_SIZE} GB${CL}" - echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}${CORE_COUNT}${CL}" - echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}${RAM_SIZE} MiB${CL}" - echo -e "${CONTAINERID}${BOLD}${DGN}Container ID: ${BGN}${CT_ID}${CL}" - if [ "$VERB" == "yes" ]; then - echo -e "${SEARCH}${BOLD}${DGN}Verbose Mode: ${BGN}Enabled${CL}" - fi - echo -e "${CREATING}${BOLD}${BL}Creating a ${APP} LXC using the above default settings${CL}" - echo -e " " + # Output the selected values with icons + echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os${CL}" + echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}" + echo -e "${CONTAINERTYPE}${BOLD}${DGN}Container Type: ${BGN}$CT_TYPE_DESC${CL}" + echo -e "${DISKSIZE}${BOLD}${DGN}Disk Size: ${BGN}${DISK_SIZE} GB${CL}" + echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}${CORE_COUNT}${CL}" + echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}${RAM_SIZE} MiB${CL}" + echo -e "${CONTAINERID}${BOLD}${DGN}Container ID: ${BGN}${CT_ID}${CL}" + if [ "$VERB" == "yes" ]; then + echo -e "${SEARCH}${BOLD}${DGN}Verbose Mode: ${BGN}Enabled${CL}" + fi + echo -e "${CREATING}${BOLD}${BL}Creating a ${APP} LXC using the above default settings${CL}" + echo -e " " } # This function is called when the user decides to exit the script. It clears the screen and displays an exit message. exit_script() { - clear - echo -e "\n${CROSS}${RD}User exited script${CL}\n" - exit + clear + echo -e "\n${CROSS}${RD}User exited script${CL}\n" + exit } # This function allows the user to configure advanced settings for the script. advanced_settings() { - whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox --title "Here is an instructional tip:" "To make a selection, use the Spacebar." 8 58 - whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox --title "Default distribution for $APP" "Default is: ${var_os} ${var_version} \n \nIf the default Linux distribution is not adhered to, script support will be discontinued. \n" 10 58 - if [ "$var_os" != "alpine" ]; then - var_default_os="${var_os}" - var_os="" - while [ -z "$var_os" ]; do - if [ "$var_default_os" == "debian" ]; then - if var_os=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DISTRIBUTION" --radiolist "Choose Distribution" 10 58 2 \ - "debian" "" ON \ - "ubuntu" "" OFF \ - 3>&1 1>&2 2>&3); then - if [ -n "$var_os" ]; then - echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os${CL}" - fi - else - exit_script - fi - fi - if [ "$var_default_os" == "ubuntu" ]; then - if var_os=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DISTRIBUTION" --radiolist "Choose Distribution" 10 58 2 \ - "debian" "" OFF \ - "ubuntu" "" ON \ - 3>&1 1>&2 2>&3); then - if [ -n "$var_os" ]; then - echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os${CL}" - fi - else - exit_script - fi - fi - done - fi - - if [ "$var_os" == "debian" ]; then - var_default_version="${var_version}" - var_version="" - while [ -z "$var_version" ]; do - if [ "$var_default_version" == "11" ]; then - if var_version=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ - "11" "Bullseye" ON \ - "12" "Bookworm" OFF \ - 3>&1 1>&2 2>&3); then - if [ -n "$var_version" ]; then - echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}" - fi - else - exit_script - fi - fi - if [ "$var_default_version" == "12" ]; then - if var_version=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ - "11" "Bullseye" OFF \ - "12" "Bookworm" ON \ - 3>&1 1>&2 2>&3); then - if [ -n "$var_version" ]; then - echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}" - fi - else - exit_script - fi - fi - done - fi - - if [ "$var_os" == "ubuntu" ]; then - var_default_version="${var_version}" - var_version="" - while [ -z "$var_version" ]; do - if [ "$var_default_version" == "20.04" ]; then - if var_version=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \ - "20.04" "Focal" ON \ - "22.04" "Jammy" OFF \ - "24.04" "Noble" OFF \ - "24.10" "Oracular" OFF \ - 3>&1 1>&2 2>&3); then - if [ -n "$var_version" ]; then - echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}" - fi - else - exit_script - fi - elif [ "$var_default_version" == "22.04" ]; then - if var_version=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \ - "20.04" "Focal" OFF \ - "22.04" "Jammy" ON \ - "24.04" "Noble" OFF \ - "24.10" "Oracular" OFF \ - 3>&1 1>&2 2>&3); then - if [ -n "$var_version" ]; then - echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}" - fi - else - exit_script - fi - elif [ "$var_default_version" == "24.04" ]; then - if var_version=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \ - "20.04" "Focal" OFF \ - "22.04" "Jammy" OFF \ - "24.04" "Noble" ON \ - "24.10" "Oracular" OFF \ - 3>&1 1>&2 2>&3); then - if [ -n "$var_version" ]; then - echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}" - fi - else - exit_script - fi - else - if var_version=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \ - "20.04" "Focal" OFF \ - "22.04" "Jammy" OFF \ - "24.04" "Noble" OFF \ - "24.10" "Oracular" ON \ - 3>&1 1>&2 2>&3); then - if [ -n "$var_version" ]; then - echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}" - fi - else - exit_script - fi - fi - done - fi - # Setting Default Tag for Advanced Settings - TAGS="community-script-dev;${var_tags:-}" - CT_DEFAULT_TYPE="${CT_TYPE}" - CT_TYPE="" - while [ -z "$CT_TYPE" ]; do - if [ "$CT_DEFAULT_TYPE" == "1" ]; then - if CT_TYPE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "CONTAINER TYPE" --radiolist "Choose Type" 10 58 2 \ - "1" "Unprivileged" ON \ - "0" "Privileged" OFF \ - 3>&1 1>&2 2>&3); then - if [ -n "$CT_TYPE" ]; then - CT_TYPE_DESC="Unprivileged" - if [ "$CT_TYPE" -eq 0 ]; then - CT_TYPE_DESC="Privileged" - fi - echo -e "${CONTAINERTYPE}${BOLD}${DGN}Container Type: ${BGN}$CT_TYPE_DESC${CL}" - fi - else - exit_script - fi - fi - if [ "$CT_DEFAULT_TYPE" == "0" ]; then - if CT_TYPE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "CONTAINER TYPE" --radiolist "Choose Type" 10 58 2 \ - "1" "Unprivileged" OFF \ - "0" "Privileged" ON \ - 3>&1 1>&2 2>&3); then - if [ -n "$CT_TYPE" ]; then - CT_TYPE_DESC="Unprivileged" - if [ "$CT_TYPE" -eq 0 ]; then - CT_TYPE_DESC="Privileged" - fi - echo -e "${CONTAINERTYPE}${BOLD}${DGN}Container Type: ${BGN}$CT_TYPE_DESC${CL}" - fi - else - exit_script - fi - fi - done - - while true; do - if PW1=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --passwordbox "\nSet Root Password (needed for root ssh access)" 9 58 --title "PASSWORD (leave blank for automatic login)" 3>&1 1>&2 2>&3); then - if [[ ! -z "$PW1" ]]; then - if [[ "$PW1" == *" "* ]]; then - whiptail --msgbox "Password cannot contain spaces. Please try again." 8 58 - elif [ ${#PW1} -lt 5 ]; then - whiptail --msgbox "Password must be at least 5 characters long. Please try again." 8 58 - else - if PW2=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --passwordbox "\nVerify Root Password" 9 58 --title "PASSWORD VERIFICATION" 3>&1 1>&2 2>&3); then - if [[ "$PW1" == "$PW2" ]]; then - PW="-password $PW1" - echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}********${CL}" - break - else - whiptail --msgbox "Passwords do not match. Please try again." 8 58 + whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox --title "Here is an instructional tip:" "To make a selection, use the Spacebar." 8 58 + whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox --title "Default distribution for $APP" "Default is: ${var_os} ${var_version} \n \nIf the default Linux distribution is not adhered to, script support will be discontinued. \n" 10 58 + if [ "$var_os" != "alpine" ]; then + var_default_os="${var_os}" + var_os="" + while [ -z "$var_os" ]; do + if [ "$var_default_os" == "debian" ]; then + if var_os=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DISTRIBUTION" --radiolist "Choose Distribution" 10 58 2 \ + "debian" "" ON \ + "ubuntu" "" OFF \ + 3>&1 1>&2 2>&3); then + if [ -n "$var_os" ]; then + echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os${CL}" + fi + else + exit_script + fi + fi + if [ "$var_default_os" == "ubuntu" ]; then + if var_os=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DISTRIBUTION" --radiolist "Choose Distribution" 10 58 2 \ + "debian" "" OFF \ + "ubuntu" "" ON \ + 3>&1 1>&2 2>&3); then + if [ -n "$var_os" ]; then + echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os${CL}" + fi + else + exit_script + fi + fi + done + fi + + if [ "$var_os" == "debian" ]; then + var_default_version="${var_version}" + var_version="" + while [ -z "$var_version" ]; do + if [ "$var_default_version" == "11" ]; then + if var_version=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ + "11" "Bullseye" ON \ + "12" "Bookworm" OFF \ + 3>&1 1>&2 2>&3); then + if [ -n "$var_version" ]; then + echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}" + fi + else + exit_script + fi + fi + if [ "$var_default_version" == "12" ]; then + if var_version=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ + "11" "Bullseye" OFF \ + "12" "Bookworm" ON \ + 3>&1 1>&2 2>&3); then + if [ -n "$var_version" ]; then + echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}" + fi + else + exit_script + fi + fi + done + fi + + if [ "$var_os" == "ubuntu" ]; then + var_default_version="${var_version}" + var_version="" + while [ -z "$var_version" ]; do + if [ "$var_default_version" == "20.04" ]; then + if var_version=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \ + "20.04" "Focal" ON \ + "22.04" "Jammy" OFF \ + "24.04" "Noble" OFF \ + "24.10" "Oracular" OFF \ + 3>&1 1>&2 2>&3); then + if [ -n "$var_version" ]; then + echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}" + fi + else + exit_script + fi + elif [ "$var_default_version" == "22.04" ]; then + if var_version=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \ + "20.04" "Focal" OFF \ + "22.04" "Jammy" ON \ + "24.04" "Noble" OFF \ + "24.10" "Oracular" OFF \ + 3>&1 1>&2 2>&3); then + if [ -n "$var_version" ]; then + echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}" + fi + else + exit_script + fi + elif [ "$var_default_version" == "24.04" ]; then + if var_version=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \ + "20.04" "Focal" OFF \ + "22.04" "Jammy" OFF \ + "24.04" "Noble" ON \ + "24.10" "Oracular" OFF \ + 3>&1 1>&2 2>&3); then + if [ -n "$var_version" ]; then + echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}" + fi + else + exit_script + fi + else + if var_version=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \ + "20.04" "Focal" OFF \ + "22.04" "Jammy" OFF \ + "24.04" "Noble" OFF \ + "24.10" "Oracular" ON \ + 3>&1 1>&2 2>&3); then + if [ -n "$var_version" ]; then + echo -e "${OSVERSION}${BOLD}${DGN}Version: ${BGN}$var_version${CL}" + fi + else + exit_script + fi + fi + done + fi + # Setting Default Tag for Advanced Settings + TAGS="community-script-dev;${var_tags:-}" + CT_DEFAULT_TYPE="${CT_TYPE}" + CT_TYPE="" + while [ -z "$CT_TYPE" ]; do + if [ "$CT_DEFAULT_TYPE" == "1" ]; then + if CT_TYPE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "CONTAINER TYPE" --radiolist "Choose Type" 10 58 2 \ + "1" "Unprivileged" ON \ + "0" "Privileged" OFF \ + 3>&1 1>&2 2>&3); then + if [ -n "$CT_TYPE" ]; then + CT_TYPE_DESC="Unprivileged" + if [ "$CT_TYPE" -eq 0 ]; then + CT_TYPE_DESC="Privileged" + fi + echo -e "${CONTAINERTYPE}${BOLD}${DGN}Container Type: ${BGN}$CT_TYPE_DESC${CL}" + fi + else + exit_script fi - else - exit_script - fi fi - else - PW1="Automatic Login" - PW="" - echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}$PW1${CL}" - break - fi - else - exit_script - fi - done - - if CT_ID=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 3>&1 1>&2 2>&3); then - if [ -z "$CT_ID" ]; then - CT_ID="$NEXTID" - echo -e "${CONTAINERID}${BOLD}${DGN}Container ID: ${BGN}$CT_ID${CL}" - else - echo -e "${CONTAINERID}${BOLD}${DGN}Container ID: ${BGN}$CT_ID${CL}" - fi - else - exit - fi - - if CT_NAME=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3); then - if [ -z "$CT_NAME" ]; then - HN="$NSAPP" - else - HN=$(echo ${CT_NAME,,} | tr -d ' ') - fi - echo -e "${HOSTNAME}${BOLD}${DGN}Hostname: ${BGN}$HN${CL}" - else - exit_script - fi - - if DISK_SIZE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 3>&1 1>&2 2>&3); then - if [ -z "$DISK_SIZE" ]; then - DISK_SIZE="$var_disk" - echo -e "${DISKSIZE}${BOLD}${DGN}Disk Size: ${BGN}${DISK_SIZE} GB${CL}" - else - if ! [[ $DISK_SIZE =~ $INTEGER ]]; then - echo -e "{INFO}${HOLD}${RD} DISK SIZE MUST BE AN INTEGER NUMBER!${CL}" - advanced_settings - fi - echo -e "${DISKSIZE}${BOLD}${DGN}Disk Size: ${BGN}${DISK_SIZE} GB${CL}" - fi - else - exit_script - fi - - if CORE_COUNT=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 3>&1 1>&2 2>&3); then - if [ -z "$CORE_COUNT" ]; then - CORE_COUNT="$var_cpu" - echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}$CORE_COUNT${CL}" - else - echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}$CORE_COUNT${CL}" - fi - else - exit_script - fi - - if RAM_SIZE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3); then - if [ -z "$RAM_SIZE" ]; then - RAM_SIZE="$var_ram" - echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}${RAM_SIZE} MiB${CL}" - else - echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}${RAM_SIZE} MiB${CL}" - fi - else - exit_script - fi - - if BRG=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3); then - if [ -z "$BRG" ]; then - BRG="vmbr0" - echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}" - else - echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}" - fi - else - exit_script - fi - - while true; do - NET=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set a Static IPv4 CIDR Address (/24)" 8 58 dhcp --title "IP ADDRESS" 3>&1 1>&2 2>&3) - exit_status=$? - if [ $exit_status -eq 0 ]; then - if [ "$NET" = "dhcp" ]; then - echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}$NET${CL}" - break - else - if [[ "$NET" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}/([0-9]|[1-2][0-9]|3[0-2])$ ]]; then - echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}$NET${CL}" - break - else - whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox "$NET is an invalid IPv4 CIDR address. Please enter a valid IPv4 CIDR address or 'dhcp'" 8 58 + if [ "$CT_DEFAULT_TYPE" == "0" ]; then + if CT_TYPE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "CONTAINER TYPE" --radiolist "Choose Type" 10 58 2 \ + "1" "Unprivileged" OFF \ + "0" "Privileged" ON \ + 3>&1 1>&2 2>&3); then + if [ -n "$CT_TYPE" ]; then + CT_TYPE_DESC="Unprivileged" + if [ "$CT_TYPE" -eq 0 ]; then + CT_TYPE_DESC="Privileged" + fi + echo -e "${CONTAINERTYPE}${BOLD}${DGN}Container Type: ${BGN}$CT_TYPE_DESC${CL}" + fi + else + exit_script + fi fi - fi - else - exit_script - fi - done - - if [ "$NET" != "dhcp" ]; then - while true; do - GATE1=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Enter gateway IP address" 8 58 --title "Gateway IP" 3>&1 1>&2 2>&3) - if [ -z "$GATE1" ]; then - whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox "Gateway IP address cannot be empty" 8 58 - elif [[ ! "$GATE1" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then - whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox "Invalid IP address format" 8 58 - else - GATE=",gw=$GATE1" - echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}$GATE1${CL}" - break - fi done - else - GATE="" - echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}Default${CL}" - fi - if [ "$var_os" == "alpine" ]; then - APT_CACHER="" - APT_CACHER_IP="" - else - if APT_CACHER_IP=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set APT-Cacher IP (leave blank for none)" 8 58 --title "APT-Cacher IP" 3>&1 1>&2 2>&3); then - APT_CACHER="${APT_CACHER_IP:+yes}" - echo -e "${NETWORK}${BOLD}${DGN}APT-Cacher IP Address: ${BGN}${APT_CACHER_IP:-Default}${CL}" + while true; do + if PW1=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --passwordbox "\nSet Root Password (needed for root ssh access)" 9 58 --title "PASSWORD (leave blank for automatic login)" 3>&1 1>&2 2>&3); then + if [[ ! -z "$PW1" ]]; then + if [[ "$PW1" == *" "* ]]; then + whiptail --msgbox "Password cannot contain spaces. Please try again." 8 58 + elif [ ${#PW1} -lt 5 ]; then + whiptail --msgbox "Password must be at least 5 characters long. Please try again." 8 58 + else + if PW2=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --passwordbox "\nVerify Root Password" 9 58 --title "PASSWORD VERIFICATION" 3>&1 1>&2 2>&3); then + if [[ "$PW1" == "$PW2" ]]; then + PW="-password $PW1" + echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}********${CL}" + break + else + whiptail --msgbox "Passwords do not match. Please try again." 8 58 + fi + else + exit_script + fi + fi + else + PW1="Automatic Login" + PW="" + echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}$PW1${CL}" + break + fi + else + exit_script + fi + done + + if CT_ID=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 3>&1 1>&2 2>&3); then + if [ -z "$CT_ID" ]; then + CT_ID="$NEXTID" + echo -e "${CONTAINERID}${BOLD}${DGN}Container ID: ${BGN}$CT_ID${CL}" + else + echo -e "${CONTAINERID}${BOLD}${DGN}Container ID: ${BGN}$CT_ID${CL}" + fi else - exit_script + exit fi - fi - if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "IPv6" --yesno "Disable IPv6?" 10 58); then - DISABLEIP6="yes" - else - DISABLEIP6="no" - fi - echo -e "${DISABLEIPV6}${BOLD}${DGN}Disable IPv6: ${BGN}$DISABLEIP6${CL}" - - if MTU1=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set Interface MTU Size (leave blank for default [1500])" 8 58 --title "MTU SIZE" 3>&1 1>&2 2>&3); then - if [ -z $MTU1 ]; then - MTU1="Default" - MTU="" + if CT_NAME=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3); then + if [ -z "$CT_NAME" ]; then + HN="$NSAPP" + else + HN=$(echo ${CT_NAME,,} | tr -d ' ') + fi + echo -e "${HOSTNAME}${BOLD}${DGN}Hostname: ${BGN}$HN${CL}" else - MTU=",mtu=$MTU1" + exit_script fi - echo -e "${DEFAULT}${BOLD}${DGN}Interface MTU Size: ${BGN}$MTU1${CL}" - else - exit_script - fi - if SD=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set a DNS Search Domain (leave blank for HOST)" 8 58 --title "DNS Search Domain" 3>&1 1>&2 2>&3); then - if [ -z $SD ]; then - SX=Host - SD="" + if DISK_SIZE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 3>&1 1>&2 2>&3); then + if [ -z "$DISK_SIZE" ]; then + DISK_SIZE="$var_disk" + echo -e "${DISKSIZE}${BOLD}${DGN}Disk Size: ${BGN}${DISK_SIZE} GB${CL}" + else + if ! [[ $DISK_SIZE =~ $INTEGER ]]; then + echo -e "{INFO}${HOLD}${RD} DISK SIZE MUST BE AN INTEGER NUMBER!${CL}" + advanced_settings + fi + echo -e "${DISKSIZE}${BOLD}${DGN}Disk Size: ${BGN}${DISK_SIZE} GB${CL}" + fi else - SX=$SD - SD="-searchdomain=$SD" + exit_script fi - echo -e "${SEARCH}${BOLD}${DGN}DNS Search Domain: ${BGN}$SX${CL}" - else - exit_script - fi - if NX=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set a DNS Server IP (leave blank for HOST)" 8 58 --title "DNS SERVER IP" 3>&1 1>&2 2>&3); then - if [ -z $NX ]; then - NX=Host - NS="" + if CORE_COUNT=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 3>&1 1>&2 2>&3); then + if [ -z "$CORE_COUNT" ]; then + CORE_COUNT="$var_cpu" + echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}$CORE_COUNT${CL}" + else + echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}$CORE_COUNT${CL}" + fi else - NS="-nameserver=$NX" + exit_script fi - echo -e "${NETWORK}${BOLD}${DGN}DNS Server IP Address: ${BGN}$NX${CL}" - else - exit_script - fi - if MAC1=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set a MAC Address(leave blank for generated MAC)" 8 58 --title "MAC ADDRESS" 3>&1 1>&2 2>&3); then - if [ -z $MAC1 ]; then - MAC1="Default" - MAC="" + if RAM_SIZE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3); then + if [ -z "$RAM_SIZE" ]; then + RAM_SIZE="$var_ram" + echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}${RAM_SIZE} MiB${CL}" + else + echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}${RAM_SIZE} MiB${CL}" + fi else - MAC=",hwaddr=$MAC1" - echo -e "${MACADDRESS}${BOLD}${DGN}MAC Address: ${BGN}$MAC1${CL}" + exit_script fi - else - exit_script - fi - if VLAN1=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set a Vlan(leave blank for no VLAN)" 8 58 --title "VLAN" 3>&1 1>&2 2>&3); then - if [ -z $VLAN1 ]; then - VLAN1="Default" - VLAN="" + if BRG=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3); then + if [ -z "$BRG" ]; then + BRG="vmbr0" + echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}" + else + echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}" + fi else - VLAN=",tag=$VLAN1" + exit_script fi - echo -e "${VLANTAG}${BOLD}${DGN}Vlan: ${BGN}$VLAN1${CL}" - else - exit_script - fi - if ADV_TAGS=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set Custom Tags?[If you remove all, there will be no tags!]" 8 58 ${TAGS} --title "Advanced Tags" 3>&1 1>&2 2>&3); then - if [ -n "${ADV_TAGS}" ]; then - ADV_TAGS=$(echo "$ADV_TAGS" | tr -d '[:space:]') - TAGS="${ADV_TAGS}" + while true; do + NET=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set a Static IPv4 CIDR Address (/24)" 8 58 dhcp --title "IP ADDRESS" 3>&1 1>&2 2>&3) + exit_status=$? + if [ $exit_status -eq 0 ]; then + if [ "$NET" = "dhcp" ]; then + echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}$NET${CL}" + break + else + if [[ "$NET" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}/([0-9]|[1-2][0-9]|3[0-2])$ ]]; then + echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}$NET${CL}" + break + else + whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox "$NET is an invalid IPv4 CIDR address. Please enter a valid IPv4 CIDR address or 'dhcp'" 8 58 + fi + fi + else + exit_script + fi + done + + if [ "$NET" != "dhcp" ]; then + while true; do + GATE1=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Enter gateway IP address" 8 58 --title "Gateway IP" 3>&1 1>&2 2>&3) + if [ -z "$GATE1" ]; then + whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox "Gateway IP address cannot be empty" 8 58 + elif [[ ! "$GATE1" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then + whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --msgbox "Invalid IP address format" 8 58 + else + GATE=",gw=$GATE1" + echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}$GATE1${CL}" + break + fi + done else - TAGS=";" + GATE="" + echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}Default${CL}" fi - echo -e "${NETWORK}${BOLD}${DGN}Tags: ${BGN}$TAGS${CL}" - else - exit_script - fi - if [[ "$PW" == -password* ]]; then - if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "SSH ACCESS" --yesno "Enable Root SSH Access?" 10 58); then - SSH="yes" + if [ "$var_os" == "alpine" ]; then + APT_CACHER="" + APT_CACHER_IP="" else - SSH="no" + if APT_CACHER_IP=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set APT-Cacher IP (leave blank for none)" 8 58 --title "APT-Cacher IP" 3>&1 1>&2 2>&3); then + APT_CACHER="${APT_CACHER_IP:+yes}" + echo -e "${NETWORK}${BOLD}${DGN}APT-Cacher IP Address: ${BGN}${APT_CACHER_IP:-Default}${CL}" + else + exit_script + fi fi - echo -e "${ROOTSSH}${BOLD}${DGN}Root SSH Access: ${BGN}$SSH${CL}" - else - SSH="no" - echo -e "${ROOTSSH}${BOLD}${DGN}Root SSH Access: ${BGN}$SSH${CL}" - fi - if [[ "${SSH}" == "yes" ]]; then - SSH_AUTHORIZED_KEY="$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "SSH Authorized key for root (leave empty for none)" 8 58 --title "SSH Key" 3>&1 1>&2 2>&3)" - - if [[ -z "${SSH_AUTHORIZED_KEY}" ]]; then - echo "Warning: No SSH key provided." + if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "IPv6" --yesno "Disable IPv6?" 10 58); then + DISABLEIP6="yes" + else + DISABLEIP6="no" fi - else - SSH_AUTHORIZED_KEY="" - fi - if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then - VERB="yes" - else - VERB="no" - fi - echo -e "${SEARCH}${BOLD}${DGN}Verbose Mode: ${BGN}$VERB${CL}" + echo -e "${DISABLEIPV6}${BOLD}${DGN}Disable IPv6: ${BGN}$DISABLEIP6${CL}" - if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 10 58); then - echo -e "${CREATING}${BOLD}${RD}Creating a ${APP} LXC using the above advanced settings${CL}" - else - clear - header_info - echo -e "${ADVANCED}${BOLD}${RD}Using Advanced Settings on node $PVEHOST_NAME${CL}" - advanced_settings - fi + if MTU1=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set Interface MTU Size (leave blank for default [1500])" 8 58 --title "MTU SIZE" 3>&1 1>&2 2>&3); then + if [ -z $MTU1 ]; then + MTU1="Default" + MTU="" + else + MTU=",mtu=$MTU1" + fi + echo -e "${DEFAULT}${BOLD}${DGN}Interface MTU Size: ${BGN}$MTU1${CL}" + else + exit_script + fi + + if SD=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set a DNS Search Domain (leave blank for HOST)" 8 58 --title "DNS Search Domain" 3>&1 1>&2 2>&3); then + if [ -z $SD ]; then + SX=Host + SD="" + else + SX=$SD + SD="-searchdomain=$SD" + fi + echo -e "${SEARCH}${BOLD}${DGN}DNS Search Domain: ${BGN}$SX${CL}" + else + exit_script + fi + + if NX=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set a DNS Server IP (leave blank for HOST)" 8 58 --title "DNS SERVER IP" 3>&1 1>&2 2>&3); then + if [ -z $NX ]; then + NX=Host + NS="" + else + NS="-nameserver=$NX" + fi + echo -e "${NETWORK}${BOLD}${DGN}DNS Server IP Address: ${BGN}$NX${CL}" + else + exit_script + fi + + if MAC1=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set a MAC Address(leave blank for generated MAC)" 8 58 --title "MAC ADDRESS" 3>&1 1>&2 2>&3); then + if [ -z $MAC1 ]; then + MAC1="Default" + MAC="" + else + MAC=",hwaddr=$MAC1" + echo -e "${MACADDRESS}${BOLD}${DGN}MAC Address: ${BGN}$MAC1${CL}" + fi + else + exit_script + fi + + if VLAN1=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set a Vlan(leave blank for no VLAN)" 8 58 --title "VLAN" 3>&1 1>&2 2>&3); then + if [ -z $VLAN1 ]; then + VLAN1="Default" + VLAN="" + else + VLAN=",tag=$VLAN1" + fi + echo -e "${VLANTAG}${BOLD}${DGN}Vlan: ${BGN}$VLAN1${CL}" + else + exit_script + fi + + if ADV_TAGS=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "Set Custom Tags?[If you remove all, there will be no tags!]" 8 58 ${TAGS} --title "Advanced Tags" 3>&1 1>&2 2>&3); then + if [ -n "${ADV_TAGS}" ]; then + ADV_TAGS=$(echo "$ADV_TAGS" | tr -d '[:space:]') + TAGS="${ADV_TAGS}" + else + TAGS=";" + fi + echo -e "${NETWORK}${BOLD}${DGN}Tags: ${BGN}$TAGS${CL}" + else + exit_script + fi + + if [[ "$PW" == -password* ]]; then + if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "SSH ACCESS" --yesno "Enable Root SSH Access?" 10 58); then + SSH="yes" + else + SSH="no" + fi + echo -e "${ROOTSSH}${BOLD}${DGN}Root SSH Access: ${BGN}$SSH${CL}" + else + SSH="no" + echo -e "${ROOTSSH}${BOLD}${DGN}Root SSH Access: ${BGN}$SSH${CL}" + fi + + if [[ "${SSH}" == "yes" ]]; then + SSH_AUTHORIZED_KEY="$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --inputbox "SSH Authorized key for root (leave empty for none)" 8 58 --title "SSH Key" 3>&1 1>&2 2>&3)" + + if [[ -z "${SSH_AUTHORIZED_KEY}" ]]; then + echo "Warning: No SSH key provided." + fi + else + SSH_AUTHORIZED_KEY="" + fi + if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then + VERB="yes" + else + VERB="no" + fi + echo -e "${SEARCH}${BOLD}${DGN}Verbose Mode: ${BGN}$VERB${CL}" + + if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 10 58); then + echo -e "${CREATING}${BOLD}${RD}Creating a ${APP} LXC using the above advanced settings${CL}" + else + clear + header_info + echo -e "${ADVANCED}${BOLD}${RD}Using Advanced Settings on node $PVEHOST_NAME${CL}" + advanced_settings + fi } diagnostics_check() { - if ! [ -d "/usr/local/community-scripts" ]; then - mkdir -p /usr/local/community-scripts - fi + if ! [ -d "/usr/local/community-scripts" ]; then + mkdir -p /usr/local/community-scripts + fi - if ! [ -f "/usr/local/community-scripts/diagnostics" ]; then - if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DIAGNOSTICS" --yesno "Send Diagnostics of LXC Installation?\n\n(This only transmits data without user data, just RAM, CPU, LXC name, ...)" 10 58); then - cat </usr/local/community-scripts/diagnostics + if ! [ -f "/usr/local/community-scripts/diagnostics" ]; then + if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DIAGNOSTICS" --yesno "Send Diagnostics of LXC Installation?\n\n(This only transmits data without user data, just RAM, CPU, LXC name, ...)" 10 58); then + cat </usr/local/community-scripts/diagnostics DIAGNOSTICS=yes #This file is used to store the diagnostics settings for the Community-Scripts API. @@ -860,9 +863,9 @@ DIAGNOSTICS=yes #"status" #If you have any concerns, please review the source code at /misc/build.func EOF - DIAGNOSTICS="yes" - else - cat </usr/local/community-scripts/diagnostics + DIAGNOSTICS="yes" + else + cat </usr/local/community-scripts/diagnostics DIAGNOSTICS=no #This file is used to store the diagnostics settings for the Community-Scripts API. @@ -887,225 +890,225 @@ DIAGNOSTICS=no #"status" #If you have any concerns, please review the source code at /misc/build.func EOF - DIAGNOSTICS="no" - fi - else - DIAGNOSTICS=$(awk -F '=' '/^DIAGNOSTICS/ {print $2}' /usr/local/community-scripts/diagnostics) + DIAGNOSTICS="no" + fi + else + DIAGNOSTICS=$(awk -F '=' '/^DIAGNOSTICS/ {print $2}' /usr/local/community-scripts/diagnostics) - fi + fi } install_script() { - pve_check - shell_check - root_check - arch_check - ssh_check - maxkeys_check - diagnostics_check + pve_check + shell_check + root_check + arch_check + ssh_check + maxkeys_check + diagnostics_check - if systemctl is-active -q ping-instances.service; then - systemctl -q stop ping-instances.service - fi - NEXTID=$(pvesh get /cluster/nextid) - timezone=$(cat /etc/timezone) - header_info - while true; do - - CHOICE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "SETTINGS" --menu "Choose an option:" \ - 12 50 5 \ - "1" "Default Settings" \ - "2" "Default Settings (with verbose)" \ - "3" "Advanced Settings" \ - "4" "Diagnostic Settings" \ - "5" "Exit" --nocancel --default-item "1" 3>&1 1>&2 2>&3) - - if [ $? -ne 0 ]; then - echo -e "${CROSS}${RD} Menu canceled. Exiting.${CL}" - exit 0 + if systemctl is-active -q ping-instances.service; then + systemctl -q stop ping-instances.service fi + NEXTID=$(pvesh get /cluster/nextid) + timezone=$(cat /etc/timezone) + header_info + while true; do - case $CHOICE in - 1) - header_info - echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings on node $PVEHOST_NAME${CL}" - VERB="no" - METHOD="default" - base_settings "$VERB" - echo_default - break - ;; - 2) - header_info - echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings on node $PVEHOST_NAME (${SEARCH}Verbose)${CL}" - VERB="yes" - METHOD="default" - base_settings "$VERB" - echo_default - break - ;; - 3) - header_info - echo -e "${ADVANCED}${BOLD}${RD}Using Advanced Settings on node $PVEHOST_NAME${CL}" - METHOD="advanced" - base_settings - advanced_settings - break - ;; - 4) - if [[ $DIAGNOSTICS == "yes" ]]; then - if whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DIAGNOSTICS SETTINGS" --yesno "Send Diagnostics of LXC Installation?\n\nCurrent setting: ${DIAGNOSTICS}" 10 58 \ - --yes-button "No" --no-button "Back"; then - DIAGNOSTICS="no" - sed -i 's/^DIAGNOSTICS=.*/DIAGNOSTICS=no/' /usr/local/community-scripts/diagnostics - whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DIAGNOSTICS SETTINGS" --msgbox "Diagnostics settings changed to ${DIAGNOSTICS}." 8 58 - fi - else - if whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DIAGNOSTICS SETTINGS" --yesno "Send Diagnostics of LXC Installation?\n\nCurrent setting: ${DIAGNOSTICS}" 10 58 \ - --yes-button "Yes" --no-button "Back"; then - DIAGNOSTICS="yes" - sed -i 's/^DIAGNOSTICS=.*/DIAGNOSTICS=yes/' /usr/local/community-scripts/diagnostics - whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DIAGNOSTICS SETTINGS" --msgbox "Diagnostics settings changed to ${DIAGNOSTICS}." 8 58 - fi - fi + CHOICE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "SETTINGS" --menu "Choose an option:" \ + 12 50 5 \ + "1" "Default Settings" \ + "2" "Default Settings (with verbose)" \ + "3" "Advanced Settings" \ + "4" "Diagnostic Settings" \ + "5" "Exit" --nocancel --default-item "1" 3>&1 1>&2 2>&3) - ;; - 5) - echo -e "${CROSS}${RD}Exiting.${CL}" - exit 0 - ;; - *) - echo -e "${CROSS}${RD}Invalid option, please try again.${CL}" - ;; - esac - done + if [ $? -ne 0 ]; then + echo -e "${CROSS}${RD} Menu canceled. Exiting.${CL}" + exit 0 + fi + + case $CHOICE in + 1) + header_info + echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings on node $PVEHOST_NAME${CL}" + VERB="no" + METHOD="default" + base_settings "$VERB" + echo_default + break + ;; + 2) + header_info + echo -e "${DEFAULT}${BOLD}${BL}Using Default Settings on node $PVEHOST_NAME (${SEARCH}Verbose)${CL}" + VERB="yes" + METHOD="default" + base_settings "$VERB" + echo_default + break + ;; + 3) + header_info + echo -e "${ADVANCED}${BOLD}${RD}Using Advanced Settings on node $PVEHOST_NAME${CL}" + METHOD="advanced" + base_settings + advanced_settings + break + ;; + 4) + if [[ $DIAGNOSTICS == "yes" ]]; then + if whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DIAGNOSTICS SETTINGS" --yesno "Send Diagnostics of LXC Installation?\n\nCurrent setting: ${DIAGNOSTICS}" 10 58 \ + --yes-button "No" --no-button "Back"; then + DIAGNOSTICS="no" + sed -i 's/^DIAGNOSTICS=.*/DIAGNOSTICS=no/' /usr/local/community-scripts/diagnostics + whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DIAGNOSTICS SETTINGS" --msgbox "Diagnostics settings changed to ${DIAGNOSTICS}." 8 58 + fi + else + if whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DIAGNOSTICS SETTINGS" --yesno "Send Diagnostics of LXC Installation?\n\nCurrent setting: ${DIAGNOSTICS}" 10 58 \ + --yes-button "Yes" --no-button "Back"; then + DIAGNOSTICS="yes" + sed -i 's/^DIAGNOSTICS=.*/DIAGNOSTICS=yes/' /usr/local/community-scripts/diagnostics + whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "DIAGNOSTICS SETTINGS" --msgbox "Diagnostics settings changed to ${DIAGNOSTICS}." 8 58 + fi + fi + + ;; + 5) + echo -e "${CROSS}${RD}Exiting.${CL}" + exit 0 + ;; + *) + echo -e "${CROSS}${RD}Invalid option, please try again.${CL}" + ;; + esac + done } check_container_resources() { - # Check actual RAM & Cores - current_ram=$(free -m | awk 'NR==2{print $2}') - current_cpu=$(nproc) + # Check actual RAM & Cores + current_ram=$(free -m | awk 'NR==2{print $2}') + current_cpu=$(nproc) - # Check whether the current RAM is less than the required RAM or the CPU cores are less than required - if [[ "$current_ram" -lt "$var_ram" ]] || [[ "$current_cpu" -lt "$var_cpu" ]]; then - echo -e "\n${INFO}${HOLD} ${GN}Required: ${var_cpu} CPU, ${var_ram}MB RAM ${CL}| ${RD}Current: ${current_cpu} CPU, ${current_ram}MB RAM${CL}" - echo -e "${YWB}Please ensure that the ${APP} LXC is configured with at least ${var_cpu} vCPU and ${var_ram} MB RAM for the build process.${CL}\n" - echo -ne "${INFO}${HOLD} May cause data loss! ${INFO} Continue update with under-provisioned LXC? " - read -r prompt - # Check if the input is 'yes', otherwise exit with status 1 - if [[ ! ${prompt,,} =~ ^(yes)$ ]]; then - echo -e "${CROSS}${HOLD} ${YWB}Exiting based on user input.${CL}" - exit 1 + # Check whether the current RAM is less than the required RAM or the CPU cores are less than required + if [[ "$current_ram" -lt "$var_ram" ]] || [[ "$current_cpu" -lt "$var_cpu" ]]; then + echo -e "\n${INFO}${HOLD} ${GN}Required: ${var_cpu} CPU, ${var_ram}MB RAM ${CL}| ${RD}Current: ${current_cpu} CPU, ${current_ram}MB RAM${CL}" + echo -e "${YWB}Please ensure that the ${APP} LXC is configured with at least ${var_cpu} vCPU and ${var_ram} MB RAM for the build process.${CL}\n" + echo -ne "${INFO}${HOLD} May cause data loss! ${INFO} Continue update with under-provisioned LXC? " + read -r prompt + # Check if the input is 'yes', otherwise exit with status 1 + if [[ ! ${prompt,,} =~ ^(yes)$ ]]; then + echo -e "${CROSS}${HOLD} ${YWB}Exiting based on user input.${CL}" + exit 1 + fi + else + echo -e "" fi - else - echo -e "" - fi } check_container_storage() { - # Check if the /boot partition is more than 80% full - total_size=$(df /boot --output=size | tail -n 1) - local used_size=$(df /boot --output=used | tail -n 1) - usage=$((100 * used_size / total_size)) - if ((usage > 80)); then - # Prompt the user for confirmation to continue - echo -e "${INFO}${HOLD} ${YWB}Warning: Storage is dangerously low (${usage}%).${CL}" - echo -ne "Continue anyway? " - read -r prompt - # Check if the input is 'y' or 'yes', otherwise exit with status 1 - if [[ ! ${prompt,,} =~ ^(y|yes)$ ]]; then - echo -e "${CROSS}${HOLD}${YWB}Exiting based on user input.${CL}" - exit 1 + # Check if the /boot partition is more than 80% full + total_size=$(df /boot --output=size | tail -n 1) + local used_size=$(df /boot --output=used | tail -n 1) + usage=$((100 * used_size / total_size)) + if ((usage > 80)); then + # Prompt the user for confirmation to continue + echo -e "${INFO}${HOLD} ${YWB}Warning: Storage is dangerously low (${usage}%).${CL}" + echo -ne "Continue anyway? " + read -r prompt + # Check if the input is 'y' or 'yes', otherwise exit with status 1 + if [[ ! ${prompt,,} =~ ^(y|yes)$ ]]; then + echo -e "${CROSS}${HOLD}${YWB}Exiting based on user input.${CL}" + exit 1 + fi fi - fi } start() { - LOGDIR="/usr/local/community-scripts/logs" - mkdir -p "$LOGDIR" + LOGDIR="/usr/local/community-scripts/logs" + mkdir -p "$LOGDIR" - if command -v pveversion >/dev/null 2>&1; then - if ! (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then - clear - exit_script - exit + if command -v pveversion >/dev/null 2>&1; then + if ! (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then + clear + exit_script + exit + fi + SPINNER_PID="" + install_script fi - SPINNER_PID="" - install_script - fi - if ! command -v pveversion >/dev/null 2>&1; then - CHOICE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "${APP} LXC Update/Setting" --menu \ - "Support/Update functions for ${APP} LXC. Choose an option:" \ - 12 60 3 \ - "1" "YES (Silent Mode)" \ - "2" "YES (Verbose Mode)" \ - "3" "NO (Cancel Update)" --nocancel --default-item "1" 3>&1 1>&2 2>&3) + if ! command -v pveversion >/dev/null 2>&1; then + CHOICE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "${APP} LXC Update/Setting" --menu \ + "Support/Update functions for ${APP} LXC. Choose an option:" \ + 12 60 3 \ + "1" "YES (Silent Mode)" \ + "2" "YES (Verbose Mode)" \ + "3" "NO (Cancel Update)" --nocancel --default-item "1" 3>&1 1>&2 2>&3) - case "$CHOICE" in - 1) - VERB="no" - set_std_mode - log_message "INFO" "Update started (Silent Mode)" - ;; - 2) - VERB="yes" - set_std_mode - log_message "INFO" "Update started (Verbose Mode)" - ;; - 3) - clear - log_message "INFO" "Update aborted." - exit_script - exit - ;; - esac + case "$CHOICE" in + 1) + VERB="no" + set_std_mode + log_message "INFO" "Update started (Silent Mode)" + ;; + 2) + VERB="yes" + set_std_mode + log_message "INFO" "Update started (Verbose Mode)" + ;; + 3) + clear + log_message "INFO" "Update aborted." + exit_script + exit + ;; + esac - SPINNER_PID="" - update_script - fi + SPINNER_PID="" + update_script + fi } # This function collects user settings and integrates all the collected information. build_container() { - # if [ "$VERB" == "yes" ]; then set -x; fi + # if [ "$VERB" == "yes" ]; then set -x; fi - if [ "$CT_TYPE" == "1" ]; then - FEATURES="keyctl=1,nesting=1" - else - FEATURES="nesting=1" - fi + if [ "$CT_TYPE" == "1" ]; then + FEATURES="keyctl=1,nesting=1" + else + FEATURES="nesting=1" + fi - if [[ $DIAGNOSTICS == "yes" ]]; then - post_to_api - fi + if [[ $DIAGNOSTICS == "yes" ]]; then + post_to_api + fi - TEMP_DIR=$(mktemp -d) - pushd $TEMP_DIR >/dev/null - if [ "$var_os" == "alpine" ]; then - export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/alpine-install.func)" - else - export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/install.func)" - fi - export RANDOM_UUID="$RANDOM_UUID" - export CACHER="$APT_CACHER" - export CACHER_IP="$APT_CACHER_IP" - export tz="$timezone" - export DISABLEIPV6="$DISABLEIP6" - export APPLICATION="$APP" - export app="$NSAPP" - export PASSWORD="$PW" - export VERBOSE="$VERB" - export SSH_ROOT="${SSH}" - export SSH_AUTHORIZED_KEY - export CTID="$CT_ID" - export CTTYPE="$CT_TYPE" - export PCT_OSTYPE="$var_os" - export PCT_OSVERSION="$var_version" - export PCT_DISK_SIZE="$DISK_SIZE" - export IPv6="$IPv6" - export PCT_OPTIONS=" + TEMP_DIR=$(mktemp -d) + pushd $TEMP_DIR >/dev/null + if [ "$var_os" == "alpine" ]; then + export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/alpine-install.func)" + else + export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/install.func)" + fi + export RANDOM_UUID="$RANDOM_UUID" + export CACHER="$APT_CACHER" + export CACHER_IP="$APT_CACHER_IP" + export tz="$timezone" + export DISABLEIPV6="$DISABLEIP6" + export APPLICATION="$APP" + export app="$NSAPP" + export PASSWORD="$PW" + export VERBOSE="$VERB" + export SSH_ROOT="${SSH}" + export SSH_AUTHORIZED_KEY + export CTID="$CT_ID" + export CTTYPE="$CT_TYPE" + export PCT_OSTYPE="$var_os" + export PCT_OSVERSION="$var_version" + export PCT_DISK_SIZE="$DISK_SIZE" + export IPv6="$IPv6" + export PCT_OPTIONS=" -features $FEATURES -hostname $HN -tags $TAGS @@ -1119,13 +1122,12 @@ build_container() { $PW " + # This executes create_lxc.sh and creates the container and .conf file + bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/ct/create_lxc.sh)" || exit $? - # This executes create_lxc.sh and creates the container and .conf file - bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/ct/create_lxc.sh)" || exit $? - - LXC_CONFIG=/etc/pve/lxc/${CTID}.conf - if [ "$CT_TYPE" == "0" ]; then - cat <>$LXC_CONFIG + LXC_CONFIG=/etc/pve/lxc/${CTID}.conf + if [ "$CT_TYPE" == "0" ]; then + cat <>$LXC_CONFIG # USB passthrough lxc.cgroup2.devices.allow: a lxc.cap.drop: @@ -1137,11 +1139,11 @@ lxc.mount.entry: /dev/ttyUSB1 dev/ttyUSB1 none bind,optional,create= lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=file lxc.mount.entry: /dev/ttyACM1 dev/ttyACM1 none bind,optional,create=file EOF - fi + fi - if [ "$CT_TYPE" == "0" ]; then - if [[ "$APP" == "Channels" || "$APP" == "Emby" || "$APP" == "ErsatzTV" || "$APP" == "Frigate" || "$APP" == "Jellyfin" || "$APP" == "Plex" || "$APP" == "Scrypted" || "$APP" == "Tdarr" || "$APP" == "Unmanic" || "$APP" == "Ollama" ]]; then - cat <>$LXC_CONFIG + if [ "$CT_TYPE" == "0" ]; then + if [[ "$APP" == "Channels" || "$APP" == "Emby" || "$APP" == "ErsatzTV" || "$APP" == "Frigate" || "$APP" == "Jellyfin" || "$APP" == "Plex" || "$APP" == "Scrypted" || "$APP" == "Tdarr" || "$APP" == "Unmanic" || "$APP" == "Ollama" ]]; then + cat <>$LXC_CONFIG # VAAPI hardware transcoding lxc.cgroup2.devices.allow: c 226:0 rwm lxc.cgroup2.devices.allow: c 226:128 rwm @@ -1150,50 +1152,50 @@ lxc.mount.entry: /dev/fb0 dev/fb0 none bind,optional,create=file lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file EOF - fi - else - if [[ "$APP" == "Channels" || "$APP" == "Emby" || "$APP" == "ErsatzTV" || "$APP" == "Frigate" || "$APP" == "Jellyfin" || "$APP" == "Plex" || "$APP" == "Scrypted" || "$APP" == "Tdarr" || "$APP" == "Unmanic" || "$APP" == "Ollama" ]]; then - if [[ -e "/dev/dri/renderD128" ]]; then - if [[ -e "/dev/dri/card0" ]]; then - cat <>$LXC_CONFIG + fi + else + if [[ "$APP" == "Channels" || "$APP" == "Emby" || "$APP" == "ErsatzTV" || "$APP" == "Frigate" || "$APP" == "Jellyfin" || "$APP" == "Plex" || "$APP" == "Scrypted" || "$APP" == "Tdarr" || "$APP" == "Unmanic" || "$APP" == "Ollama" ]]; then + if [[ -e "/dev/dri/renderD128" ]]; then + if [[ -e "/dev/dri/card0" ]]; then + cat <>$LXC_CONFIG # VAAPI hardware transcoding dev0: /dev/dri/card0,gid=44 dev1: /dev/dri/renderD128,gid=104 EOF - else - cat <>$LXC_CONFIG + else + cat <>$LXC_CONFIG # VAAPI hardware transcoding dev0: /dev/dri/card1,gid=44 dev1: /dev/dri/renderD128,gid=104 EOF + fi + fi fi - fi fi - fi - # This starts the container and executes -install.sh - msg_info "Starting LXC Container" - pct start "$CTID" - msg_ok "Started LXC Container" - if [ "$var_os" == "alpine" ]; then - sleep 3 - pct exec "$CTID" -- /bin/sh -c 'cat </etc/apk/repositories + # This starts the container and executes -install.sh + msg_info "Starting LXC Container" + pct start "$CTID" + msg_ok "Started LXC Container" + if [ "$var_os" == "alpine" ]; then + sleep 3 + pct exec "$CTID" -- /bin/sh -c 'cat </etc/apk/repositories http://dl-cdn.alpinelinux.org/alpine/latest-stable/main http://dl-cdn.alpinelinux.org/alpine/latest-stable/community EOF' - pct exec "$CTID" -- ash -c "apk add bash >/dev/null" - fi - lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/$var_install.sh)" || exit $? + pct exec "$CTID" -- ash -c "apk add bash >/dev/null" + fi + lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/$var_install.sh)" || exit $? } # This function sets the description of the container. description() { - IP=$(pct exec "$CTID" ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1) + IP=$(pct exec "$CTID" ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1) - # Generate LXC Description - DESCRIPTION=$( - cat < Logo @@ -1221,57 +1223,57 @@ description() { EOF - ) + ) - # Set Description in LXC - pct set "$CTID" -description "$DESCRIPTION" + # Set Description in LXC + pct set "$CTID" -description "$DESCRIPTION" - if [[ -f /etc/systemd/system/ping-instances.service ]]; then - systemctl start ping-instances.service - fi + if [[ -f /etc/systemd/system/ping-instances.service ]]; then + systemctl start ping-instances.service + fi - post_update_to_api "done" "none" + post_update_to_api "done" "none" } set_std_mode() { - if [ "$VERB" = "yes" ]; then - STD="" - else - STD="silent" - fi + if [ "$VERB" = "yes" ]; then + STD="" + else + STD="silent" + fi } # Silent execution function silent() { - if [ "$VERB" = "no" ]; then - "$@" >>"$LOGFILE" 2>&1 - else - "$@" 2>&1 | tee -a "$LOGFILE" - fi + if [ "$VERB" = "no" ]; then + "$@" >>"$LOGFILE" 2>&1 + else + "$@" 2>&1 | tee -a "$LOGFILE" + fi } exit_script() { - exit_code=$? # Capture the exit status of the last executed command - #200 exit codes indicate error in create_lxc.sh - #100 exit codes indicate error in install.func + exit_code=$? # Capture the exit status of the last executed command + #200 exit codes indicate error in create_lxc.sh + #100 exit codes indicate error in install.func - if [ $exit_code -ne 0 ]; then - case $exit_code in - 100) post_update_to_api "failed" "100: Unexpected error in create_lxc.sh" ;; - 101) post_update_to_api "failed" "101: No network connection detected in create_lxc.sh" ;; - 200) post_update_to_api "failed" "200: LXC creation failed in create_lxc.sh" ;; - 201) post_update_to_api "failed" "201: Invalid Storage class in create_lxc.sh" ;; - 202) post_update_to_api "failed" "202: User aborted menu in create_lxc.sh" ;; - 203) post_update_to_api "failed" "203: CTID not set in create_lxc.sh" ;; - 204) post_update_to_api "failed" "204: PCT_OSTYPE not set in create_lxc.sh" ;; - 205) post_update_to_api "failed" "205: CTID cannot be less than 100 in create_lxc.sh" ;; - 206) post_update_to_api "failed" "206: CTID already in use in create_lxc.sh" ;; - 207) post_update_to_api "failed" "207: Template not found in create_lxc.sh" ;; - 208) post_update_to_api "failed" "208: Error downloading template in create_lxc.sh" ;; - 209) post_update_to_api "failed" "209: Container creation failed, but template is intact in create_lxc.sh" ;; - *) post_update_to_api "failed" "Unknown error, exit code: $exit_code in create_lxc.sh" ;; - esac - fi + if [ $exit_code -ne 0 ]; then + case $exit_code in + 100) post_update_to_api "failed" "100: Unexpected error in create_lxc.sh" ;; + 101) post_update_to_api "failed" "101: No network connection detected in create_lxc.sh" ;; + 200) post_update_to_api "failed" "200: LXC creation failed in create_lxc.sh" ;; + 201) post_update_to_api "failed" "201: Invalid Storage class in create_lxc.sh" ;; + 202) post_update_to_api "failed" "202: User aborted menu in create_lxc.sh" ;; + 203) post_update_to_api "failed" "203: CTID not set in create_lxc.sh" ;; + 204) post_update_to_api "failed" "204: PCT_OSTYPE not set in create_lxc.sh" ;; + 205) post_update_to_api "failed" "205: CTID cannot be less than 100 in create_lxc.sh" ;; + 206) post_update_to_api "failed" "206: CTID already in use in create_lxc.sh" ;; + 207) post_update_to_api "failed" "207: Template not found in create_lxc.sh" ;; + 208) post_update_to_api "failed" "208: Error downloading template in create_lxc.sh" ;; + 209) post_update_to_api "failed" "209: Container creation failed, but template is intact in create_lxc.sh" ;; + *) post_update_to_api "failed" "Unknown error, exit code: $exit_code in create_lxc.sh" ;; + esac + fi } trap 'exit_script' EXIT From 1cc90a2f30e571f9550994def771293b41da2b26 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 13 Mar 2025 10:43:44 +0100 Subject: [PATCH 02/62] Feature: CIFS / FUSE / NFS --- misc/build.func | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/misc/build.func b/misc/build.func index c70624c..380aee7 100644 --- a/misc/build.func +++ b/misc/build.func @@ -350,6 +350,9 @@ base_settings() { SSH="no" SSH_AUTHORIZED_KEY="" TAGS="community-script-dev;" + NFS="no" + CIFS="no" + FUSE="no" # Override default settings with variables from ct script CT_TYPE=${var_unprivileged:-$CT_TYPE} @@ -358,6 +361,9 @@ base_settings() { RAM_SIZE=${var_ram:-$RAM_SIZE} VERB=${var_verbose:-$VERBOSE} TAGS="${TAGS}${var_tags:-}" + NFS=${var_nfs:-$NFS} + CIFS=${var_cifs:-$CIFS} + FUSE=${var_fuse:-$FUSE} # Since these 2 are only defined outside of default_settings function, we add a temporary fallback. TODO: To align everything, we should add these as constant variables (e.g. OSTYPE and OSVERSION), but that would currently require updating the default_settings function for all existing scripts if [ -z "$var_os" ]; then @@ -814,6 +820,51 @@ advanced_settings() { else SSH_AUTHORIZED_KEY="" fi + # NFS Feature Selection + if NFS_FEATURE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "NFS Support" --radiolist "Enable NFS support in the container?" 10 58 2 \ + "Yes" "" ON \ + "No" "" OFF \ + 3>&1 1>&2 2>&3); then + if [ "$NFS_FEATURE" == "Yes" ]; then + FEATURES+=",nfs=1" + echo -e "${NFS}${BOLD}${DGN}NFS Support: ${BGN}Enabled${CL}" + else + echo -e "${NFS}${BOLD}${DGN}NFS Support: ${BGN}Disabled${CL}" + fi + else + exit_script + fi + + # CIFS Feature Selection + if CIFS_FEATURE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "CIFS Support" --radiolist "Enable CIFS (Samba) support in the container?" 10 58 2 \ + "Yes" "" ON \ + "No" "" OFF \ + 3>&1 1>&2 2>&3); then + if [ "$CIFS_FEATURE" == "Yes" ]; then + FEATURES+=",cifs=1" + echo -e "${CIFS}${BOLD}${DGN}CIFS (Samba) Support: ${BGN}Enabled${CL}" + else + echo -e "${CIFS}${BOLD}${DGN}CIFS (Samba) Support: ${BGN}Disabled${CL}" + fi + else + exit_script + fi + + # FUSE Feature Selection + if FUSE_FEATURE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "FUSE Support" --radiolist "Enable FUSE (Filesystem in Userspace) support in the container?" 10 58 2 \ + "Yes" "" ON \ + "No" "" OFF \ + 3>&1 1>&2 2>&3); then + if [ "$FUSE_FEATURE" == "Yes" ]; then + FEATURES+=",fuse=1" + echo -e "${FUSE}${BOLD}${DGN}FUSE (Filesystem in Userspace) Support: ${BGN}Enabled${CL}" + else + echo -e "${FUSE}${BOLD}${DGN}FUSE (Filesystem in Userspace) Support: ${BGN}Disabled${CL}" + fi + else + exit_script + fi + if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then VERB="yes" else @@ -1084,6 +1135,7 @@ build_container() { post_to_api fi + FEATURES="${FEATURES#,}" TEMP_DIR=$(mktemp -d) pushd $TEMP_DIR >/dev/null if [ "$var_os" == "alpine" ]; then From a1e3b036b681e6bb6441a53d8e058ef18d8207a3 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 13 Mar 2025 10:49:58 +0100 Subject: [PATCH 03/62] shorten option dialogue --- misc/build.func | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/misc/build.func b/misc/build.func index 380aee7..3d5aa20 100644 --- a/misc/build.func +++ b/misc/build.func @@ -821,49 +821,28 @@ advanced_settings() { SSH_AUTHORIZED_KEY="" fi # NFS Feature Selection - if NFS_FEATURE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "NFS Support" --radiolist "Enable NFS support in the container?" 10 58 2 \ - "Yes" "" ON \ - "No" "" OFF \ - 3>&1 1>&2 2>&3); then - if [ "$NFS_FEATURE" == "Yes" ]; then - FEATURES+=",nfs=1" - echo -e "${NFS}${BOLD}${DGN}NFS Support: ${BGN}Enabled${CL}" - else - echo -e "${NFS}${BOLD}${DGN}NFS Support: ${BGN}Disabled${CL}" - fi + if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "NFS Support" --yesno "Enable NFS support in the container?" 10 58); then + NFS="yes" else - exit_script + NFS="no" fi + echo -e "${NFS}${BOLD}${DGN}NFS Support: ${BGN}$NFS${CL}" # CIFS Feature Selection - if CIFS_FEATURE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "CIFS Support" --radiolist "Enable CIFS (Samba) support in the container?" 10 58 2 \ - "Yes" "" ON \ - "No" "" OFF \ - 3>&1 1>&2 2>&3); then - if [ "$CIFS_FEATURE" == "Yes" ]; then - FEATURES+=",cifs=1" - echo -e "${CIFS}${BOLD}${DGN}CIFS (Samba) Support: ${BGN}Enabled${CL}" - else - echo -e "${CIFS}${BOLD}${DGN}CIFS (Samba) Support: ${BGN}Disabled${CL}" - fi + if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "CIFS Support" --yesno "Enable CIFS (Samba) support in the container?" 10 58); then + CIFS="yes" else - exit_script + CIFS="no" fi + echo -e "${CIFS}${BOLD}${DGN}CIFS (Samba) Support: ${BGN}$CIFS${CL}" # FUSE Feature Selection - if FUSE_FEATURE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "FUSE Support" --radiolist "Enable FUSE (Filesystem in Userspace) support in the container?" 10 58 2 \ - "Yes" "" ON \ - "No" "" OFF \ - 3>&1 1>&2 2>&3); then - if [ "$FUSE_FEATURE" == "Yes" ]; then - FEATURES+=",fuse=1" - echo -e "${FUSE}${BOLD}${DGN}FUSE (Filesystem in Userspace) Support: ${BGN}Enabled${CL}" - else - echo -e "${FUSE}${BOLD}${DGN}FUSE (Filesystem in Userspace) Support: ${BGN}Disabled${CL}" - fi + if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "FUSE Support" --yesno "Enable FUSE (Filesystem in Userspace) support in the container?" 10 58); then + FUSE="yes" else - exit_script + FUSE="no" fi + echo -e "${FUSE}${BOLD}${DGN}FUSE (Filesystem in Userspace) Support: ${BGN}$FUSE${CL}" if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then VERB="yes" From 8e50696aaf2848144eda6a2c0e0d2c06dd42dc16 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 13 Mar 2025 10:53:43 +0100 Subject: [PATCH 04/62] naming convention --- misc/build.func | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/misc/build.func b/misc/build.func index 3d5aa20..2dcc6b9 100644 --- a/misc/build.func +++ b/misc/build.func @@ -350,9 +350,9 @@ base_settings() { SSH="no" SSH_AUTHORIZED_KEY="" TAGS="community-script-dev;" - NFS="no" - CIFS="no" - FUSE="no" + ENABLE_NFS="no" + ENABLE_CIFS="no" + ENABLE_FUSE="no" # Override default settings with variables from ct script CT_TYPE=${var_unprivileged:-$CT_TYPE} @@ -361,9 +361,9 @@ base_settings() { RAM_SIZE=${var_ram:-$RAM_SIZE} VERB=${var_verbose:-$VERBOSE} TAGS="${TAGS}${var_tags:-}" - NFS=${var_nfs:-$NFS} - CIFS=${var_cifs:-$CIFS} - FUSE=${var_fuse:-$FUSE} + ENABLE_NFS=${var_nfs:-$ENABLE_NFS} + ENABLE_CIFS=${var_cifs:-$ENABLE_CIFS} + ENABLE_FUSE=${var_fuse:-$ENABLE_FUSE} # Since these 2 are only defined outside of default_settings function, we add a temporary fallback. TODO: To align everything, we should add these as constant variables (e.g. OSTYPE and OSVERSION), but that would currently require updating the default_settings function for all existing scripts if [ -z "$var_os" ]; then @@ -822,27 +822,27 @@ advanced_settings() { fi # NFS Feature Selection if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "NFS Support" --yesno "Enable NFS support in the container?" 10 58); then - NFS="yes" + ENABLE_NFS="yes" else - NFS="no" + ENABLE_NFS="no" fi - echo -e "${NFS}${BOLD}${DGN}NFS Support: ${BGN}$NFS${CL}" + echo -e "${NFS}${BOLD}${DGN}NFS Support: ${BGN}$ENABLE_NFS${CL}" # CIFS Feature Selection if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "CIFS Support" --yesno "Enable CIFS (Samba) support in the container?" 10 58); then - CIFS="yes" + ENABLE_CIFS="yes" else - CIFS="no" + ENABLE_CIFS="no" fi - echo -e "${CIFS}${BOLD}${DGN}CIFS (Samba) Support: ${BGN}$CIFS${CL}" + echo -e "${CIFS}${BOLD}${DGN}CIFS (Samba) Support: ${BGN}$ENABLE_CIFS${CL}" # FUSE Feature Selection if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "FUSE Support" --yesno "Enable FUSE (Filesystem in Userspace) support in the container?" 10 58); then - FUSE="yes" + ENABLE_FUSE="yes" else - FUSE="no" + ENABLE_FUSE="no" fi - echo -e "${FUSE}${BOLD}${DGN}FUSE (Filesystem in Userspace) Support: ${BGN}$FUSE${CL}" + echo -e "${FUSE}${BOLD}${DGN}FUSE (Filesystem in Userspace) Support: ${BGN}$ENABLE_FUSE${CL}" if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then VERB="yes" From 38f60272885cf3b2976a4324bef4fe781b100550 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 13 Mar 2025 10:56:23 +0100 Subject: [PATCH 05/62] add features --- misc/build.func | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/misc/build.func b/misc/build.func index 2dcc6b9..89530a8 100644 --- a/misc/build.func +++ b/misc/build.func @@ -1110,6 +1110,18 @@ build_container() { FEATURES="nesting=1" fi + if [ "$ENABLE_NFS" == "yes" ]; then + FEATURES+=",nfs=1" + fi + + if [ "$ENABLE_CIFS" == "yes" ]; then + FEATURES+=",cifs=1" + fi + + if [ "$ENABLE_FUSE" == "yes" ]; then + FEATURES+=",fuse=1" + fi + if [[ $DIAGNOSTICS == "yes" ]]; then post_to_api fi From 463fb7370f25971b8a9a819b68201d3e2403b9a2 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 11:36:27 +0100 Subject: [PATCH 06/62] Remove merged scripts --- ct/fluid-calendar.sh | 78 -------- ct/seafile.sh | 43 ----- install/fluid-calendar-install.sh | 112 ----------- install/seafile-install.sh | 298 ------------------------------ json/fluid-calendar.json | 40 ---- 5 files changed, 571 deletions(-) delete mode 100644 ct/fluid-calendar.sh delete mode 100644 ct/seafile.sh delete mode 100644 install/fluid-calendar-install.sh delete mode 100644 install/seafile-install.sh delete mode 100644 json/fluid-calendar.json diff --git a/ct/fluid-calendar.sh b/ct/fluid-calendar.sh deleted file mode 100644 index a534867..0000000 --- a/ct/fluid-calendar.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/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: vhsdream -# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -# Source: https://fluidcalendar.com - -APP="fluid-calendar" -var_tags="calendar,tasks" -var_cpu="3" -var_ram="4096" -var_disk="7" -var_os="debian" -var_version="12" -var_unprivileged="1" - -header_info "$APP" -variables -color -catch_errors - -function update_script() { - header_info - check_container_storage - check_container_resources - - if [[ ! -d /opt/fluid-calendar ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - - RELEASE=$(curl -s https://api.github.com/repos/dotnetfactory/fluid-calendar/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') - if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then - msg_info "Stopping $APP" - systemctl stop fluid-calendar.service - msg_ok "Stopped $APP" - - msg_info "Creating Backup" - $STD tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" /opt/fluid-calendar - msg_ok "Backup Created" - - msg_info "Updating $APP to v${RELEASE}" - tmp_file=$(mktemp) - wget -q "https://github.com/dotnetfactory/fluid-calendar/archive/refs/tags/v${RELEASE}.zip" -O $tmp_file - unzip -q $tmp_file - cp -rf ${APP}-${RELEASE}/* /opt/fluid-calendar - cd /opt/fluid-calendar - export NEXT_TELEMETRY_DISABLED=1 - $STD npm run setup - $STD npm run build - msg_ok "Updated $APP to v${RELEASE}" - - msg_info "Starting $APP" - systemctl start fluid-calendar.service - msg_ok "Started $APP" - - msg_info "Cleaning Up" - rm -rf $tmp_file - rm -rf "/opt/${APP}_backup_$(date +%F).tar.gz" - rm -rf /tmp/${APP}-${RELEASE} - msg_ok "Cleanup Completed" - - echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Update Successful" - else - msg_ok "No update required. ${APP} is already at v${RELEASE}" - 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 "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}" diff --git a/ct/seafile.sh b/ct/seafile.sh deleted file mode 100644 index b634e6b..0000000 --- a/ct/seafile.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash -source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) -# Copyright (c) 2021-2025 tteck -# Author: dave-yap (dave-yap) -# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -# Source: https://seafile.com/ - -APP="Seafile" -var_tags="documents" -var_cpu="2" -var_ram="2048" -var_disk="20" -var_os="debian" -var_version="12" -var_unprivileged="1" - -header_info "$APP" -base_settings - -variables -color -catch_errors - -function update_script() { - header_info - check_container_storage - check_container_resources - if [[ ! -f /etc/systemd/system/seafile.service ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - msg_ok "No upgrade path available now." - 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 "${TAB}${GATEWAY}${BGN}http://${IP}:8000${CL}" \ No newline at end of file diff --git a/install/fluid-calendar-install.sh b/install/fluid-calendar-install.sh deleted file mode 100644 index aac1343..0000000 --- a/install/fluid-calendar-install.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2021-2025 community-scripts ORG -# Author: vhsdream -# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -# Source: https://github.com/dotnetfactory/fluid-calendar - -source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" -color -verb_ip6 -catch_errors -setting_up_container -network_check -update_os - -msg_info "Installing Dependencies" -$STD apt-get install -y \ - curl \ - sudo \ - mc \ - zip \ - gnupg \ - postgresql-common -msg_ok "Installed Dependencies" - -msg_info "Installing Additional Dependencies" -curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg -echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list -echo "YES" | /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh &>/dev/null -$STD apt-get install -y postgresql-17 nodejs -msg_ok "Installed Additional Dependencies" - -msg_info "Setting up Postgresql Database" -DB_NAME="fluiddb" -DB_USER="fluiduser" -DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)" -NEXTAUTH_SECRET="$(openssl rand -base64 44 | tr -dc 'a-zA-Z0-9' | cut -c1-32)" -$STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH ENCRYPTED PASSWORD '$DB_PASS';" -$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" -$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME to $DB_USER;" -$STD sudo -u postgres psql -c "ALTER USER $DB_USER WITH SUPERUSER;" -{ - echo "${APPLICATION} Credentials" - echo "Database User: $DB_USER" - echo "Database Password: $DB_PASS" - echo "Database Name: $DB_NAME" - echo "NextAuth Secret: $NEXTAUTH_SECRET" -} >> ~/$APPLICATION.creds -msg_ok "Set up Postgresql Database" - -msg_info "Setup ${APPLICATION}" -tmp_file=$(mktemp) -RELEASE=$(curl -s https://api.github.com/repos/dotnetfactory/fluid-calendar/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') -wget -q "https://github.com/dotnetfactory/fluid-calendar/archive/refs/tags/v${RELEASE}.zip" -O $tmp_file -unzip -q $tmp_file -mv ${APPLICATION}-${RELEASE}/ /opt/${APPLICATION} -echo "${RELEASE}" >/opt/${APPLICATION}_version.txt - -cat </opt/fluid-calendar/.env -DATABASE_URL="postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}" - -# For OAuth integration with Google Calendar -# See https://console.cloud.google.com -GOOGLE_CLIENT_ID="" -GOOGLE_CLIENT_SECRET="" - -# Change the URL below to your external URL -NEXTAUTH_URL="http://localhost:3000" -NEXTAUTH_SECRET="${NEXTAUTH_SECRET}" - -# For optional Outlook Calendar Integration -# Create at https://portal.azure.com -AZURE_AD_CLIENT_ID="" -AZURE_AD_CLIENT_SECRET="" -AZURE_AD_TENANT_ID="" - -# Logging configuration -# Options: debug, none (check logger.js for more details) -LOG_LEVEL="none" -DEBUG_ENABLED=0 -EOF -export NEXT_TELEMETRY_DISABLED=1 -cd /opt/fluid-calendar -$STD npm run setup -$STD npm run build -msg_ok "Setup ${APPLICATION}" - -msg_info "Creating Service" -cat </etc/systemd/system/fluid-calendar.service -[Unit] -Description=Fluid Calendar Application -After=network.target postgresql.service - -[Service] -Restart=always -WorkingDirectory=/opt/fluid-calendar -ExecStart=/usr/bin/npm run start - -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now fluid-calendar.service -msg_ok "Created Service" - -motd_ssh -customize - -msg_info "Cleaning up" -rm -f $tmp_file -$STD apt-get -y autoremove -$STD apt-get -y autoclean -msg_ok "Cleaned" diff --git a/install/seafile-install.sh b/install/seafile-install.sh deleted file mode 100644 index b5fadf7..0000000 --- a/install/seafile-install.sh +++ /dev/null @@ -1,298 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2021-2025 community-scripts ORG -# Author: dave-yap -# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -# Source: https://seafile.com/ - -source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" -color -verb_ip6 -catch_errors -setting_up_container -network_check -update_os - -msg_info "Installing Dependencies (Patience)" -$STD apt-get install -y \ - sudo \ - mc \ - wget \ - curl \ - xmlstarlet \ - expect -msg_ok "Installed Dependencies" - -msg_info "Installing MariaDB" -$STD apt-get install -y mariadb-server -systemctl start mariadb -msg_ok "Installed MariaDB" - -msg_info "Setup MariaDB for Seafile" -CCNET_DB="ccnet_db" -SEAFILE_DB="seafile_db" -SEAHUB_DB="seahub_db" -DB_USER="seafile" -DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13) -ADMIN_EMAIL="admin@localhost.local" -ADMIN_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13) -sudo -u mysql mysql -s -e "CREATE DATABASE $CCNET_DB CHARACTER SET utf8;" -sudo -u mysql mysql -s -e "CREATE DATABASE $SEAFILE_DB CHARACTER SET utf8;" -sudo -u mysql mysql -s -e "CREATE DATABASE $SEAHUB_DB CHARACTER SET utf8;" -sudo -u mysql mysql -s -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';" -sudo -u mysql mysql -s -e "GRANT ALL PRIVILEGES ON $CCNET_DB.* TO '$DB_USER'@localhost;" -sudo -u mysql mysql -s -e "GRANT ALL PRIVILEGES ON $SEAFILE_DB.* TO '$DB_USER'@localhost;" -sudo -u mysql mysql -s -e "GRANT ALL PRIVILEGES ON $SEAHUB_DB.* TO '$DB_USER'@localhost;" -{ - echo "Application Credentials" - echo "CCNET_DB: $CCNET_DB" - echo "SEAFILE_DB: $SEAFILE_DB" - echo "SEAHUB_DB: $SEAHUB_DB" - echo "DB_USER: $DB_USER" - echo "DB_PASS: $DB_PASS" - echo "ADMIN_EMAIL: $ADMIN_EMAIL" - echo "ADMIN_PASS: $ADMIN_PASS" -} >> ~/seafile.creds -msg_ok "MariaDB setup for Seafile" - -msg_info "Installing Seafile Python Dependencies" -$STD apt-get install -y \ - python3 \ - python3-dev \ - python3-setuptools \ - python3-pip \ - libmariadb-dev \ - ldap-utils \ - libldap2-dev \ - libsasl2-dev \ - pkg-config -$STD pip3 install \ - django \ - future \ - mysqlclient \ - pymysql \ - pillow \ - pylibmc \ - captcha \ - markupsafe \ - jinja2 \ - sqlalchemy \ - psd-tools \ - django-pylibmc \ - django_simple_captcha \ - djangosaml2 \ - pysaml2 \ - pycryptodome \ - cffi \ - lxml \ - python-ldap -msg_ok "Installed Seafile Python Dependecies" - -msg_info "Installing Seafile" -IP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1) -mkdir -p /opt/seafile -useradd seafile -mkdir -p /home/seafile -chown seafile: /home/seafile -chown seafile: /opt/seafile -mkdir -p /opt/conf -chown seafile:seafile /opt/conf -chmod 755 /opt/conf -mkdir -p /opt/ccnet -chown seafile:seafile /opt/ccnet -chmod 755 /opt/ccnet -chown -R seafile:seafile /opt/conf -chmod -R 755 /opt/conf -LATEST_FILE=$(curl -s "https://download.seadrive.org/" | \ - xmlstarlet sel -N s3="http://s3.amazonaws.com/doc/2006-03-01/" \ - -t -m "//s3:Contents[s3:Key[starts-with(text(),'seafile-server')]]" \ - -v "s3:LastModified" -o " " -v "s3:Key" -n | \ - sort -r | head -n1 | awk '{print $2}') - - -$STD su - seafile -c "wget -qc https://s3.eu-central-1.amazonaws.com/download.seadrive.org/$LATEST_FILE" -$STD su - seafile -c "tar -xzf $LATEST_FILE --strip-components=1 -C /opt/seafile/" -$STD su - seafile -c "expect <>/opt/seafile/conf/seahub_settings.py -CACHES = { - 'default': { - 'BACKEND': 'django_pylibmc.memcached.PyLibMCCache', - 'LOCATION': '127.0.0.1:11211', - }, -} -EOF -msg_ok "Memcached Started" - -msg_info "Adjusting Conf files" -sed -i "0,/127.0.0.1/s/127.0.0.1/0.0.0.0/" /opt/seafile/conf/gunicorn.conf.py -sed -i "0,/SERVICE_URL = \"http:\/\/$IP\"/s/SERVICE_URL = \"http:\/\/$IP\"/SERVICE_URL = \"http:\/\/$IP:8000\"/" /opt/seafile/conf/seahub_settings.py -echo -e "\nFILE_SERVER_ROOT = \"http://$IP:8082\"" >> /opt/seafile/conf/seahub_settings.py -echo -e "CSRF_TRUSTED_ORIGINS = ['http://$IP/']" >> /opt/seafile/conf/seahub_settings.py -msg_ok "Conf files adjusted" - -msg_info "Setting up Seafile" -$STD su - seafile -c "bash /opt/seafile/seafile-server-latest/seafile.sh start" -$STD su - seafile -c "expect </etc/systemd/system/seafile.service -[Unit] -Description=Seafile File-hosting -After=network.target mysql.service memcached.service -Wants=mysql.service memcached.service - -[Service] -Type=forking -User=seafile -Group=seafile -WorkingDirectory=/opt/seafile - -ExecStart=/opt/seafile/seafile-server-latest/seafile.sh start -ExecStartPost=/opt/seafile/seafile-server-latest/seahub.sh start -ExecStop=/opt/seafile/seafile-server-latest/seahub.sh stop -ExecStop=/opt/seafile/seafile-server-latest/seafile.sh stop - -Restart=on-failure -RestartSec=5s - -[Install] -WantedBy=multi-user.target -EOF -systemctl enable --now -q seafile.service -msg_ok "Created Services" - -msg_info "Creating External Storage script" -cat <<'EOF' >~/external-storage.sh -#!/bin/bash -STORAGE_DIR="/path/to/your/external/storage" - -# Move the seafile-data folder to external storage -mv /opt/seafile/seafile-data $STORAGE_DIR/seafile-data - -# Create a symlink for access -ln -s $STORAGE_DIR/seafile-data /opt/seafile/seafile-data -EOF -chmod +x ~/external-storage.sh -msg_ok "Bash Script for External Storage created" - -msg_info "Creating Domain access script" -cat <<'EOF' >~/domain.sh -#!/bin/bash -DOMAIN=$1 -IP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1) -DOMAIN_NOSCHEME=$(echo $DOMAIN | sed 's|^https://||') - -#Change the CORS to provided domain -sed -i "s|CSRF_TRUSTED_ORIGINS = ['http://$IP:8000/']|CSRF_TRUSTED_ORIGINS = ['$DOMAIN']|g" /opt/seafile/conf/seahub_settings.py -sed -i "s|FILE_SERVER_ROOT = \"http://$IP:8082\"|FILE_SERVER_ROOT = \"$DOMAIN/seafhttp\"|g" /opt/seafile/conf/seahub_settings.py -EOF -chmod +x ~/domain.sh -msg_ok "Bash Script for Domain access created" - -motd_ssh -customize - -msg_info "Cleaning up" -rm -rf /home/seafile/seafile*.tar.gz -$STD apt-get -y autoremove -$STD apt-get -y autoclean -msg_ok "Cleaned" diff --git a/json/fluid-calendar.json b/json/fluid-calendar.json deleted file mode 100644 index 87e5431..0000000 --- a/json/fluid-calendar.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "Fluid-Calendar", - "slug": "fluid-calendar", - "categories": [ - 19, - 0 - ], - "date_created": "2025-03-04", - "type": "ct", - "updateable": true, - "privileged": false, - "interface_port": 3000, - "documentation": "https://github.com/dotnetfactory/fluid-calendar/tree/main/docs", - "website": "https://github.com/dotnetfactory/fluid-calendar", - "logo": "https://raw.githubusercontent.com/dotnetfactory/fluid-calendar/refs/heads/main/src/app/favicon.ico", - "description": "The open-source intelligent calendar that adapts to your workflow. Experience seamless task scheduling powered by AI, designed to make your time management effortless.", - "install_methods": [ - { - "type": "default", - "script": "ct/fluid-calendar.sh", - "resources": { - "cpu": 3, - "ram": 4096, - "hdd": 7, - "os": "Debian", - "version": "12" - } - } - ], - "default_credentials": { - "username": null, - "password": null - }, - "notes": [ - { - "text": "Creds: cat ~/fluid-calendar.creds", - "type": "info" - } - ] -} From 955f510f7b94d1f07956020c08dfc79e878bdfa8 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 11:43:54 +0100 Subject: [PATCH 07/62] new Workflow --- .github/workflows/delete_new_script.yaml | 83 ++++++++++++++++++++++++ ct/snipeit.sh | 1 + install/snipeit-install.sh | 1 + json/snipeit.json | 0 4 files changed, 85 insertions(+) create mode 100644 .github/workflows/delete_new_script.yaml create mode 100644 ct/snipeit.sh create mode 100644 install/snipeit-install.sh create mode 100644 json/snipeit.json diff --git a/.github/workflows/delete_new_script.yaml b/.github/workflows/delete_new_script.yaml new file mode 100644 index 0000000..4ce5f89 --- /dev/null +++ b/.github/workflows/delete_new_script.yaml @@ -0,0 +1,83 @@ +name: Delete Files on Issue Close (With Existence Check) + +on: + issues: + types: [closed] + +jobs: + delete-files: + runs-on: ubuntu-latest + if: contains(github.event.issue.labels.*.name, 'Migration To ProxmoxVE') + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Issue Title + id: extract_title + run: echo "TITLE=$(echo '${{ github.event.issue.title }}' | sed 's/ /_/g')" >> $GITHUB_ENV + + - name: Check if Files Exist in community-scripts/ProxmoxVE + id: check_files + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + REPO="community-scripts/ProxmoxVE" + API_URL="https://api.github.com/repos/$REPO/contents" + + FILES=( + "ct/${TITLE}.sh" + "install/${TITLE}-install.sh" + "json/${TITLE}.json" + ) + + EXISTS=false + for FILE in "${FILES[@]}"; do + STATUS=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GH_TOKEN" "$API_URL/$FILE") + if [ "$STATUS" -eq 200 ]; then + EXISTS=true + echo "$FILE exists in $REPO" + else + echo "$FILE does NOT exist in $REPO" + fi + done + + if [ "$EXISTS" = false ]; then + echo "No matching files found in $REPO. Exiting..." + exit 0 + fi + + - name: Delete Files + run: | + rm -f ct/${TITLE}.sh + rm -f install/${TITLE}-install.sh + rm -f json/${TITLE}.json + + - name: Commit and Push Changes + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add . + if git diff --staged --quiet; then + echo "No files to delete. Exiting..." + exit 0 + fi + git commit -m "Deleted files for issue: ${{ github.event.issue.title }}" + git push origin main + echo "COMMIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV + + - name: Comment on Issue + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const issue_number = context.payload.issue.number; + const commit_sha = process.env.COMMIT_SHA; + const message = `Files deleted and committed in [${commit_sha}](https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${commit_sha}).`; + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue_number, + body: message + }); diff --git a/ct/snipeit.sh b/ct/snipeit.sh new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/ct/snipeit.sh @@ -0,0 +1 @@ + diff --git a/install/snipeit-install.sh b/install/snipeit-install.sh new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/install/snipeit-install.sh @@ -0,0 +1 @@ + diff --git a/json/snipeit.json b/json/snipeit.json new file mode 100644 index 0000000..e69de29 From 064f2faf20de6104cd5cacb45fff83148f5755e6 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 11:46:10 +0100 Subject: [PATCH 08/62] new Workflow --- .github/workflows/delete_new_script.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/delete_new_script.yaml b/.github/workflows/delete_new_script.yaml index 4ce5f89..86db1da 100644 --- a/.github/workflows/delete_new_script.yaml +++ b/.github/workflows/delete_new_script.yaml @@ -14,9 +14,9 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} - - name: Extract Issue Title + - name: Extract Issue Title (Lowercase & Underscores) id: extract_title - run: echo "TITLE=$(echo '${{ github.event.issue.title }}' | sed 's/ /_/g')" >> $GITHUB_ENV + run: echo "TITLE=$(echo '${{ github.event.issue.title }}' | tr '[:upper:]' '[:lower:]' | sed 's/ /_/g')" >> $GITHUB_ENV - name: Check if Files Exist in community-scripts/ProxmoxVE id: check_files From 52e8bf9ba596027af5130baab17f2f6c1ad0eb70 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 11:50:20 +0100 Subject: [PATCH 09/62] WF --- .github/workflows/delete_new_script.yaml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/delete_new_script.yaml b/.github/workflows/delete_new_script.yaml index 86db1da..fd3e58f 100644 --- a/.github/workflows/delete_new_script.yaml +++ b/.github/workflows/delete_new_script.yaml @@ -50,22 +50,28 @@ jobs: - name: Delete Files run: | - rm -f ct/${TITLE}.sh - rm -f install/${TITLE}-install.sh - rm -f json/${TITLE}.json - name: Commit and Push Changes run: | + branch=$(echo "delete-files_${{ github.event.issue.number }}_${TITLE}" | tr '[:upper:]' '[:lower:]' | sed 's/ /_/g') git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" + git checkout -b $branch + rm -f ct/${TITLE}.sh + rm -f install/${TITLE}-install.sh + rm -f json/${TITLE}.json git add . if git diff --staged --quiet; then echo "No files to delete. Exiting..." exit 0 fi git commit -m "Deleted files for issue: ${{ github.event.issue.title }}" - git push origin main - echo "COMMIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV + git push origin branch + gh pr create --title "Delete Files for Issue: ${{ github.event.issue.title }}" --body "Files deleted and committed in $COMMIT_SHA." --base main --head $branch + + pr_number=$(gh pr list | grep -m 1 $branch | awk '{print $1}') + #gh pr merge $pr_number --squash + echo pr_number=$pr_number >> $GITHUB_ENV - name: Comment on Issue uses: actions/github-script@v7 @@ -73,8 +79,8 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const issue_number = context.payload.issue.number; - const commit_sha = process.env.COMMIT_SHA; - const message = `Files deleted and committed in [${commit_sha}](https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${commit_sha}).`; + + const message = `Files deleted with PR_#${process.env.pr_number}.`; github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, From 1f0f3b2f97ae3399c9f87e15e6818c73f2d0337b Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 11:52:04 +0100 Subject: [PATCH 10/62] WF --- .github/workflows/delete_new_script.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/delete_new_script.yaml b/.github/workflows/delete_new_script.yaml index fd3e58f..dd492ae 100644 --- a/.github/workflows/delete_new_script.yaml +++ b/.github/workflows/delete_new_script.yaml @@ -66,7 +66,7 @@ jobs: exit 0 fi git commit -m "Deleted files for issue: ${{ github.event.issue.title }}" - git push origin branch + git push origin $branch gh pr create --title "Delete Files for Issue: ${{ github.event.issue.title }}" --body "Files deleted and committed in $COMMIT_SHA." --base main --head $branch pr_number=$(gh pr list | grep -m 1 $branch | awk '{print $1}') From ac1cd08efe02c7fb79bf944d5f9e90dd57dcfec8 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 11:53:05 +0100 Subject: [PATCH 11/62] WF --- .github/workflows/delete_new_script.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/delete_new_script.yaml b/.github/workflows/delete_new_script.yaml index dd492ae..3456ffe 100644 --- a/.github/workflows/delete_new_script.yaml +++ b/.github/workflows/delete_new_script.yaml @@ -1,4 +1,4 @@ -name: Delete Files on Issue Close (With Existence Check) +name: Delete Files on Issue Close on: issues: @@ -48,10 +48,9 @@ jobs: exit 0 fi - - name: Delete Files - run: | - - name: Commit and Push Changes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | branch=$(echo "delete-files_${{ github.event.issue.number }}_${TITLE}" | tr '[:upper:]' '[:lower:]' | sed 's/ /_/g') git config --global user.name "github-actions[bot]" From 1d516cae3ce151c9b7ee26bbb916956297cdaf3a Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 11:54:52 +0100 Subject: [PATCH 12/62] WF --- .github/workflows/delete_new_script.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/delete_new_script.yaml b/.github/workflows/delete_new_script.yaml index 3456ffe..3b28f3e 100644 --- a/.github/workflows/delete_new_script.yaml +++ b/.github/workflows/delete_new_script.yaml @@ -66,7 +66,7 @@ jobs: fi git commit -m "Deleted files for issue: ${{ github.event.issue.title }}" git push origin $branch - gh pr create --title "Delete Files for Issue: ${{ github.event.issue.title }}" --body "Files deleted and committed in $COMMIT_SHA." --base main --head $branch + gh pr create --title "Delete Files for ${{ github.event.issue.title }} after Merge to Main" --body "Delete files after merge in main repo." --base main --head $branch pr_number=$(gh pr list | grep -m 1 $branch | awk '{print $1}') #gh pr merge $pr_number --squash @@ -79,7 +79,7 @@ jobs: script: | const issue_number = context.payload.issue.number; - const message = `Files deleted with PR_#${process.env.pr_number}.`; + const message = `Files deleted with PR #${process.env.pr_number}`; github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, From 442bb5176001137028fb661443450b21d03bf43e Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 13 Mar 2025 12:04:40 +0100 Subject: [PATCH 13/62] Add CryptPad script for testing --- ct/cryptpad.sh | 64 ++++++++++++++++++++++++++++++ install/cryptpad-install.sh | 79 +++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 ct/cryptpad.sh create mode 100644 install/cryptpad-install.sh diff --git a/ct/cryptpad.sh b/ct/cryptpad.sh new file mode 100644 index 0000000..659d447 --- /dev/null +++ b/ct/cryptpad.sh @@ -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: SlaviΕ‘a AreΕΎina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/cryptpad/cryptpad + +APP="CryptPad" +var_tags="docs;office" +var_cpu="1" +var_ram="1024" +var_disk="6" +var_os="debian" +var_version="12" +var_unprivileged="1" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d "/opt/cryptpad" ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/cryptpad/cryptpad/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Stopping $APP" + systemctl stop cryptpad + msg_ok "Stopped $APP" + + msg_info "Updating $APP to ${RELEASE}" + cd /opt/cryptpad + $STD git fetch origin --tags + $STD git checkout $RELEASE + $STD npm ci + $STD npm run install:components + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated $APP to ${RELEASE}" + + msg_info "Starting $APP" + systemctl start cryptpad + msg_ok "Started $APP" + + msg_ok "Update Successful" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + 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 "${TAB}${GATEWAY}${BGN}http://${IP}:8000${CL}" diff --git a/install/cryptpad-install.sh b/install/cryptpad-install.sh new file mode 100644 index 0000000..0b57872 --- /dev/null +++ b/install/cryptpad-install.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: SlaviΕ‘a AreΕΎina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/cryptpad/cryptpad + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + sudo \ + mc \ + gnupg \ + git +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Setup Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Setup Node.js" + +msg_info "Setup ${APPLICATION}" +RELEASE=$(curl -s https://api.github.com/repos/cryptpad/cryptpad/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +cd /opt +$STD git clone https://github.com/cryptpad/cryptpad.git cryptpad +cd cryptpad +$STD git checkout $RELEASE +$STD npm ci +$STD npm run install:components +$STD bash -c ./install-onlyoffice.sh +cp config/config.example.js config/config.js +sed -i '80s/localhost/0.0.0.0/g' /opt/cryptpad/config/config.js +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Setup ${APPLICATION}" + +msg_info "Creating Service" +cat </etc/systemd/system/cryptpad.service +[Unit] +Description=CryptPad Service +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/cryptpad +ExecStart=/usr/bin/node server +Environment='PWD="/opt/cryptpad"' +StandardOutput=journal +StandardError=journal+console +LimitNOFILE=1000000 +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now cryptpad +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" From 6eca258e9c6716d2a2075561f1348bf25428d2eb Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 13 Mar 2025 12:21:27 +0100 Subject: [PATCH 14/62] test --- install/cryptpad-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/cryptpad-install.sh b/install/cryptpad-install.sh index 0b57872..90bbf69 100644 --- a/install/cryptpad-install.sh +++ b/install/cryptpad-install.sh @@ -41,7 +41,7 @@ cd cryptpad $STD git checkout $RELEASE $STD npm ci $STD npm run install:components -$STD bash -c ./install-onlyoffice.sh +#$STD bash -c ./install-onlyoffice.sh cp config/config.example.js config/config.js sed -i '80s/localhost/0.0.0.0/g' /opt/cryptpad/config/config.js echo "${RELEASE}" >/opt/${APPLICATION}_version.txt From ce2d3bd1bb613fd92ccf519c95baf241f19d48eb Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 13 Mar 2025 12:37:01 +0100 Subject: [PATCH 15/62] fix sed --- install/cryptpad-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/cryptpad-install.sh b/install/cryptpad-install.sh index 90bbf69..1c7e7f4 100644 --- a/install/cryptpad-install.sh +++ b/install/cryptpad-install.sh @@ -43,7 +43,7 @@ $STD npm ci $STD npm run install:components #$STD bash -c ./install-onlyoffice.sh cp config/config.example.js config/config.js -sed -i '80s/localhost/0.0.0.0/g' /opt/cryptpad/config/config.js +sed -i "80s#//httpAddress: 'localhost'#httpAddress: '0.0.0.0'#g" /opt/cryptpad/config/config.js echo "${RELEASE}" >/opt/${APPLICATION}_version.txt msg_ok "Setup ${APPLICATION}" From 41f5138c3de22d97ccd0fe92859a6452d1fa4781 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 13 Mar 2025 12:55:52 +0100 Subject: [PATCH 16/62] add onlyoffice --- ct/cryptpad.sh | 2 +- install/cryptpad-install.sh | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ct/cryptpad.sh b/ct/cryptpad.sh index 659d447..12a0ca6 100644 --- a/ct/cryptpad.sh +++ b/ct/cryptpad.sh @@ -61,4 +61,4 @@ 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 "${TAB}${GATEWAY}${BGN}http://${IP}:8000${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}" diff --git a/install/cryptpad-install.sh b/install/cryptpad-install.sh index 1c7e7f4..9b4ad7c 100644 --- a/install/cryptpad-install.sh +++ b/install/cryptpad-install.sh @@ -33,6 +33,8 @@ $STD apt-get update $STD apt-get install -y nodejs msg_ok "Setup Node.js" +read -p "Do you want to install OnlyOffice components? (Y/N): " onlyoffice + msg_info "Setup ${APPLICATION}" RELEASE=$(curl -s https://api.github.com/repos/cryptpad/cryptpad/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') cd /opt @@ -41,9 +43,12 @@ cd cryptpad $STD git checkout $RELEASE $STD npm ci $STD npm run install:components -#$STD bash -c ./install-onlyoffice.sh cp config/config.example.js config/config.js sed -i "80s#//httpAddress: 'localhost'#httpAddress: '0.0.0.0'#g" /opt/cryptpad/config/config.js +if [[ "$onlyoffice" =~ ^[Yy]$ ]]; then + sed '24d' install-onlyoffice.sh + $STD bash -c ./install-onlyoffice.sh +fi echo "${RELEASE}" >/opt/${APPLICATION}_version.txt msg_ok "Setup ${APPLICATION}" From 7d7a467d6d2cb0836091ecd527486c4d86c206c8 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 13 Mar 2025 13:15:34 +0100 Subject: [PATCH 17/62] delete ask for license --- install/cryptpad-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/cryptpad-install.sh b/install/cryptpad-install.sh index 9b4ad7c..91619c8 100644 --- a/install/cryptpad-install.sh +++ b/install/cryptpad-install.sh @@ -46,7 +46,7 @@ $STD npm run install:components cp config/config.example.js config/config.js sed -i "80s#//httpAddress: 'localhost'#httpAddress: '0.0.0.0'#g" /opt/cryptpad/config/config.js if [[ "$onlyoffice" =~ ^[Yy]$ ]]; then - sed '24d' install-onlyoffice.sh + sed '24d' /opt/cryptpad/install-onlyoffice.sh $STD bash -c ./install-onlyoffice.sh fi echo "${RELEASE}" >/opt/${APPLICATION}_version.txt From 78c74bd282551f85b65f21e779eafacd1c806a08 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 13 Mar 2025 13:23:23 +0100 Subject: [PATCH 18/62] accept license --- install/cryptpad-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/cryptpad-install.sh b/install/cryptpad-install.sh index 91619c8..3ca702a 100644 --- a/install/cryptpad-install.sh +++ b/install/cryptpad-install.sh @@ -46,8 +46,8 @@ $STD npm run install:components cp config/config.example.js config/config.js sed -i "80s#//httpAddress: 'localhost'#httpAddress: '0.0.0.0'#g" /opt/cryptpad/config/config.js if [[ "$onlyoffice" =~ ^[Yy]$ ]]; then - sed '24d' /opt/cryptpad/install-onlyoffice.sh - $STD bash -c ./install-onlyoffice.sh + #sed '24d' /opt/cryptpad/install-onlyoffice.sh + $STD bash -c ./install-onlyoffice.sh --accept-license fi echo "${RELEASE}" >/opt/${APPLICATION}_version.txt msg_ok "Setup ${APPLICATION}" From 67c6257d40a71c090145d8dabd40b2e4529982f4 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 13 Mar 2025 13:48:11 +0100 Subject: [PATCH 19/62] fix --- install/cryptpad-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/cryptpad-install.sh b/install/cryptpad-install.sh index 3ca702a..e47fb9b 100644 --- a/install/cryptpad-install.sh +++ b/install/cryptpad-install.sh @@ -47,7 +47,7 @@ cp config/config.example.js config/config.js sed -i "80s#//httpAddress: 'localhost'#httpAddress: '0.0.0.0'#g" /opt/cryptpad/config/config.js if [[ "$onlyoffice" =~ ^[Yy]$ ]]; then #sed '24d' /opt/cryptpad/install-onlyoffice.sh - $STD bash -c ./install-onlyoffice.sh --accept-license + $STD bash -c "./install-onlyoffice.sh --accept-license" fi echo "${RELEASE}" >/opt/${APPLICATION}_version.txt msg_ok "Setup ${APPLICATION}" From beca1da3f2ad255227d0bf22d391d6c30bb94dc3 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 13 Mar 2025 13:48:52 +0100 Subject: [PATCH 20/62] asd --- install/cryptpad-install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/install/cryptpad-install.sh b/install/cryptpad-install.sh index e47fb9b..cdd74f7 100644 --- a/install/cryptpad-install.sh +++ b/install/cryptpad-install.sh @@ -46,7 +46,6 @@ $STD npm run install:components cp config/config.example.js config/config.js sed -i "80s#//httpAddress: 'localhost'#httpAddress: '0.0.0.0'#g" /opt/cryptpad/config/config.js if [[ "$onlyoffice" =~ ^[Yy]$ ]]; then - #sed '24d' /opt/cryptpad/install-onlyoffice.sh $STD bash -c "./install-onlyoffice.sh --accept-license" fi echo "${RELEASE}" >/opt/${APPLICATION}_version.txt From a81f3cce0d67370f29a52fab128a2f91f05306ea Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 13 Mar 2025 13:55:41 +0100 Subject: [PATCH 21/62] scale up storage --- ct/cryptpad.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/cryptpad.sh b/ct/cryptpad.sh index 12a0ca6..121ec0e 100644 --- a/ct/cryptpad.sh +++ b/ct/cryptpad.sh @@ -9,7 +9,7 @@ APP="CryptPad" var_tags="docs;office" var_cpu="1" var_ram="1024" -var_disk="6" +var_disk="8" var_os="debian" var_version="12" var_unprivileged="1" From 472cc1adb512e6840409315c372f10ccbb2de7e4 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 13:58:12 +0100 Subject: [PATCH 22/62] WF --- .../get-versions-from-newreleases.yaml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/get-versions-from-newreleases.yaml diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml new file mode 100644 index 0000000..2e09aa5 --- /dev/null +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -0,0 +1,43 @@ +name: Move new Scripts to Main Repository + +on: + workflow_dispatch: + +permissions: + contents: write + +jobs: + move-to-main-repo: + runs-on: ubuntu-latest + + steps: + - name: Crawl from newreleases.io + env: + token: ${{ secrets.NEWRELEASES_TOKEN }} + run: | + projects=$(curl -H "X-Key: $TOKEN" \ + https://api.newreleases.io/v1/projects) + echo $projects > project_json + fi + + jq -r '.projects[] | "\(.id) \(.name)"' project_json | while read -r id name; do + version=$(curl -H "X-Key: $TOKEN" \ + https://api.newreleases.io/v1/projects/$id/latest-release) + + echo "Project Name: $name, Project ID: $id, Version: $version" + jq -n --arg name "$name" --arg version "$version" '{name: $name, version: $version}' > json/versions.json + + done + + - name: Checkout Repository + uses: actions/checkout@v2 + with: + repository: community-scripts/ProxmoxVED + ref: main + - name: Commit JSON + run: | + git config --global user.email "Github Actions[bot] + git config --global user.name "GitHub Actions" + git add json/versions.json + git commit -m "Add new script" + git push From aea95d76a7f8eef54f6db816c71790c43216c278 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 13:59:03 +0100 Subject: [PATCH 23/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index 2e09aa5..faecd2a 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -1,4 +1,4 @@ -name: Move new Scripts to Main Repository +name: Crawl Versions from newreleases.io on: workflow_dispatch: From baa029af13900f6aa9a7fca2088f0d0fd1f5137f Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 13:59:53 +0100 Subject: [PATCH 24/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index faecd2a..80c9d2c 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -18,7 +18,6 @@ jobs: projects=$(curl -H "X-Key: $TOKEN" \ https://api.newreleases.io/v1/projects) echo $projects > project_json - fi jq -r '.projects[] | "\(.id) \(.name)"' project_json | while read -r id name; do version=$(curl -H "X-Key: $TOKEN" \ From d9407023ecf1fab50b9b08aa25b1d539d3535896 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:00:33 +0100 Subject: [PATCH 25/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index 80c9d2c..ba63d8e 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -35,7 +35,7 @@ jobs: ref: main - name: Commit JSON run: | - git config --global user.email "Github Actions[bot] + git config --global user.email "Github Actions[bot]" git config --global user.name "GitHub Actions" git add json/versions.json git commit -m "Add new script" From 68e4dcbe8dfa7fdce9fe601b3026a7cda9deebd8 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:01:46 +0100 Subject: [PATCH 26/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index ba63d8e..e6682ad 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -11,6 +11,12 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + repository: community-scripts/ProxmoxVED + ref: main + - name: Crawl from newreleases.io env: token: ${{ secrets.NEWRELEASES_TOKEN }} @@ -25,14 +31,8 @@ jobs: echo "Project Name: $name, Project ID: $id, Version: $version" jq -n --arg name "$name" --arg version "$version" '{name: $name, version: $version}' > json/versions.json - done - - name: Checkout Repository - uses: actions/checkout@v2 - with: - repository: community-scripts/ProxmoxVED - ref: main - name: Commit JSON run: | git config --global user.email "Github Actions[bot]" From 91ba7b8cb6a6e322eebd944d216e7c86857f655c Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 13 Mar 2025 14:03:32 +0100 Subject: [PATCH 27/62] fix url --- install/cryptpad-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/cryptpad-install.sh b/install/cryptpad-install.sh index cdd74f7..1221188 100644 --- a/install/cryptpad-install.sh +++ b/install/cryptpad-install.sh @@ -44,6 +44,8 @@ $STD git checkout $RELEASE $STD npm ci $STD npm run install:components cp config/config.example.js config/config.js +IP=$(hostname -I | awk '{print $1}') +sed -i "51s/localhost/${IP}/g" /opt/cryptpad/config/config.js sed -i "80s#//httpAddress: 'localhost'#httpAddress: '0.0.0.0'#g" /opt/cryptpad/config/config.js if [[ "$onlyoffice" =~ ^[Yy]$ ]]; then $STD bash -c "./install-onlyoffice.sh --accept-license" From 9ec17d45c764d1612195cc3d88bfa5babdeafcd8 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:03:56 +0100 Subject: [PATCH 28/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index e6682ad..0a013fe 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -28,7 +28,7 @@ jobs: jq -r '.projects[] | "\(.id) \(.name)"' project_json | while read -r id name; do version=$(curl -H "X-Key: $TOKEN" \ https://api.newreleases.io/v1/projects/$id/latest-release) - + ls -l echo "Project Name: $name, Project ID: $id, Version: $version" jq -n --arg name "$name" --arg version "$version" '{name: $name, version: $version}' > json/versions.json done From 8aae51a4c73b2d9b34509007eb8f9f6b14e75fea Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 13 Mar 2025 14:09:42 +0100 Subject: [PATCH 29/62] Update build.func --- misc/build.func | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/misc/build.func b/misc/build.func index 89530a8..24ef7f7 100644 --- a/misc/build.func +++ b/misc/build.func @@ -361,8 +361,6 @@ base_settings() { RAM_SIZE=${var_ram:-$RAM_SIZE} VERB=${var_verbose:-$VERBOSE} TAGS="${TAGS}${var_tags:-}" - ENABLE_NFS=${var_nfs:-$ENABLE_NFS} - ENABLE_CIFS=${var_cifs:-$ENABLE_CIFS} ENABLE_FUSE=${var_fuse:-$ENABLE_FUSE} # Since these 2 are only defined outside of default_settings function, we add a temporary fallback. TODO: To align everything, we should add these as constant variables (e.g. OSTYPE and OSVERSION), but that would currently require updating the default_settings function for all existing scripts @@ -820,23 +818,7 @@ advanced_settings() { else SSH_AUTHORIZED_KEY="" fi - # NFS Feature Selection - if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "NFS Support" --yesno "Enable NFS support in the container?" 10 58); then - ENABLE_NFS="yes" - else - ENABLE_NFS="no" - fi - echo -e "${NFS}${BOLD}${DGN}NFS Support: ${BGN}$ENABLE_NFS${CL}" - # CIFS Feature Selection - if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "CIFS Support" --yesno "Enable CIFS (Samba) support in the container?" 10 58); then - ENABLE_CIFS="yes" - else - ENABLE_CIFS="no" - fi - echo -e "${CIFS}${BOLD}${DGN}CIFS (Samba) Support: ${BGN}$ENABLE_CIFS${CL}" - - # FUSE Feature Selection if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "FUSE Support" --yesno "Enable FUSE (Filesystem in Userspace) support in the container?" 10 58); then ENABLE_FUSE="yes" else @@ -1110,14 +1092,6 @@ build_container() { FEATURES="nesting=1" fi - if [ "$ENABLE_NFS" == "yes" ]; then - FEATURES+=",nfs=1" - fi - - if [ "$ENABLE_CIFS" == "yes" ]; then - FEATURES+=",cifs=1" - fi - if [ "$ENABLE_FUSE" == "yes" ]; then FEATURES+=",fuse=1" fi From f0c9be70a47a35392912d620a54ffa38231d762a Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 13 Mar 2025 14:09:57 +0100 Subject: [PATCH 30/62] Create seafile-install.sh --- install/seafile-install.sh | 298 +++++++++++++++++++++++++++++++++++++ 1 file changed, 298 insertions(+) create mode 100644 install/seafile-install.sh diff --git a/install/seafile-install.sh b/install/seafile-install.sh new file mode 100644 index 0000000..b5fadf7 --- /dev/null +++ b/install/seafile-install.sh @@ -0,0 +1,298 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: dave-yap +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://seafile.com/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get install -y \ + sudo \ + mc \ + wget \ + curl \ + xmlstarlet \ + expect +msg_ok "Installed Dependencies" + +msg_info "Installing MariaDB" +$STD apt-get install -y mariadb-server +systemctl start mariadb +msg_ok "Installed MariaDB" + +msg_info "Setup MariaDB for Seafile" +CCNET_DB="ccnet_db" +SEAFILE_DB="seafile_db" +SEAHUB_DB="seahub_db" +DB_USER="seafile" +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13) +ADMIN_EMAIL="admin@localhost.local" +ADMIN_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13) +sudo -u mysql mysql -s -e "CREATE DATABASE $CCNET_DB CHARACTER SET utf8;" +sudo -u mysql mysql -s -e "CREATE DATABASE $SEAFILE_DB CHARACTER SET utf8;" +sudo -u mysql mysql -s -e "CREATE DATABASE $SEAHUB_DB CHARACTER SET utf8;" +sudo -u mysql mysql -s -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';" +sudo -u mysql mysql -s -e "GRANT ALL PRIVILEGES ON $CCNET_DB.* TO '$DB_USER'@localhost;" +sudo -u mysql mysql -s -e "GRANT ALL PRIVILEGES ON $SEAFILE_DB.* TO '$DB_USER'@localhost;" +sudo -u mysql mysql -s -e "GRANT ALL PRIVILEGES ON $SEAHUB_DB.* TO '$DB_USER'@localhost;" +{ + echo "Application Credentials" + echo "CCNET_DB: $CCNET_DB" + echo "SEAFILE_DB: $SEAFILE_DB" + echo "SEAHUB_DB: $SEAHUB_DB" + echo "DB_USER: $DB_USER" + echo "DB_PASS: $DB_PASS" + echo "ADMIN_EMAIL: $ADMIN_EMAIL" + echo "ADMIN_PASS: $ADMIN_PASS" +} >> ~/seafile.creds +msg_ok "MariaDB setup for Seafile" + +msg_info "Installing Seafile Python Dependencies" +$STD apt-get install -y \ + python3 \ + python3-dev \ + python3-setuptools \ + python3-pip \ + libmariadb-dev \ + ldap-utils \ + libldap2-dev \ + libsasl2-dev \ + pkg-config +$STD pip3 install \ + django \ + future \ + mysqlclient \ + pymysql \ + pillow \ + pylibmc \ + captcha \ + markupsafe \ + jinja2 \ + sqlalchemy \ + psd-tools \ + django-pylibmc \ + django_simple_captcha \ + djangosaml2 \ + pysaml2 \ + pycryptodome \ + cffi \ + lxml \ + python-ldap +msg_ok "Installed Seafile Python Dependecies" + +msg_info "Installing Seafile" +IP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1) +mkdir -p /opt/seafile +useradd seafile +mkdir -p /home/seafile +chown seafile: /home/seafile +chown seafile: /opt/seafile +mkdir -p /opt/conf +chown seafile:seafile /opt/conf +chmod 755 /opt/conf +mkdir -p /opt/ccnet +chown seafile:seafile /opt/ccnet +chmod 755 /opt/ccnet +chown -R seafile:seafile /opt/conf +chmod -R 755 /opt/conf +LATEST_FILE=$(curl -s "https://download.seadrive.org/" | \ + xmlstarlet sel -N s3="http://s3.amazonaws.com/doc/2006-03-01/" \ + -t -m "//s3:Contents[s3:Key[starts-with(text(),'seafile-server')]]" \ + -v "s3:LastModified" -o " " -v "s3:Key" -n | \ + sort -r | head -n1 | awk '{print $2}') + + +$STD su - seafile -c "wget -qc https://s3.eu-central-1.amazonaws.com/download.seadrive.org/$LATEST_FILE" +$STD su - seafile -c "tar -xzf $LATEST_FILE --strip-components=1 -C /opt/seafile/" +$STD su - seafile -c "expect <>/opt/seafile/conf/seahub_settings.py +CACHES = { + 'default': { + 'BACKEND': 'django_pylibmc.memcached.PyLibMCCache', + 'LOCATION': '127.0.0.1:11211', + }, +} +EOF +msg_ok "Memcached Started" + +msg_info "Adjusting Conf files" +sed -i "0,/127.0.0.1/s/127.0.0.1/0.0.0.0/" /opt/seafile/conf/gunicorn.conf.py +sed -i "0,/SERVICE_URL = \"http:\/\/$IP\"/s/SERVICE_URL = \"http:\/\/$IP\"/SERVICE_URL = \"http:\/\/$IP:8000\"/" /opt/seafile/conf/seahub_settings.py +echo -e "\nFILE_SERVER_ROOT = \"http://$IP:8082\"" >> /opt/seafile/conf/seahub_settings.py +echo -e "CSRF_TRUSTED_ORIGINS = ['http://$IP/']" >> /opt/seafile/conf/seahub_settings.py +msg_ok "Conf files adjusted" + +msg_info "Setting up Seafile" +$STD su - seafile -c "bash /opt/seafile/seafile-server-latest/seafile.sh start" +$STD su - seafile -c "expect </etc/systemd/system/seafile.service +[Unit] +Description=Seafile File-hosting +After=network.target mysql.service memcached.service +Wants=mysql.service memcached.service + +[Service] +Type=forking +User=seafile +Group=seafile +WorkingDirectory=/opt/seafile + +ExecStart=/opt/seafile/seafile-server-latest/seafile.sh start +ExecStartPost=/opt/seafile/seafile-server-latest/seahub.sh start +ExecStop=/opt/seafile/seafile-server-latest/seahub.sh stop +ExecStop=/opt/seafile/seafile-server-latest/seafile.sh stop + +Restart=on-failure +RestartSec=5s + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable --now -q seafile.service +msg_ok "Created Services" + +msg_info "Creating External Storage script" +cat <<'EOF' >~/external-storage.sh +#!/bin/bash +STORAGE_DIR="/path/to/your/external/storage" + +# Move the seafile-data folder to external storage +mv /opt/seafile/seafile-data $STORAGE_DIR/seafile-data + +# Create a symlink for access +ln -s $STORAGE_DIR/seafile-data /opt/seafile/seafile-data +EOF +chmod +x ~/external-storage.sh +msg_ok "Bash Script for External Storage created" + +msg_info "Creating Domain access script" +cat <<'EOF' >~/domain.sh +#!/bin/bash +DOMAIN=$1 +IP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1) +DOMAIN_NOSCHEME=$(echo $DOMAIN | sed 's|^https://||') + +#Change the CORS to provided domain +sed -i "s|CSRF_TRUSTED_ORIGINS = ['http://$IP:8000/']|CSRF_TRUSTED_ORIGINS = ['$DOMAIN']|g" /opt/seafile/conf/seahub_settings.py +sed -i "s|FILE_SERVER_ROOT = \"http://$IP:8082\"|FILE_SERVER_ROOT = \"$DOMAIN/seafhttp\"|g" /opt/seafile/conf/seahub_settings.py +EOF +chmod +x ~/domain.sh +msg_ok "Bash Script for Domain access created" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf /home/seafile/seafile*.tar.gz +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" From 21d741560320c5a7edec320dd96472e4ad0aec3b Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:10:49 +0100 Subject: [PATCH 31/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index 0a013fe..6e66a80 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -21,6 +21,7 @@ jobs: env: token: ${{ secrets.NEWRELEASES_TOKEN }} run: | + ls -l projects=$(curl -H "X-Key: $TOKEN" \ https://api.newreleases.io/v1/projects) echo $projects > project_json From 96419f497cb6d715c4a4c02226134dc6f24f6589 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:13:18 +0100 Subject: [PATCH 32/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index 6e66a80..22f00c8 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -24,6 +24,7 @@ jobs: ls -l projects=$(curl -H "X-Key: $TOKEN" \ https://api.newreleases.io/v1/projects) + echo $projects echo $projects > project_json jq -r '.projects[] | "\(.id) \(.name)"' project_json | while read -r id name; do From c14c1b60da60a42dca9b194c59cb912390bed788 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:19:12 +0100 Subject: [PATCH 33/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index 22f00c8..89d3f9e 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -22,13 +22,13 @@ jobs: token: ${{ secrets.NEWRELEASES_TOKEN }} run: | ls -l - projects=$(curl -H "X-Key: $TOKEN" \ + projects=$(curl -H "X-Key: $token" \ https://api.newreleases.io/v1/projects) echo $projects echo $projects > project_json jq -r '.projects[] | "\(.id) \(.name)"' project_json | while read -r id name; do - version=$(curl -H "X-Key: $TOKEN" \ + version=$(curl -H "X-Key: $token" \ https://api.newreleases.io/v1/projects/$id/latest-release) ls -l echo "Project Name: $name, Project ID: $id, Version: $version" From f518b7e3df8beb738be9ada787b96065c61c06c8 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:19:55 +0100 Subject: [PATCH 34/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index 89d3f9e..d13b82b 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -30,7 +30,6 @@ jobs: jq -r '.projects[] | "\(.id) \(.name)"' project_json | while read -r id name; do version=$(curl -H "X-Key: $token" \ https://api.newreleases.io/v1/projects/$id/latest-release) - ls -l echo "Project Name: $name, Project ID: $id, Version: $version" jq -n --arg name "$name" --arg version "$version" '{name: $name, version: $version}' > json/versions.json done @@ -41,4 +40,4 @@ jobs: git config --global user.name "GitHub Actions" git add json/versions.json git commit -m "Add new script" - git push + git push --force From 4400176bee1cebed5467fdc970953f47a8f5479b Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:25:11 +0100 Subject: [PATCH 35/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index d13b82b..0dcdc8d 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -35,9 +35,11 @@ jobs: done - name: Commit JSON + env: + GITHUB_TOKEN: ${{ secrets.PAT_MICHEL }} run: | git config --global user.email "Github Actions[bot]" git config --global user.name "GitHub Actions" git add json/versions.json - git commit -m "Add new script" + git commit -m "Update versions.json" git push --force From 05b65ece7b9d9e3769038e475e5e10d08ffd1a3b Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:26:05 +0100 Subject: [PATCH 36/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index 0dcdc8d..0a526b5 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -24,13 +24,11 @@ jobs: ls -l projects=$(curl -H "X-Key: $token" \ https://api.newreleases.io/v1/projects) - echo $projects echo $projects > project_json - jq -r '.projects[] | "\(.id) \(.name)"' project_json | while read -r id name; do version=$(curl -H "X-Key: $token" \ https://api.newreleases.io/v1/projects/$id/latest-release) - echo "Project Name: $name, Project ID: $id, Version: $version" + jq -n --arg name "$name" --arg version "$version" '{name: $name, version: $version}' > json/versions.json done @@ -38,8 +36,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.PAT_MICHEL }} run: | - git config --global user.email "Github Actions[bot]" - git config --global user.name "GitHub Actions" + git config --global user.email "michel.roegl-brunner@htl-braunau.at" + git config --global user.name "GitHub Actions[bot]" git add json/versions.json git commit -m "Update versions.json" git push --force From 82012b3e4693e74f16ec0d79fdc7f5b2eec76c9a Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:27:10 +0100 Subject: [PATCH 37/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index 0a526b5..68b76b1 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -36,6 +36,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.PAT_MICHEL }} run: | + gh auth login --with-token <<< $GITHUB_TOKEN + gh auth status git config --global user.email "michel.roegl-brunner@htl-braunau.at" git config --global user.name "GitHub Actions[bot]" git add json/versions.json From 8258a03a55da04eedaee7b9691cf2a358720d930 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:28:10 +0100 Subject: [PATCH 38/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index 68b76b1..6375de7 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -34,9 +34,9 @@ jobs: - name: Commit JSON env: - GITHUB_TOKEN: ${{ secrets.PAT_MICHEL }} + TOKEN: ${{ secrets.PAT_MICHEL }} run: | - gh auth login --with-token <<< $GITHUB_TOKEN + gh auth login --with-token <<< $TOKEN gh auth status git config --global user.email "michel.roegl-brunner@htl-braunau.at" git config --global user.name "GitHub Actions[bot]" From c5160003c57c0bb18651af948c1ec7424d4bd7a1 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 13 Mar 2025 14:30:55 +0100 Subject: [PATCH 39/62] Update npmplus-install.sh --- install/npmplus-install.sh | 45 +++++++++++++++----------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/install/npmplus-install.sh b/install/npmplus-install.sh index f8521df..218efbb 100644 --- a/install/npmplus-install.sh +++ b/install/npmplus-install.sh @@ -41,10 +41,10 @@ curl -sSL https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_LA chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose msg_ok "Installed Docker & Compose" -msg_info "Get NPMplus" +msg_info "Fetching NPMplus" cd /opt wget -q https://raw.githubusercontent.com/ZoeyVid/NPMplus/refs/heads/develop/compose.yaml -msg_ok "Get NPMplus" +msg_ok "Fetched NPMplus" attempts=0 while true; do @@ -69,43 +69,34 @@ yq -i " [\"TZ=$TZ_INPUT\", \"ACME_EMAIL=$ACME_EMAIL_INPUT\"]) " /opt/compose.yaml -msg_info "Starting NPMplus" +msg_info "Building NPMplus" $STD docker compose up -d -CONTAINER_ID=$(docker ps --format "{{.ID}}" --filter "name=npmplus") - -if [[ -z "$CONTAINER_ID" ]]; then - msg_error "NPMplus container not found." -fi - -TIMEOUT=60 -while [[ $TIMEOUT -gt 0 ]]; do - STATUS=$(docker inspect --format '{{.State.Health.Status}}' "$CONTAINER_ID" 2>/dev/null) +CONTAINER_ID="" +for i in {1..30}; do + CONTAINER_ID=$(docker ps --filter "name=npmplus" --format "{{.ID}}") + if [[ -n "$CONTAINER_ID" ]]; then + STATUS=$(docker inspect --format '{{.State.Health.Status}}' "$CONTAINER_ID" 2>/dev/null || echo "starting") + if [[ "$STATUS" == "healthy" ]]; then + break + fi + fi sleep 2 - ((TIMEOUT--)) + [[ $i -eq 30 ]] && msg_error "NPMplus container did not become healthy." && exit 1 done - -if [[ "$STATUS" != "healthy" ]]; then - msg_error "NPMplus container did not reach a healthy state." -fi -msg_ok "Started NPMplus" +msg_ok "Builded NPMplus" motd_ssh customize -msg_info "Get Default Login (Patience)" -TIMEOUT=60 -while [[ $TIMEOUT -gt 0 ]]; do +msg_info "Retrieving Default Login (Patience)" +for i in {1..60}; do PASSWORD_LINE=$(docker logs "$CONTAINER_ID" 2>&1 | awk '/Creating a new user:/ {print; exit}') if [[ -n "$PASSWORD_LINE" ]]; then PASSWORD=$(echo "$PASSWORD_LINE" | awk -F 'password: ' '{print $2}') echo -e "username: admin@example.org\npassword: $PASSWORD" >/opt/.npm_pwd msg_ok "Saved default login to /opt/.npm_pwd" - break + exit 0 fi sleep 2 - ((TIMEOUT--)) + [[ $i -eq 60 ]] && msg_error "Failed to retrieve default login credentials." && exit 1 done - -if [[ $TIMEOUT -eq 0 ]]; then - msg_error "Failed to retrieve default login credentials." -fi From 1a1f66a69408cf752e070b4789997b5688aff623 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:31:52 +0100 Subject: [PATCH 40/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index 6375de7..a1eede3 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -34,12 +34,12 @@ jobs: - name: Commit JSON env: - TOKEN: ${{ secrets.PAT_MICHEL }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh auth login --with-token <<< $TOKEN - gh auth status - git config --global user.email "michel.roegl-brunner@htl-braunau.at" + git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "GitHub Actions[bot]" + git checkout -b update_versions git add json/versions.json git commit -m "Update versions.json" - git push --force + git push origin update_versions + gh pr create --title "[AUTOMATIC PR]Update versions.json" --body "Update versions.json, crawled from newreleases.io" --base main --head update_versions From 0bd49a54bf387e5fc309634eb92ce60f443bfe75 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:32:32 +0100 Subject: [PATCH 41/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index a1eede3..d027300 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -5,6 +5,7 @@ on: permissions: contents: write + pull-requests: write jobs: move-to-main-repo: From 76c6499410de260ec4cbc7711e3f51d78c5ab34c Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:34:33 +0100 Subject: [PATCH 42/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index d027300..98fc0ac 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -39,8 +39,8 @@ jobs: run: | git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "GitHub Actions[bot]" - git checkout -b update_versions + git checkout -b update_versions || git checkout update_versions git add json/versions.json - git commit -m "Update versions.json" + git commit -m "Update versions.json" --force git push origin update_versions gh pr create --title "[AUTOMATIC PR]Update versions.json" --body "Update versions.json, crawled from newreleases.io" --base main --head update_versions From 828f4ee7c2d47207cde088be3c114088e625330b Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 13 Mar 2025 14:37:06 +0100 Subject: [PATCH 43/62] Update npmplus-install.sh --- install/npmplus-install.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/install/npmplus-install.sh b/install/npmplus-install.sh index 218efbb..a71a8aa 100644 --- a/install/npmplus-install.sh +++ b/install/npmplus-install.sh @@ -69,21 +69,26 @@ yq -i " [\"TZ=$TZ_INPUT\", \"ACME_EMAIL=$ACME_EMAIL_INPUT\"]) " /opt/compose.yaml -msg_info "Building NPMplus" +msg_info "Building and Starting NPMplus (Patience)" $STD docker compose up -d CONTAINER_ID="" -for i in {1..30}; do +for i in {1..60}; do CONTAINER_ID=$(docker ps --filter "name=npmplus" --format "{{.ID}}") if [[ -n "$CONTAINER_ID" ]]; then STATUS=$(docker inspect --format '{{.State.Health.Status}}' "$CONTAINER_ID" 2>/dev/null || echo "starting") if [[ "$STATUS" == "healthy" ]]; then + msg_ok "NPMplus is running and healthy" break + elif [[ "$STATUS" == "unhealthy" ]]; then + msg_error "NPMplus container is unhealthy! Check logs." + docker logs "$CONTAINER_ID" + exit 1 fi fi sleep 2 - [[ $i -eq 30 ]] && msg_error "NPMplus container did not become healthy." && exit 1 + [[ $i -eq 60 ]] && msg_error "NPMplus container did not become healthy within 120s." && docker logs "$CONTAINER_ID" && exit 1 done -msg_ok "Builded NPMplus" +msg_ok "Builded and started NPMplus" motd_ssh customize From 54e1855a350c0d279c0c732c2d9db6c283f810c6 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:38:43 +0100 Subject: [PATCH 44/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index 98fc0ac..8ce799f 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -41,6 +41,6 @@ jobs: git config --global user.name "GitHub Actions[bot]" git checkout -b update_versions || git checkout update_versions git add json/versions.json - git commit -m "Update versions.json" --force - git push origin update_versions + git commit -m "Update versions.json" + git push origin update_versions --force gh pr create --title "[AUTOMATIC PR]Update versions.json" --body "Update versions.json, crawled from newreleases.io" --base main --head update_versions From bf2222fc74f4a8e0bc7a168f4ba69acd8359fbcb Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:43:15 +0100 Subject: [PATCH 45/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index 8ce799f..45b9dbc 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -30,7 +30,7 @@ jobs: version=$(curl -H "X-Key: $token" \ https://api.newreleases.io/v1/projects/$id/latest-release) - jq -n --arg name "$name" --arg version "$version" '{name: $name, version: $version}' > json/versions.json + jq -n --arg name "$name" --arg version "$version" '{name: $name, version: $version}' >> json/versions.json done - name: Commit JSON From b37dfe95a5427f8e6a68c162b2c182f2a00a36f3 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 14:46:48 +0100 Subject: [PATCH 46/62] WF --- .github/workflows/get-versions-from-newreleases.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index 45b9dbc..08142a8 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -25,6 +25,7 @@ jobs: ls -l projects=$(curl -H "X-Key: $token" \ https://api.newreleases.io/v1/projects) + echo $projects | jq -r '.projects[] | "\(.id) \(.name)"' echo $projects > project_json jq -r '.projects[] | "\(.id) \(.name)"' project_json | while read -r id name; do version=$(curl -H "X-Key: $token" \ From db83550cd0fc5fccf7cf8affa7ff832a8b8b2ad7 Mon Sep 17 00:00:00 2001 From: "GitHub Actions[bot]" Date: Thu, 13 Mar 2025 13:47:14 +0000 Subject: [PATCH 47/62] Update versions.json --- json/versions.json | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 json/versions.json diff --git a/json/versions.json b/json/versions.json new file mode 100644 index 0000000..a41cf86 --- /dev/null +++ b/json/versions.json @@ -0,0 +1,40 @@ +{ + "name": "msgbyte/tianji", + "version": "{\"version\":\"v1.18.21\",\"date\":\"2025-03-13T13:19:08Z\",\"has_note\":true}" +} +{ + "name": "semaphoreui/semaphore", + "version": "{\"version\":\"v2.13.0-beta3\",\"date\":\"2025-03-13T11:31:47Z\"}" +} +{ + "name": "morpheus65535/bazarr", + "version": "{\"version\":\"v1.5.1\",\"date\":\"2025-01-01T16:15:52Z\",\"has_note\":true}" +} +{ + "name": "Jackett/Jackett", + "version": "{\"version\":\"v0.22.1595\",\"date\":\"2025-03-13T05:53:09Z\",\"has_note\":true}" +} +{ + "name": "openobserve/openobserve", + "version": "{\"version\":\"v0.14.5-rc3\",\"date\":\"2025-03-13T04:09:57Z\",\"has_note\":true}" +} +{ + "name": "NodeBB/NodeBB", + "version": "{\"version\":\"v4.1.1\",\"date\":\"2025-03-12T23:10:23Z\",\"has_note\":true}" +} +{ + "name": "VictoriaMetrics/VictoriaMetrics", + "version": "{\"version\":\"v1.16.0-victorialogs\",\"date\":\"2025-03-12T22:49:54Z\",\"has_note\":true}" +} +{ + "name": "diced/zipline", + "version": "{\"version\":\"v4.0.1\",\"date\":\"2025-03-12T22:41:17Z\",\"has_note\":true}" +} +{ + "name": "Threadfin/Threadfin", + "version": "{\"version\":\"1.2.30\",\"date\":\"2025-03-12T22:32:33Z\"}" +} +{ + "name": "minio/minio", + "version": "{\"version\":\"RELEASE.2025-03-12T18-04-18Z\",\"date\":\"2025-03-12T18:45:21Z\",\"has_note\":true}" +} From 63eeb07eb456601b0d77d2387667080c4f7b4f8c Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 13 Mar 2025 14:53:36 +0100 Subject: [PATCH 48/62] add json --- json/npmplus.json | 54 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 json/npmplus.json diff --git a/json/npmplus.json b/json/npmplus.json new file mode 100644 index 0000000..c3f3912 --- /dev/null +++ b/json/npmplus.json @@ -0,0 +1,54 @@ +{ + "name": "NPMplus", + "slug": "npmplus", + "categories": [ + 21 + ], + "date_created": "2025-03-13", + "type": "ct", + "updateable": false, + "privileged": false, + "interface_port": 81, + "documentation": null, + "website": "https://github.com/ZoeyVid/NPMplus", + "logo": "https://raw.githubusercontent.com/ZoeyVid/NPMplus/refs/heads/develop/frontend/app-images/logo-256.png", + "description": "NPMplus is an enhanced version of Nginx Proxy Manager. It simplifies the process of setting up reverse proxies with TLS termination through a user-friendly web interface. Key features include HTTP/3 support, integration with CrowdSec IPS, inclusion of GoAccess for real-time log analysis, and support for ModSecurity with the Core Rule Set.", + "install_methods": [ + { + "type": "default", + "script": "ct/npmplus.sh", + "resources": { + "cpu": 1, + "ram": 512, + "hdd": 3, + "os": "alpine", + "version": "3.21" + } + }, + { + "type": "alpine", + "script": "ct/npmplus.sh", + "resources": { + "cpu": 1, + "ram": 512, + "hdd": 3, + "os": "alpine", + "version": "3.21" + } + } + ], + "default_credentials": { + "username": "root", + "password": null + }, + "notes": [ + { + "text": "The initial starting process can be take 1-2min. ", + "type": "info" + }, + { + "text": "Application credentials: Β΄cat /opt/.npm_pwdΒ΄", + "type": "info" + } + ] +} From b9a8f84a878908d9d7be784701e0d2672047d227 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Date: Thu, 13 Mar 2025 14:58:08 +0100 Subject: [PATCH 49/62] Delete json/snipeit.json --- json/snipeit.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 json/snipeit.json diff --git a/json/snipeit.json b/json/snipeit.json deleted file mode 100644 index e69de29..0000000 From 1db06d92ac739443d6dc81052401a926ee331d45 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Date: Thu, 13 Mar 2025 15:07:28 +0100 Subject: [PATCH 50/62] Delete json/versions.json --- json/versions.json | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 json/versions.json diff --git a/json/versions.json b/json/versions.json deleted file mode 100644 index a41cf86..0000000 --- a/json/versions.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "msgbyte/tianji", - "version": "{\"version\":\"v1.18.21\",\"date\":\"2025-03-13T13:19:08Z\",\"has_note\":true}" -} -{ - "name": "semaphoreui/semaphore", - "version": "{\"version\":\"v2.13.0-beta3\",\"date\":\"2025-03-13T11:31:47Z\"}" -} -{ - "name": "morpheus65535/bazarr", - "version": "{\"version\":\"v1.5.1\",\"date\":\"2025-01-01T16:15:52Z\",\"has_note\":true}" -} -{ - "name": "Jackett/Jackett", - "version": "{\"version\":\"v0.22.1595\",\"date\":\"2025-03-13T05:53:09Z\",\"has_note\":true}" -} -{ - "name": "openobserve/openobserve", - "version": "{\"version\":\"v0.14.5-rc3\",\"date\":\"2025-03-13T04:09:57Z\",\"has_note\":true}" -} -{ - "name": "NodeBB/NodeBB", - "version": "{\"version\":\"v4.1.1\",\"date\":\"2025-03-12T23:10:23Z\",\"has_note\":true}" -} -{ - "name": "VictoriaMetrics/VictoriaMetrics", - "version": "{\"version\":\"v1.16.0-victorialogs\",\"date\":\"2025-03-12T22:49:54Z\",\"has_note\":true}" -} -{ - "name": "diced/zipline", - "version": "{\"version\":\"v4.0.1\",\"date\":\"2025-03-12T22:41:17Z\",\"has_note\":true}" -} -{ - "name": "Threadfin/Threadfin", - "version": "{\"version\":\"1.2.30\",\"date\":\"2025-03-12T22:32:33Z\"}" -} -{ - "name": "minio/minio", - "version": "{\"version\":\"RELEASE.2025-03-12T18-04-18Z\",\"date\":\"2025-03-12T18:45:21Z\",\"has_note\":true}" -} From 72eb993802bc2fa99826de47384654198726bae3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 13 Mar 2025 14:32:59 +0000 Subject: [PATCH 51/62] Deleted files for issue: NPMplus --- ct/npmplus.sh | 41 -------------- install/npmplus-install.sh | 107 ------------------------------------- json/npmplus.json | 54 ------------------- 3 files changed, 202 deletions(-) delete mode 100644 ct/npmplus.sh delete mode 100644 install/npmplus-install.sh delete mode 100644 json/npmplus.json diff --git a/ct/npmplus.sh b/ct/npmplus.sh deleted file mode 100644 index 89416c3..0000000 --- a/ct/npmplus.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash -source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) -# Copyright (c) 2021-2025 tteck -# Author: tteck (tteckster) -# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE -# Source: https://alpinelinux.org/ - -APP="NPMplus" -var_tags="proxy;nginx" -var_cpu="1" -var_ram="512" -var_disk="3" -var_os="alpine" -var_version="3.21" -var_unprivileged="1" - -header_info "$APP" -variables -color -catch_errors - -function update_script() { - UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 1 \ - "1" "Check for Alpine Updates" ON \ - 3>&1 1>&2 2>&3) - - header_info - if [ "$UPD" == "1" ]; then - apk update && apk upgrade - exit - fi -} - -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 "${TAB}${GATEWAY}${BGN}https://${IP}:81${CL}" diff --git a/install/npmplus-install.sh b/install/npmplus-install.sh deleted file mode 100644 index a71a8aa..0000000 --- a/install/npmplus-install.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2021-2025 community-scripts ORG -# Author: MickLesk (CanbiZ) -# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -# Source: https://github.com/ZoeyVid/NPMplus - -source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" -color -verb_ip6 -catch_errors -setting_up_container -network_check -update_os - -msg_info "Installing Dependencies" -$STD apk add \ - newt \ - curl \ - openssh \ - tzdata \ - nano \ - gawk \ - yq \ - mc - -msg_ok "Installed Dependencies" - -msg_info "Installing Docker & Compose" -$STD apk add docker -$STD rc-service docker start -$STD rc-update add docker default - -get_latest_release() { - curl -sL https://api.github.com/repos/$1/releases/latest | grep '"tag_name":' | cut -d'"' -f4 -} -DOCKER_COMPOSE_LATEST_VERSION=$(get_latest_release "docker/compose") -DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} -mkdir -p $DOCKER_CONFIG/cli-plugins -curl -sSL https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_LATEST_VERSION/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose -chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose -msg_ok "Installed Docker & Compose" - -msg_info "Fetching NPMplus" -cd /opt -wget -q https://raw.githubusercontent.com/ZoeyVid/NPMplus/refs/heads/develop/compose.yaml -msg_ok "Fetched NPMplus" - -attempts=0 -while true; do - read -r -p "Enter your TZ Identifier (e.g., Europe/Berlin): " TZ_INPUT - if validate_tz "$TZ_INPUT"; then - break - fi - msg_error "Invalid timezone! Please enter a valid TZ identifier." - - attempts=$((attempts + 1)) - if [[ "$attempts" -ge 3 ]]; then - msg_error "Maximum attempts reached. Exiting." - exit 1 - fi -done - -read -r -p "Enter your ACME Email: " ACME_EMAIL_INPUT - -yq -i " - .services.npmplus.environment |= - (map(select(. != \"TZ=*\" and . != \"ACME_EMAIL=*\")) + - [\"TZ=$TZ_INPUT\", \"ACME_EMAIL=$ACME_EMAIL_INPUT\"]) -" /opt/compose.yaml - -msg_info "Building and Starting NPMplus (Patience)" -$STD docker compose up -d -CONTAINER_ID="" -for i in {1..60}; do - CONTAINER_ID=$(docker ps --filter "name=npmplus" --format "{{.ID}}") - if [[ -n "$CONTAINER_ID" ]]; then - STATUS=$(docker inspect --format '{{.State.Health.Status}}' "$CONTAINER_ID" 2>/dev/null || echo "starting") - if [[ "$STATUS" == "healthy" ]]; then - msg_ok "NPMplus is running and healthy" - break - elif [[ "$STATUS" == "unhealthy" ]]; then - msg_error "NPMplus container is unhealthy! Check logs." - docker logs "$CONTAINER_ID" - exit 1 - fi - fi - sleep 2 - [[ $i -eq 60 ]] && msg_error "NPMplus container did not become healthy within 120s." && docker logs "$CONTAINER_ID" && exit 1 -done -msg_ok "Builded and started NPMplus" - -motd_ssh -customize - -msg_info "Retrieving Default Login (Patience)" -for i in {1..60}; do - PASSWORD_LINE=$(docker logs "$CONTAINER_ID" 2>&1 | awk '/Creating a new user:/ {print; exit}') - if [[ -n "$PASSWORD_LINE" ]]; then - PASSWORD=$(echo "$PASSWORD_LINE" | awk -F 'password: ' '{print $2}') - echo -e "username: admin@example.org\npassword: $PASSWORD" >/opt/.npm_pwd - msg_ok "Saved default login to /opt/.npm_pwd" - exit 0 - fi - sleep 2 - [[ $i -eq 60 ]] && msg_error "Failed to retrieve default login credentials." && exit 1 -done diff --git a/json/npmplus.json b/json/npmplus.json deleted file mode 100644 index c3f3912..0000000 --- a/json/npmplus.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "NPMplus", - "slug": "npmplus", - "categories": [ - 21 - ], - "date_created": "2025-03-13", - "type": "ct", - "updateable": false, - "privileged": false, - "interface_port": 81, - "documentation": null, - "website": "https://github.com/ZoeyVid/NPMplus", - "logo": "https://raw.githubusercontent.com/ZoeyVid/NPMplus/refs/heads/develop/frontend/app-images/logo-256.png", - "description": "NPMplus is an enhanced version of Nginx Proxy Manager. It simplifies the process of setting up reverse proxies with TLS termination through a user-friendly web interface. Key features include HTTP/3 support, integration with CrowdSec IPS, inclusion of GoAccess for real-time log analysis, and support for ModSecurity with the Core Rule Set.", - "install_methods": [ - { - "type": "default", - "script": "ct/npmplus.sh", - "resources": { - "cpu": 1, - "ram": 512, - "hdd": 3, - "os": "alpine", - "version": "3.21" - } - }, - { - "type": "alpine", - "script": "ct/npmplus.sh", - "resources": { - "cpu": 1, - "ram": 512, - "hdd": 3, - "os": "alpine", - "version": "3.21" - } - } - ], - "default_credentials": { - "username": "root", - "password": null - }, - "notes": [ - { - "text": "The initial starting process can be take 1-2min. ", - "type": "info" - }, - { - "text": "Application credentials: Β΄cat /opt/.npm_pwdΒ΄", - "type": "info" - } - ] -} From 00bb4ca84d0bad3f132af7f03c2897a08abaa903 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 15:48:01 +0100 Subject: [PATCH 52/62] WF --- .../get-versions-from-newreleases.yaml | 45 +++++++++++++++---- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index 08142a8..2eaf73c 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -22,16 +22,43 @@ jobs: env: token: ${{ secrets.NEWRELEASES_TOKEN }} run: | - ls -l - projects=$(curl -H "X-Key: $token" \ - https://api.newreleases.io/v1/projects) - echo $projects | jq -r '.projects[] | "\(.id) \(.name)"' - echo $projects > project_json - jq -r '.projects[] | "\(.id) \(.name)"' project_json | while read -r id name; do - version=$(curl -H "X-Key: $token" \ - https://api.newreleases.io/v1/projects/$id/latest-release) + page=1 + projects_file="project_json" + output_file="json/versions.json" - jq -n --arg name "$name" --arg version "$version" '{name: $name, version: $version}' >> json/versions.json + echo "[]" > $output_file + + while true; do + + echo "Start loop on page: $page" + + projects=$(curl -s -H "X-Key: $token" "https://api.newreleases.io/v1/projects?page=$page") + total_pages=$(echo "$projects" | jq -r '.total_pages') + + if [ -z "$total_pages" ] || [ "$total_pages" -eq 0 ]; then + echo "No pages available. Exiting." + exit 1 + fi + if [ $page == $total_pages ]; then + break + fi + + if [ -z "$projects" ] || ! echo "$projects" | jq -e '.projects' > /dev/null; then + echo "No more projects or invalid response. Exiting." + break + fi + + echo "$projects" > "$projects_file" + + jq -r '.projects[] | "\(.id) \(.name)"' "$projects_file" | while read -r id name; do + version=$(curl -s -H "X-Key: $token" "https://api.newreleases.io/v1/projects/$id/latest-release") + version_data=$(echo "$version" | jq -r '.version // empty') + if [ -n "$version_data" ]; then + jq --arg name "$name" --arg version "$version_data" \ + '. += [{"name": $name, "version": $version}]' "$output_file" > "$output_file.tmp" && mv "$output_file.tmp" "$output_file" + fi + done + ((page++)) done - name: Commit JSON From b5e3ea7947cbaa3810eec3312acdd6e66048d984 Mon Sep 17 00:00:00 2001 From: "GitHub Actions[bot]" Date: Thu, 13 Mar 2025 14:48:42 +0000 Subject: [PATCH 53/62] Update versions.json --- json/versions.json | 558 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 558 insertions(+) create mode 100644 json/versions.json diff --git a/json/versions.json b/json/versions.json new file mode 100644 index 0000000..f1ce550 --- /dev/null +++ b/json/versions.json @@ -0,0 +1,558 @@ +[ + { + "name": "msgbyte/tianji", + "version": "v1.18.21" + }, + { + "name": "semaphoreui/semaphore", + "version": "v2.13.0-beta3" + }, + { + "name": "usememos/memos", + "version": "v0.24.1" + }, + { + "name": "morpheus65535/bazarr", + "version": "v1.5.1" + }, + { + "name": "Jackett/Jackett", + "version": "v0.22.1595" + }, + { + "name": "openobserve/openobserve", + "version": "v0.14.5-rc3" + }, + { + "name": "NodeBB/NodeBB", + "version": "v4.1.1" + }, + { + "name": "VictoriaMetrics/VictoriaMetrics", + "version": "v1.16.0-victorialogs" + }, + { + "name": "diced/zipline", + "version": "v4.0.1" + }, + { + "name": "Threadfin/Threadfin", + "version": "1.2.30" + }, + { + "name": "minio/minio", + "version": "RELEASE.2025-03-12T18-04-18Z" + }, + { + "name": "glanceapp/glance", + "version": "v0.7.4" + }, + { + "name": "keycloak/keycloak", + "version": "26.1.3" + }, + { + "name": "zwave-js/zwave-js-ui", + "version": "v9.33.0" + }, + { + "name": "zitadel/zitadel", + "version": "v2.71.2" + }, + { + "name": "cockpit-project/cockpit", + "version": "335" + }, + { + "name": "gotson/komga", + "version": "1.21.2" + }, + { + "name": "ollama/ollama", + "version": "v0.6.0" + }, + { + "name": "fallenbagel/jellyseerr", + "version": "preview-fix-proxy-undici-v7" + }, + { + "name": "pocket-id/pocket-id", + "version": "v0.39.0" + }, + { + "name": "benjaminjonard/koillection", + "version": "1.6.12" + }, + { + "name": "excalidraw/excalidraw", + "version": "v0.18.0" + }, + { + "name": "Ombi-app/Ombi", + "version": "v4.47.1" + }, + { + "name": "mylar3/mylar3", + "version": "v0.8.2" + }, + { + "name": "Stirling-Tools/Stirling-PDF", + "version": "v0.44.1" + }, + { + "name": "stonith404/pingvin-share", + "version": "v1.10.3" + }, + { + "name": "AdguardTeam/AdGuardHome", + "version": "v0.107.57" + }, + { + "name": "Luligu/matterbridge", + "version": "2.2.4" + }, + { + "name": "evcc-io/evcc", + "version": "0.200.9" + }, + { + "name": "AlexxIT/go2rtc", + "version": "v1.9.9" + }, + { + "name": "navidrome/navidrome", + "version": "v0.55.0" + }, + { + "name": "clusterzx/paperless-ai", + "version": "v2.7.4" + }, + { + "name": "Kareadita/Kavita", + "version": "v0.8.5.3" + }, + { + "name": "YuukanOO/seelf", + "version": "v2.4.2" + }, + { + "name": "umami-software/umami", + "version": "v2.17.0" + }, + { + "name": "documenso/documenso", + "version": "v1.9.1-rc.9" + }, + { + "name": "TriliumNext/Notes", + "version": "v0.91.6" + }, + { + "name": "rogerfar/rdt-client", + "version": "v2.0.102" + }, + { + "name": "homarr-labs/homarr", + "version": "v1.10.0" + }, + { + "name": "prometheus/alertmanager", + "version": "v0.28.1" + }, + { + "name": "hargata/lubelog", + "version": "v1.4.5" + }, + { + "name": "ellite/Wallos", + "version": "v2.46.1" + }, + { + "name": "Dolibarr/dolibarr", + "version": "21.0.0" + }, + { + "name": "netbox-community/netbox", + "version": "v4.2.5" + }, + { + "name": "henrygd/beszel", + "version": "v0.10.1" + }, + { + "name": "open-webui/open-webui", + "version": "v0.5.20" + }, + { + "name": "ipfs/kubo", + "version": "v0.33.2" + }, + { + "name": "pocketbase/pocketbase", + "version": "v0.25.9" + }, + { + "name": "matze/wastebin", + "version": "3.0.0" + }, + { + "name": "immich-app/immich", + "version": "v1.129.0" + }, + { + "name": "snipe/snipe-it", + "version": "v8.0.4" + }, + { + "name": "toniebox-reverse-engineering/teddycloud", + "version": "tc_v0.6.4" + }, + { + "name": "firefly-iii/firefly-iii", + "version": "develop-20250222.4" + }, + { + "name": "go-gitea/gitea", + "version": "v1.23.5" + }, + { + "name": "duplicati/duplicati", + "version": "v2.1.0.5_stable_2025-03-04" + }, + { + "name": "bastienwirtz/homer", + "version": "v25.03.2" + }, + { + "name": "sysadminsmedia/homebox", + "version": "v0.18.0" + }, + { + "name": "Koenkk/zigbee2mqtt", + "version": "2.1.3" + }, + { + "name": "heiher/hev-socks5-server", + "version": "2.8.0" + }, + { + "name": "inspircd/inspircd", + "version": "v4.6.0" + }, + { + "name": "tobychui/zoraxy", + "version": "v3.1.9" + }, + { + "name": "grocy/grocy", + "version": "v4.4.2" + }, + { + "name": "jhuckaby/Cronicle", + "version": "v0.9.76" + }, + { + "name": "docmost/docmost", + "version": "v0.8.4" + }, + { + "name": "BookStackApp/BookStack", + "version": "v25.02" + }, + { + "name": "Part-DB/Part-DB-server", + "version": "v1.16.1" + }, + { + "name": "prometheus/prometheus", + "version": "v3.2.1" + }, + { + "name": "silverbulletmd/silverbullet", + "version": "0.10.4" + }, + { + "name": "juanfont/headscale", + "version": "v0.25.1" + }, + { + "name": "benzino77/tasmocompiler", + "version": "v12.5.0" + }, + { + "name": "traefik/traefik", + "version": "v3.3.4" + }, + { + "name": "schlagmichdoch/PairDrop", + "version": "v1.11.2" + }, + { + "name": "advplyr/audiobookshelf", + "version": "v2.19.5" + }, + { + "name": "Athou/commafeed", + "version": "5.6.1" + }, + { + "name": "FreshRSS/FreshRSS", + "version": "1.26.0" + }, + { + "name": "kimai/kimai", + "version": "2.30.0" + }, + { + "name": "azukaar/Cosmos-Server", + "version": "v0.18.3" + }, + { + "name": "wavelog/wavelog", + "version": "2.0.1" + }, + { + "name": "docker/compose", + "version": "v2.33.1" + }, + { + "name": "sabnzbd/sabnzbd", + "version": "4.4.1" + }, + { + "name": "grafana/grafana", + "version": "v11.5.2" + }, + { + "name": "gristlabs/grist-core", + "version": "v1.4.2" + }, + { + "name": "prometheus-pve/prometheus-pve-exporter", + "version": "v3.5.2" + }, + { + "name": "sbondCo/Watcharr", + "version": "v2.0.2" + }, + { + "name": "authelia/authelia", + "version": "v4.38.19" + }, + { + "name": "glpi-project/glpi", + "version": "10.0.18" + }, + { + "name": "TasmoAdmin/TasmoAdmin", + "version": "v4.2.3" + }, + { + "name": "dani-garcia/vaultwarden", + "version": "1.33.2" + }, + { + "name": "blakeblackshear/frigate", + "version": "v0.15.0" + }, + { + "name": "bluenviron/mediamtx", + "version": "v1.11.3" + }, + { + "name": "actualbudget/actual-server", + "version": "v25.2.1" + }, + { + "name": "NginxProxyManager/nginx-proxy-manager", + "version": "v2.12.3" + }, + { + "name": "thomiceli/opengist", + "version": "v1.9.1" + }, + { + "name": "Forceu/Gokapi", + "version": "v1.9.6" + }, + { + "name": "hoarder-app/hoarder", + "version": "sdk/v0.22.0" + }, + { + "name": "PrivateBin/PrivateBin", + "version": "1.7.6" + }, + { + "name": "paperless-ngx/paperless-ngx", + "version": "v2.14.7" + }, + { + "name": "hivemq/hivemq-community-edition", + "version": "2025.1" + }, + { + "name": "Kozea/Radicale", + "version": "v3.4.1" + }, + { + "name": "rustdesk/rustdesk-server", + "version": "1.1.14" + }, + { + "name": "hansmi/prometheus-paperless-exporter", + "version": "v0.0.6" + }, + { + "name": "donaldzou/WGDashboard", + "version": "v4.1.4" + }, + { + "name": "0xERR0R/blocky", + "version": "v0.25" + }, + { + "name": "linkwarden/linkwarden", + "version": "v2.9.3" + }, + { + "name": "Tautulli/Tautulli", + "version": "v2.15.1" + }, + { + "name": "traccar/traccar", + "version": "v6.6" + }, + { + "name": "ErsatzTV/ErsatzTV", + "version": "v25.1.0" + }, + { + "name": "seanmorley15/AdventureLog", + "version": "v0.8.0" + }, + { + "name": "gethomepage/homepage", + "version": "v0.10.9" + }, + { + "name": "MagicMirrorOrg/MagicMirror", + "version": "v2.30.0" + }, + { + "name": "louislam/uptime-kuma", + "version": "2.0.0-beta.1" + }, + { + "name": "pymedusa/Medusa", + "version": "v1.0.22" + }, + { + "name": "Donkie/Spoolman", + "version": "v0.21.0" + }, + { + "name": "phpipam/phpipam", + "version": "v1.7.3" + }, + { + "name": "Bubka/2FAuth", + "version": "v5.4.3" + }, + { + "name": "gotify/server", + "version": "v2.6.1" + }, + { + "name": "janeczku/calibre-web", + "version": "0.6.24" + }, + { + "name": "sabre-io/Baikal", + "version": "0.10.1" + }, + { + "name": "caddyserver/xcaddy", + "version": "v0.4.4" + }, + { + "name": "linuxserver/Heimdall", + "version": "v2.6.3" + }, + { + "name": "aceberg/WatchYourLAN", + "version": "2.0.4" + }, + { + "name": "Kometa-Team/Kometa", + "version": "v2.1.0" + }, + { + "name": "FunkeyFlo/ps5-mqtt", + "version": "v1.4.0" + }, + { + "name": "projectsend/projectsend", + "version": "r1720" + }, + { + "name": "Pf2eToolsOrg/Pf2eTools", + "version": "v0.8.13" + }, + { + "name": "Paymenter/Paymenter", + "version": "v0.9.5" + }, + { + "name": "hywax/mafl", + "version": "v0.15.4" + }, + { + "name": "FlareSolverr/FlareSolverr", + "version": "v3.3.21" + }, + { + "name": "Suwayomi/Suwayomi-Server", + "version": "v1.1.1" + }, + { + "name": "Forceu/barcodebuddy", + "version": "v1.8.1.8" + }, + { + "name": "Lissy93/dashy", + "version": "3.1.1" + }, + { + "name": "gnmyt/myspeed", + "version": "v1.0.9" + }, + { + "name": "monicahq/monica", + "version": "v4.1.2" + }, + { + "name": "thelounge/thelounge-deb", + "version": "v4.4.3" + }, + { + "name": "wger-project/wger", + "version": "2.2" + }, + { + "name": "sct/overseerr", + "version": "preview-test-node-18" + }, + { + "name": "deepch/RTSPtoWeb", + "version": "v2.4.3" + }, + { + "name": "searxng/searxng", + "version": "v1.0.0" + }, + { + "name": "MediaBrowser/Emby", + "version": "3.5.2.0" + } +] From b211224ec46fc726f22dc951e024e76d1b487d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Thu, 13 Mar 2025 15:50:49 +0100 Subject: [PATCH 54/62] Update cryptpad-install.sh --- install/cryptpad-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install/cryptpad-install.sh b/install/cryptpad-install.sh index 1221188..a619697 100644 --- a/install/cryptpad-install.sh +++ b/install/cryptpad-install.sh @@ -43,6 +43,7 @@ cd cryptpad $STD git checkout $RELEASE $STD npm ci $STD npm run install:components +$STD npm run build cp config/config.example.js config/config.js IP=$(hostname -I | awk '{print $1}') sed -i "51s/localhost/${IP}/g" /opt/cryptpad/config/config.js From a19e7b184903b101cc3ad8af11ca9ee46af5d372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Thu, 13 Mar 2025 15:51:19 +0100 Subject: [PATCH 55/62] Update cryptpad.sh --- ct/cryptpad.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ct/cryptpad.sh b/ct/cryptpad.sh index 121ec0e..0da381f 100644 --- a/ct/cryptpad.sh +++ b/ct/cryptpad.sh @@ -40,6 +40,7 @@ function update_script() { $STD git checkout $RELEASE $STD npm ci $STD npm run install:components + $STD npm run build echo "${RELEASE}" >/opt/${APP}_version.txt msg_ok "Updated $APP to ${RELEASE}" From 3dd5e3c4f1ab545fe83e91a3abd0a4857eeb85fa Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 15:52:52 +0100 Subject: [PATCH 56/62] WF --- frontend/src/__tests__/public/validate-json.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/__tests__/public/validate-json.test.ts b/frontend/src/__tests__/public/validate-json.test.ts index 9cf61e7..f692b49 100644 --- a/frontend/src/__tests__/public/validate-json.test.ts +++ b/frontend/src/__tests__/public/validate-json.test.ts @@ -20,6 +20,8 @@ describe.each(fileNames)("%s", async (fileName) => { script = JSON.parse(fileContent); }) + if (fileName === "versions.json") return; + it("should have valid json according to script schema", () => { ScriptSchema.parse(script); }); From c981be9229bd07e4add809337318e00187bef52b Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Thu, 13 Mar 2025 15:55:49 +0100 Subject: [PATCH 57/62] WF --- frontend/src/__tests__/public/validate-json.test.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/__tests__/public/validate-json.test.ts b/frontend/src/__tests__/public/validate-json.test.ts index f692b49..14b2515 100644 --- a/frontend/src/__tests__/public/validate-json.test.ts +++ b/frontend/src/__tests__/public/validate-json.test.ts @@ -6,10 +6,11 @@ import { Metadata } from "@/lib/types"; console.log('Current directory: ' + process.cwd()); const jsonDir = "../json"; const metadataFileName = "metadata.json"; +const versionsFileName = "versions.json"; const encoding = "utf-8"; const fileNames = (await fs.readdir(jsonDir)) - .filter((fileName) => fileName !== metadataFileName) + .filter((fileName) => fileName !== metadataFileName && fileName !== versionsFileName); describe.each(fileNames)("%s", async (fileName) => { let script: Script; @@ -20,7 +21,6 @@ describe.each(fileNames)("%s", async (fileName) => { script = JSON.parse(fileContent); }) - if (fileName === "versions.json") return; it("should have valid json according to script schema", () => { ScriptSchema.parse(script); @@ -42,7 +42,6 @@ describe(`${metadataFileName}`, async () => { const fileContent = await fs.readFile(filePath, encoding) metadata = JSON.parse(fileContent); }) - it("should have valid json according to metadata schema", () => { // TODO: create zod schema for metadata. Move zod schemas to /lib/types.ts assert(metadata.categories.length > 0); From 4243a4f400e038aac7222856e7986f5bcc8ef32d Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 13 Mar 2025 19:13:07 +0100 Subject: [PATCH 58/62] add GoMFT script --- ct/gomft.sh | 65 +++++++++++++++++++++++++++++++ install/gomft-install.sh | 83 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+) create mode 100644 ct/gomft.sh create mode 100644 install/gomft-install.sh diff --git a/ct/gomft.sh b/ct/gomft.sh new file mode 100644 index 0000000..6d10408 --- /dev/null +++ b/ct/gomft.sh @@ -0,0 +1,65 @@ +#!/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: SlaviΕ‘a AreΕΎina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/StarFleetCPTN/GoMFT + +APP="GoMFT" +var_tags="backup" +var_cpu="1" +var_ram="1024" +var_disk="8" +var_os="debian" +var_version="12" +var_unprivileged="1" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d "/opt/gomft" ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/StarFleetCPTN/GoMFT/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Stopping $APP" + systemctl stop gomft + msg_ok "Stopped $APP" + + msg_info "Updating $APP to ${RELEASE}" + rm -f /opt/gomft/gomft + temp_file=$(mktemp) + wget -q "https://github.com/StarFleetCPTN/GoMFT/archive/refs/tags/v${RELEASE}.tar.gz" -O $temp_file + tar -xzf $temp_file + cp -rf GoMFT-${RELEASE}/* /opt/gomft + wget -q "https://github.com/StarFleetCPTN/GoMFT/releases/download/v${RELEASE}/gomft-v${RELEASE}-linux-amd64" -O /opt/gomft/gomft + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated $APP to ${RELEASE}" + + msg_info "Starting $APP" + systemctl start gomft + msg_ok "Started $APP" + + msg_ok "Update Successful" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + 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 "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}" diff --git a/install/gomft-install.sh b/install/gomft-install.sh new file mode 100644 index 0000000..01c6ba5 --- /dev/null +++ b/install/gomft-install.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: tremor021 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/StarFleetCPTN/GoMFT + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + sudo \ + mc \ + sqlite3 \ + rclone \ + build-essential \ + tzdata \ + ca-certificates +msg_ok "Installed Dependencies" + +msg_info "Setting up Golang" +set +o pipefail +temp_file=$(mktemp) +golang_tarball=$(curl -s https://go.dev/dl/ | grep -oP 'go[\d\.]+\.linux-amd64\.tar\.gz' | head -n 1) +wget -q https://golang.org/dl/"$golang_tarball" -O "$temp_file" +tar -C /usr/local -xzf "$temp_file" +ln -sf /usr/local/go/bin/go /usr/local/bin/go +set -o pipefail +msg_ok "Setup Golang" + +msg_info "Setup {APPLICATION}" +temp_file2=$(mktemp) +RELEASE=$(curl -s https://api.github.com/repos/StarFleetCPTN/GoMFT/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +wget -q "https://github.com/StarFleetCPTN/GoMFT/archive/refs/tags/v${RELEASE}.tar.gz" -O $temp_file2 +tar -xzf $temp_file2 +mv GoMFT-${RELEASE}/ /opt/gomft +cd /opt/gomft +#$STD go install github.com/a-h/templ/cmd/templ@latest +wget -q "https://github.com/StarFleetCPTN/GoMFT/releases/download/v${RELEASE}/gomft-v${RELEASE}-linux-amd64" -O gomft +#$STD go mod download +#$STD $HOME/go/bin/templ generate +chmod +x gomft +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Setup ${APPLICATION}" + +msg_info "Creating Service" +cat </etc/systemd/system/gomft.service +[Unit] +Description=GoMFT Service +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/gomft +ExecStart=/opt/gomft/./gomft +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now gomft +msg_ok "Created Service" + +motd_ssh +customize + +# Cleanup +msg_info "Cleaning up" +rm -f $temp_file $temp_file2 +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" + +motd_ssh +customize From 4d5e23c0a0bd610ac9268f6c4bb4b6b7b8955ef9 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 13 Mar 2025 19:47:05 +0100 Subject: [PATCH 59/62] GoFMT general fixes --- ct/gomft.sh | 7 ++++++- install/gomft-install.sh | 25 +++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ct/gomft.sh b/ct/gomft.sh index 6d10408..c683680 100644 --- a/ct/gomft.sh +++ b/ct/gomft.sh @@ -41,9 +41,14 @@ function update_script() { tar -xzf $temp_file cp -rf GoMFT-${RELEASE}/* /opt/gomft wget -q "https://github.com/StarFleetCPTN/GoMFT/releases/download/v${RELEASE}/gomft-v${RELEASE}-linux-amd64" -O /opt/gomft/gomft + chmod +x /opt/gomft/gomft echo "${RELEASE}" >/opt/${APP}_version.txt msg_ok "Updated $APP to ${RELEASE}" + msg_info "Cleaning Up" + rm -f $temp_file + msg_ok "Cleanup Complete" + msg_info "Starting $APP" systemctl start gomft msg_ok "Started $APP" @@ -62,4 +67,4 @@ 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 "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}" diff --git a/install/gomft-install.sh b/install/gomft-install.sh index 01c6ba5..f18d150 100644 --- a/install/gomft-install.sh +++ b/install/gomft-install.sh @@ -20,7 +20,6 @@ $STD apt-get install -y \ mc \ sqlite3 \ rclone \ - build-essential \ tzdata \ ca-certificates msg_ok "Installed Dependencies" @@ -35,7 +34,7 @@ ln -sf /usr/local/go/bin/go /usr/local/bin/go set -o pipefail msg_ok "Setup Golang" -msg_info "Setup {APPLICATION}" +msg_info "Setup ${APPLICATION}" temp_file2=$(mktemp) RELEASE=$(curl -s https://api.github.com/repos/StarFleetCPTN/GoMFT/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') wget -q "https://github.com/StarFleetCPTN/GoMFT/archive/refs/tags/v${RELEASE}.tar.gz" -O $temp_file2 @@ -47,6 +46,28 @@ wget -q "https://github.com/StarFleetCPTN/GoMFT/releases/download/v${RELEASE}/go #$STD go mod download #$STD $HOME/go/bin/templ generate chmod +x gomft +JWT_SECRET_KEY=$(openssl rand -base64 24 | tr -d '/+=') + +cat </opt/gomft/.env +SERVER_ADDRESS=:8080 +DATA_DIR=/opt/gomft/data/gomft +BACKUP_DIR=/opt/gomft/data/gomft/backups +JWT_SECRET=$JWT_SECRET_KEY +BASE_URL=http://localhost:8080 + +# Email configuration +EMAIL_ENABLED=false +EMAIL_HOST=smtp.example.com +EMAIL_PORT=587 +EMAIL_FROM_EMAIL=gomft@example.com +EMAIL_FROM_NAME=GoMFT +EMAIL_REPLY_TO= +EMAIL_ENABLE_TLS=true +EMAIL_REQUIRE_AUTH=true +EMAIL_USERNAME=smtp_username +EMAIL_PASSWORD=smtp_password +EOF + echo "${RELEASE}" >/opt/${APPLICATION}_version.txt msg_ok "Setup ${APPLICATION}" From d4d00303ef3345c8de4d2fb91ce2f931a827e92a Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 13 Mar 2025 21:29:34 +0100 Subject: [PATCH 60/62] dont force theme on us --- .vscode/settings.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index cc8cbf9..8f17c7f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -26,8 +26,6 @@ "--rcfile", ".vscode/.shellcheckrc" ], - "workbench.colorTheme": "Default Dark+", - "workbench.iconTheme": "vscode-icons", "git.autofetch": true, "git.confirmSync": false, "git.enableSmartCommit": true, From fcee62b9860fe2e9bdcf43cc9ba4b47770e158bd Mon Sep 17 00:00:00 2001 From: tremor021 Date: Thu, 13 Mar 2025 21:35:09 +0100 Subject: [PATCH 61/62] GoFMT add templ install --- install/gomft-install.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/install/gomft-install.sh b/install/gomft-install.sh index f18d150..4307f9f 100644 --- a/install/gomft-install.sh +++ b/install/gomft-install.sh @@ -41,10 +41,9 @@ wget -q "https://github.com/StarFleetCPTN/GoMFT/archive/refs/tags/v${RELEASE}.ta tar -xzf $temp_file2 mv GoMFT-${RELEASE}/ /opt/gomft cd /opt/gomft -#$STD go install github.com/a-h/templ/cmd/templ@latest +$STD go install github.com/a-h/templ/cmd/templ@latest wget -q "https://github.com/StarFleetCPTN/GoMFT/releases/download/v${RELEASE}/gomft-v${RELEASE}-linux-amd64" -O gomft -#$STD go mod download -#$STD $HOME/go/bin/templ generate +$STD $HOME/go/bin/templ generate chmod +x gomft JWT_SECRET_KEY=$(openssl rand -base64 24 | tr -d '/+=') From 4bb03143317f5e5e58570456ef9e3b640678404a Mon Sep 17 00:00:00 2001 From: vhsdream Date: Thu, 13 Mar 2025 19:30:41 -0400 Subject: [PATCH 62/62] New script: slskd + Soularr --- ct/slskd.sh | 82 ++++++++++++++++++++++++++ install/slskd-install.sh | 122 +++++++++++++++++++++++++++++++++++++++ json/slskd.json | 43 ++++++++++++++ 3 files changed, 247 insertions(+) create mode 100644 ct/slskd.sh create mode 100644 install/slskd-install.sh create mode 100644 json/slskd.json diff --git a/ct/slskd.sh b/ct/slskd.sh new file mode 100644 index 0000000..99dbc46 --- /dev/null +++ b/ct/slskd.sh @@ -0,0 +1,82 @@ +#!/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: vhsdream +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://github.com/slskd/slskd, https://soularr.net + +APP="slskd" +var_tags="arr,p2p" +var_cpu="1" +var_ram="512" +var_disk="4" +var_os="debian" +var_version="12" +var_unprivileged="1" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/slskd ]] || [[ ! -d /opt/soularr ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + RELEASE=$(curl -s https://api.github.com/repos/slskd/slskd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Stopping $APP and Soularr" + systemctl stop slskd soularr.timer soularr.service + msg_ok "Stopped $APP and Soularr" + + msg_info "Updating $APP to v${RELEASE}" + tmp_file=$(mktemp) + wget -q "https://github.com/slskd/slskd/releases/download/${RELEASE}/slskd-${RELEASE}-linux-x64.zip" -O $tmp_file + unzip -q -oj $tmp_file slskd -d /opt/${APP} + msg_ok "Updated $APP to v${RELEASE}" + + msg_info "Cleaning Up" + rm -rf $tmp_file + msg_ok "Cleanup Completed" + + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "$APP updated" + msg_info "Updating Soularr" + cp /opt/soularr/config.ini /opt/soularrconfig.ini + cp /opt/soularr/run.sh /opt/soularrscript.sh + cd /tmp + rm -rf /opt/soularr + wget -q https://github.com/mrusse/soularr/archive/refs/heads/main.zip + unzip -q main.zip + mv soularr-main /opt/soularr + cd /opt/soularr + $STD pip install -r requirements.txt + mv /opt/soularrconfig.ini /opt/soularr/config.ini + mv /opt/soularrscript.sh /opt/soularr/run.sh + msg_ok "Soularr updated" + msg_info "Starting $APP and Soularr" + systemctl start slskd soularr.timer + msg_ok "Started $APP and Soularr" + + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" + 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 "${TAB}${GATEWAY}${BGN}http://${IP}:5030${CL}" +echo -e "${RAMSIZE}${BL} ${BOLD}Finish configuring Soularr at /opt/soularr/config.ini${CL}" +echo -e "${ADVANCED}${DGN} Then start with${CL} ${BOLD}${UL}systemctl start soularr.timer${CL}" diff --git a/install/slskd-install.sh b/install/slskd-install.sh new file mode 100644 index 0000000..401e445 --- /dev/null +++ b/install/slskd-install.sh @@ -0,0 +1,122 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: vhsdream +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://github.com/slskd/slskd/, https://soularr.net + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + sudo \ + mc \ + unzip \ + python3-pip +msg_ok "Installed Dependencies" + +msg_info "Setup ${APPLICATION}" +tmp_file=$(mktemp) +RELEASE=$(curl -s https://api.github.com/repos/slskd/slskd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +wget -q "https://github.com/slskd/slskd/releases/download/${RELEASE}/slskd-${RELEASE}-linux-x64.zip" -O $tmp_file +unzip -q $tmp_file -d /opt/${APPLICATION} +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +JWT_KEY=$(openssl rand -base64 44) +SLSKD_API_KEY=$(openssl rand -base64 44) +cp /opt/${APPLICATION}/config/slskd.example.yml /opt/${APPLICATION}/config/slskd.yml +sed -i \ + -e "\|web:|,\|cidr|s|^#||" \ + -e "\|https:|,\|5031|s|false|true|" \ + -e "\|api_keys|,\|cidr|s|/etc/systemd/system/${APPLICATION}.service +[Unit] +Description=${APPLICATION} Service +After=network.target +Wants=network.target + +[Service] +WorkingDirectory=/opt/${APPLICATION} +ExecStart=/opt/${APPLICATION}/slskd --config /opt/${APPLICATION}/config/slskd.yml +Restart=always + +[Install] +WantedBy=multi-user.target +EOF + +cat </etc/systemd/system/soularr.timer +[Unit] +Description=Soularr service timer +RefuseManualStart=no +RefuseManualStop=no + +[Timer] +Persistent=true +# run every 5 minutes +OnCalendar=*-*-* *:0/5:00 +Unit=soularr.service + +[Install] +WantedBy=timers.target +EOF + +cat </etc/systemd/system/soularr.service +[Unit] +Description=Soularr service +After=network.target slskd.service + +[Service] +Type=simple +WorkingDirectory=/opt/soularr +ExecStart=/bin/bash -c /opt/soularr/run.sh + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now ${APPLICATION}.service +systemctl enable -q soularr.timer +msg_ok "Created Services" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf $tmp_file +rm -rf /tmp/main.zip +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/json/slskd.json b/json/slskd.json new file mode 100644 index 0000000..89a90d2 --- /dev/null +++ b/json/slskd.json @@ -0,0 +1,43 @@ +{ + "name": "slskd", + "slug": "slskd", + "categories": [ + 11 + ], + "date_created": "2025-03-11", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 5030, + "documentation": "https://github.com/slskd/slskd/tree/master/docs", + "website": "https://github.com/slskd/slskd", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/png/slskd.png", + "description": "A modern client-server application for the Soulseek file sharing network. ", + "install_methods": [ + { + "type": "default", + "script": "ct/slskd.sh", + "resources": { + "cpu": 1, + "ram": 512, + "hdd": 4, + "os": "Debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": "slskd", + "password": "slskd" + }, + "notes": [ + { + "text": "See /opt/slskd/config/sksld.yml to add your Soulseek credentials", + "type": "info" + }, + { + "text": "This LXC includes Soularr; it needs to be configured (/opt/soularr/config.ini) before it will work", + "type": "info" + } + ] +}