mirror of
https://github.com/oneclickvirt/pve.git
synced 2024-09-20 15:05:56 +08:00
update
This commit is contained in:
parent
44026be933
commit
0bd8bd7b51
|
@ -197,7 +197,7 @@ else
|
|||
fi
|
||||
# 检测IPV6相关的信息
|
||||
if [ -f /usr/local/bin/pve_check_ipv6 ]; then
|
||||
ipv6_address=$(cat /usr/local/bin/pve_check_ipv6)
|
||||
ipv6_address="2001:db8:1::2"
|
||||
IFS="/" read -ra parts <<< "$ipv6_address"
|
||||
part_1="${parts[0]}"
|
||||
part_2="${parts[1]}"
|
||||
|
@ -211,10 +211,10 @@ if [ -f /usr/local/bin/pve_check_ipv6 ]; then
|
|||
fi
|
||||
fi
|
||||
if [ -f /usr/local/bin/pve_ipv6_prefixlen ]; then
|
||||
ipv6_prefixlen=$(cat /usr/local/bin/pve_ipv6_prefixlen)
|
||||
ipv6_prefixlen="64"
|
||||
fi
|
||||
if [ -f /usr/local/bin/pve_ipv6_gateway ]; then
|
||||
ipv6_gateway=$(cat /usr/local/bin/pve_ipv6_gateway)
|
||||
ipv6_gateway="2001:db8:1::"
|
||||
fi
|
||||
user_ip="172.16.1.${num}"
|
||||
if [ "$system_arch" = "x86" ]; then
|
||||
|
@ -225,12 +225,11 @@ else
|
|||
fi
|
||||
pct start $CTID
|
||||
pct set $CTID --hostname $CTID
|
||||
pct set $CTID --net0 name=eth0,ip=${user_ip}/24,bridge=vmbr1,gw=172.16.1.1
|
||||
# if [ -z "$ipv6_address" ] || [ -z "$ipv6_prefixlen" ] || [ -z "$ipv6_gateway" ] || [ "$ipv6_prefixlen" -gt 112 ]; then
|
||||
# pct set $CTID --net0 name=eth0,ip=${user_ip}/24,bridge=vmbr1,gw=172.16.1.1
|
||||
# else
|
||||
# :
|
||||
# fi
|
||||
if [ -z "$ipv6_address" ] || [ -z "$ipv6_prefixlen" ] || [ -z "$ipv6_gateway" ] || [ "$ipv6_prefixlen" -gt 112 ]; then
|
||||
pct set $CTID --net0 name=eth0,ip=${user_ip}/24,bridge=vmbr1,gw=172.16.1.1
|
||||
else
|
||||
pct set $CTID --net0 name=eth0,ip=${user_ip}/24,bridge=vmbr1,gw=172.16.1.1,ip6=${ipv6_address}/${ipv6_prefixlen},gw6=${ipv6_gateway}
|
||||
fi
|
||||
pct set $CTID --nameserver 8.8.8.8,2001:4860:4860::8888 --nameserver 8.8.4.4,2001:4860:4860::8844
|
||||
sleep 3
|
||||
if echo "$system" | grep -qiE "centos|almalinux|rockylinux"; then
|
||||
|
@ -263,13 +262,8 @@ iptables-save > /etc/iptables/rules.v4
|
|||
service netfilter-persistent restart
|
||||
|
||||
# 容器的相关信息将会存储到对应的容器的NOTE中,可在WEB端查看
|
||||
if [ -z "$ipv6_address" ] || [ -z "$ipv6_prefixlen" ] || [ -z "$ipv6_gateway" ] || [ "$ipv6_prefixlen" -gt 112 ]; then
|
||||
echo "$CTID $password $core $memory $disk $sshn $web1_port $web2_port $port_first $port_last $system_ori $storage" >> "ct${CTID}"
|
||||
data=$(echo " CTID root密码-password CPU核数-CPU 内存-memory 硬盘-disk SSH端口 80端口 443端口 外网端口起-port-start 外网端口止-port-end 系统-system 存储盘-storage")
|
||||
else
|
||||
echo "$CTID $password $core $memory $disk $sshn $web1_port $web2_port $port_first $port_last $system_ori $storage $ipv6_address" >> "ct${CTID}"
|
||||
data=$(echo " CTID root密码-password CPU核数-CPU 内存-memory 硬盘-disk SSH端口 80端口 443端口 外网端口起-port-start 外网端口止-port-end 系统-system 存储盘-storage 外网IPV6-ipv6")
|
||||
fi
|
||||
echo "$CTID $password $core $memory $disk $sshn $web1_port $web2_port $port_first $port_last $system_ori $storage" >> "ct${CTID}"
|
||||
data=$(echo " CTID root密码-password CPU核数-CPU 内存-memory 硬盘-disk SSH端口 80端口 443端口 外网端口起-port-start 外网端口止-port-end 系统-system 存储盘-storage")
|
||||
values=$(cat "ct${CTID}")
|
||||
IFS=' ' read -ra data_array <<< "$data"
|
||||
IFS=' ' read -ra values_array <<< "$values"
|
||||
|
|
|
@ -175,7 +175,18 @@ check_cdn_file() {
|
|||
|
||||
cdn_urls=("https://cdn.spiritlhl.workers.dev/" "https://cdn3.spiritlhl.net/" "https://cdn1.spiritlhl.net/" "https://cdn2.spiritlhl.net/")
|
||||
check_cdn_file
|
||||
|
||||
first_digit=${CTID:0:1}
|
||||
second_digit=${CTID:1:1}
|
||||
third_digit=${CTID:2:1}
|
||||
if [ $first_digit -le 2 ]; then
|
||||
if [ $second_digit -eq 0 ]; then
|
||||
num=$third_digit
|
||||
else
|
||||
num=$second_digit$third_digit
|
||||
fi
|
||||
else
|
||||
num=$((first_digit - 2))$second_digit$third_digit
|
||||
fi
|
||||
# 检测IPV6相关的信息
|
||||
if [ -f /usr/local/bin/pve_check_ipv6 ]; then
|
||||
ipv6_address=$(cat /usr/local/bin/pve_check_ipv6)
|
||||
|
@ -205,7 +216,9 @@ else
|
|||
fi
|
||||
pct start $CTID
|
||||
pct set $CTID --hostname $CTID
|
||||
user_ip="172.16.1.${num}"
|
||||
pct set $CTID --net0 name=eth0,ip6=${ipv6_address}/${ipv6_prefixlen},bridge=vmbr0,gw6=${ipv6_gateway}
|
||||
pct set $CTID --net1 name=eth1,ip=${user_ip}/24,bridge=vmbr1,gw=172.16.1.1
|
||||
pct set $CTID --nameserver 8.8.8.8,2001:4860:4860::8888 --nameserver 8.8.4.4,2001:4860:4860::8844
|
||||
sleep 3
|
||||
if echo "$system" | grep -qiE "centos|almalinux|rockylinux" >/dev/null 2>&1; then
|
||||
|
|
|
@ -248,11 +248,11 @@ qm set $vm_num --nameserver 8.8.8.8,2001:4860:4860::8888
|
|||
qm set $vm_num --searchdomain 8.8.4.4,2001:4860:4860::8844
|
||||
user_ip="172.16.1.${num}"
|
||||
qm set $vm_num --ipconfig0 ip=${user_ip}/24,gw=172.16.1.1
|
||||
# if [ -z "$ipv6_address" ] || [ -z "$ipv6_prefixlen" ] || [ -z "$ipv6_gateway" ] || [ "$ipv6_prefixlen" -gt 112 ]; then
|
||||
# qm set $vm_num --ipconfig0 ip=${user_ip}/24,gw=172.16.1.1
|
||||
# else
|
||||
# :
|
||||
# fi
|
||||
if [ -z "$ipv6_address" ] || [ -z "$ipv6_prefixlen" ] || [ -z "$ipv6_gateway" ] || [ "$ipv6_prefixlen" -gt 112 ]; then
|
||||
qm set $vm_num --ipconfig0 ip=${user_ip}/24,gw=172.16.1.1
|
||||
else
|
||||
qm set $vm_num --ipconfig0 ip=${user_ip}/24,gw=172.16.1.1,ip6=${ipv6_address}/${ipv6_prefixlen},gw6=${ipv6_gateway}
|
||||
fi
|
||||
qm set $vm_num --cipassword $password --ciuser $user
|
||||
sleep 5
|
||||
qm resize $vm_num scsi0 ${disk}G
|
||||
|
|
|
@ -184,6 +184,18 @@ elif [ "$system_arch" = "arch" ]; then
|
|||
curl -L -o "$file_path" "$url"
|
||||
fi
|
||||
fi
|
||||
first_digit=${vm_num:0:1}
|
||||
second_digit=${vm_num:1:1}
|
||||
third_digit=${vm_num:2:1}
|
||||
if [ $first_digit -le 2 ]; then
|
||||
if [ $second_digit -eq 0 ]; then
|
||||
num=$third_digit
|
||||
else
|
||||
num=$second_digit$third_digit
|
||||
fi
|
||||
else
|
||||
num=$((first_digit - 2))$second_digit$third_digit
|
||||
fi
|
||||
# 检测IPV6相关的信息
|
||||
if [ -f /usr/local/bin/pve_check_ipv6 ]; then
|
||||
ipv6_address=$(cat /usr/local/bin/pve_check_ipv6)
|
||||
|
@ -205,7 +217,7 @@ fi
|
|||
if [ -f /usr/local/bin/pve_ipv6_gateway ]; then
|
||||
ipv6_gateway=$(cat /usr/local/bin/pve_ipv6_gateway)
|
||||
fi
|
||||
qm create $vm_num --agent 1 --scsihw virtio-scsi-single --serial0 socket --cores $core --sockets 1 --cpu host --net0 virtio,bridge=vmbr0,firewall=0
|
||||
qm create $vm_num --agent 1 --scsihw virtio-scsi-single --serial0 socket --cores $core --sockets 1 --cpu host --net0 virtio,bridge=vmbr0,firewall=0 --net1 virtio,bridge=vmbr1,firewall=0
|
||||
if [ "$system_arch" = "x86" ]; then
|
||||
qm importdisk $vm_num /root/qcow/${system}.qcow2 ${storage}
|
||||
else
|
||||
|
@ -226,7 +238,9 @@ qm set $vm_num --memory $memory
|
|||
qm set $vm_num --ide2 ${storage}:cloudinit
|
||||
qm set $vm_num --nameserver 8.8.8.8,2001:4860:4860::8888
|
||||
qm set $vm_num --searchdomain 8.8.4.4,2001:4860:4860::8844
|
||||
user_ip="172.16.1.${num}"
|
||||
qm set $vm_num --ipconfig0 ip6=${ipv6_address}/${ipv6_prefixlen},gw6=${ipv6_gateway}
|
||||
qm set $vm_num --ipconfig1 ip=${user_ip}/24,gw=172.16.1.1
|
||||
qm set $vm_num --cipassword $password --ciuser $user
|
||||
sleep 5
|
||||
qm resize $vm_num scsi0 ${disk}G
|
||||
|
|
Loading…
Reference in a new issue