BASH 560
Proxmox Backup Server Post Install Guest on 12th November 2022 09:34:18 PM
  1. The script will give options to Disable the Enterprise Repo, Add/Correct PBS Sources, Enable the No-Subscription Repo, Add Test Repo, Disable Subscription Nag, Update Proxmox Backup Server and Reboot PBS.
  2.  
  3. #!/usr/bin/env bash -ex
  4. set -euo pipefail
  5. shopt -s inherit_errexit nullglob
  6. YW=$(echo "\033[33m")
  7. BL=$(echo "\033[36m")
  8. RD=$(echo "\033[01;31m")
  9. BGN=$(echo "\033[4;92m")
  10. GN=$(echo "\033[1;92m")
  11. DGN=$(echo "\033[32m")
  12. CL=$(echo "\033[m")
  13. BFR="\\r\\033[K"
  14. HOLD="-"
  15. CM="${GN}āœ“${CL}"
  16. CROSS="${RD}āœ—${CL}"
  17. clear
  18. echo -e "${BL}This script will Perform Post Install Routines.${CL}"
  19. while true; do
  20.     read -p "Start the PBS Post Install Script (y/n)?" yn
  21.     case $yn in
  22.     [Yy]*) break ;;
  23.     [Nn]*) exit ;;
  24.     *) echo "Please answer yes or no." ;;
  25.     esac
  26. done
  27.  
  28. if command -v pveversion >/dev/null 2>&1; then
  29.     echo -e "\nšŸ›‘  PVE Detected, Wrong Script!\n"
  30.     exit 1
  31. fi
  32.  
  33. function header_info {
  34.     cat <<"EOF"
  35.     ____  ____ _____    ____             __     ____           __        ____
  36.    / __ \/ __ ) ___/   / __ \____  _____/ /_   /  _/___  _____/ /_____ _/ / /
  37.   / /_/ / __  \__ \   / /_/ / __ \/ ___/ __/   / // __ \/ ___/ __/ __ `/ / /
  38.  / ____/ /_/ /__/ /  / ____/ /_/ (__  ) /_   _/ // / / (__  ) /_/ /_/ / / /  
  39. /_/   /_____/____/  /_/    \____/____/\__/  /___/_/ /_/____/\__/\__,_/_/_/  
  40.                                                                              
  41. EOF
  42. }
  43.  
  44. function msg_info() {
  45.     local msg="$1"
  46.     echo -ne " ${HOLD} ${YW}${msg}..."
  47. }
  48.  
  49. function msg_ok() {
  50.     local msg="$1"
  51.     echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
  52. }
  53.  
  54. clear
  55. header_info
  56. read -r -p "Disable Enterprise Repository? <y/N> " prompt
  57. if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
  58.     msg_info "Disabling Enterprise Repository"
  59.     sleep 2
  60.     sed -i "s/^deb/#deb/g" /etc/apt/sources.list.d/pbs-enterprise.list
  61.     msg_ok "Disabled Enterprise Repository"
  62. fi
  63.  
  64. read -r -p "Add/Correct PBS Sources (sources.list)? <y/N> " prompt
  65. if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
  66.     msg_info "Adding or Correcting PBS Sources"
  67.     cat <<EOF >/etc/apt/sources.list
  68. deb http://ftp.debian.org/debian bullseye main contrib
  69. deb http://ftp.debian.org/debian bullseye-updates main contrib
  70. deb http://security.debian.org/debian-security bullseye-security main contrib
  71. EOF
  72.     sleep 2
  73.     msg_ok "Added or Corrected PBS Sources"
  74. fi
  75.  
  76. read -r -p "Enable No-Subscription Repository? <y/N> " prompt
  77. if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
  78.     msg_info "Enabling No-Subscription Repository"
  79.     cat <<EOF >>/etc/apt/sources.list
  80. deb http://download.proxmox.com/debian/pbs bullseye pbs-no-subscription
  81. EOF
  82.     sleep 2
  83.     msg_ok "Enabled No-Subscription Repository"
  84. fi
  85.  
  86. read -r -p "Add (Disabled) Beta/Test Repository? <y/N> " prompt
  87. if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
  88.     msg_info "Adding Beta/Test Repository and set disabled"
  89.     cat <<EOF >>/etc/apt/sources.list
  90. # deb http://download.proxmox.com/debian/pbs bullseye pbstest
  91. EOF
  92.     sleep 2
  93.     msg_ok "Added Beta/Test Repository"
  94. fi
  95.  
  96. read -r -p "Disable Subscription Nag? <y/N> " prompt
  97. if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
  98.     msg_info "Disabling Subscription Nag"
  99.     echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/Active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" >/etc/apt/apt.conf.d/no-nag-script
  100.     apt --reinstall install proxmox-widget-toolkit &>/dev/null
  101.     msg_ok "Disabled Subscription Nag"
  102. fi
  103.  
  104. read -r -p "Update Proxmox Backup Server now? <y/N> " prompt
  105. if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
  106.     msg_info "Updating Proxmox Backup Server (Patience)"
  107.     apt-get update &>/dev/null
  108.     apt-get -y dist-upgrade &>/dev/null
  109.     msg_ok "Updated Proxmox Backup Server (āš  Reboot Recommended)"
  110. fi
  111.  
  112. read -r -p "Reboot Proxmox Backup Server now? <y/N> " prompt
  113. if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
  114.     msg_info "Rebooting Proxmox Backup Server"
  115.     sleep 2
  116.     msg_ok "Completed Post Install Routines"
  117.     reboot
  118. fi
  119.  
  120. sleep 2
  121. msg_ok "Completed Post Install Routines"

paste.retronerd.at ist fuer Quelltexte und generellen Debugging Text.

Login oder Registrieren um zu bearbeiten, loeschen, um deine Pastes zu verfolgen und mehr.

Raw Paste

Login oder Registrieren um diesen Paste zu bearbeiten oder zu forken. Es ist kostenlos.