mirror of
https://github.com/thelittlerocket/pve.git
synced 2025-03-03 17:27:17 +08:00
Update buildct.sh
This commit is contained in:
parent
3a33278e51
commit
e2cfba1782
1 changed files with 5 additions and 5 deletions
|
@ -19,11 +19,11 @@ port_first="${9:-49975}"
|
|||
port_last="${10:-50000}"
|
||||
system="${12:-debian11}"
|
||||
rm -rf "ct$name"
|
||||
TMP_FILE="$(mktemp)"
|
||||
TMP_FILE="cloud-init.yaml"
|
||||
echo "#cloud-config" > "$TMP_FILE"
|
||||
echo "chpasswd:" >> "$TMP_FILE"
|
||||
echo " list: |" >> "$TMP_FILE"
|
||||
echo " root:$password" >> "$TMP_FILE"
|
||||
echo "password: ${password}" >> "$TMP_FILE"
|
||||
echo "chpasswd: {expire: False}" >> "$TMP_FILE"
|
||||
echo "ssh_pwauth: True" >> "$TMP_FILE"
|
||||
system="debian-11-standard_11.6-1_amd64.tar.zst"
|
||||
|
||||
first_digit=${CTID:0:1}
|
||||
|
@ -39,7 +39,7 @@ else
|
|||
num=$((first_digit - 2))$second_digit$third_digit
|
||||
fi
|
||||
user_ip="172.16.1.${num}"
|
||||
pct create $CTID local:vztmpl/$system --cores $core --cpuunits 1024 --memory $memory --swap 128 --net0 name=eth0,ip=${user_ip}/24,bridge=vmbr1,gw=172.16.1.1 --rootfs local:${disk} --onboot 1 --cloudinit /dev/stdin < "$TMP_FILE"
|
||||
pct create $CTID local:vztmpl/$system --cores $core --cpuunits 1024 --memory $memory --swap 128 --net0 name=eth0,ip=${user_ip}/24,bridge=vmbr1,gw=172.16.1.1 --rootfs local:${disk} --onboot 1 --userdata ./cloud-init.yaml
|
||||
rm "$TMP_FILE"
|
||||
pct start $CTID
|
||||
|
||||
|
|
Loading…
Reference in a new issue