DCImanager 5 - proxmox 预装环境 - 脚本

来自ISPSystem。

#!/bin/sh
#
# metadata_begin
# recipe: Proxmox
# tags: debian10,debian11
# revision: 2
# description_ru: Proxmox VE
# description_en: Proxmox VE
# metadata_end
#
RNAME=Proxmox

set -x

LOG_PIPE=/tmp/log.pipe.$$                                                                                                                                                                                                                    
mkfifo ${LOG_PIPE}
LOG_FILE=/root/${RNAME}.log
touch ${LOG_FILE}
chmod 600 ${LOG_FILE}

tee < ${LOG_PIPE} ${LOG_FILE} &

exec > ${LOG_PIPE}
exec 2> ${LOG_PIPE}

export DEBIAN_FRONTEND="noninteractive"
HOSTNAME_SHORT=$(hostname -s)
HOSTNAME_FULL=$(hostname)
IP=$(ip route get 1 | grep -Po '(?<=src )[^ ]+')
if ! [ "${HOSTNAME_SHORT}" = "${HOSTNAME_FULL}" ]; then
    echo "$IP $HOSTNAME_FULL $HOSTNAME_SHORT" >> /etc/hosts
else
    echo "$IP $HOSTNAME_FULL" >> /etc/hosts
fi

# Wait firstrun script
while ps uxaww | grep  -v grep | grep -Eq 'apt-get|dpkg' ; do echo "waiting..." ; sleep 3 ; done

apt-get update

test -f /usr/bin/which || apt-get -y install which
which wget 2>/dev/null || apt-get -y install wget
which gnupg2 2>/dev/null || apt-get -y install gnupg2
which lsb-release 2>/dev/null || apt-get -y install lsb-release

if [ "$(lsb_release -c -s)" = "buster" ]; then
    wget -qO - http://download.proxmox.com/debian/proxmox-ve-release-6.x.gpg | apt-key add -
    echo "deb http://download.proxmox.com/debian/pve buster pve-no-subscription" | tee /etc/apt/sources.list.d/pve-install-repo.list
else
    wget -qO - http://download.proxmox.com/debian/proxmox-release-bullseye.gpg | apt-key add -
    echo "deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription" | tee /etc/apt/sources.list.d/pve-install-repo.list
fi
apt update && apt dist-upgrade -y
apt install proxmox-ve -y

参考:

标签: proxmox

添加新评论