mirror of
https://github.com/thelittlerocket/pve.git
synced 2025-03-04 01:38:12 +08:00
Update rebuild_qcow2.sh
This commit is contained in:
parent
07f9c7fcdb
commit
6e8151e5d1
1 changed files with 68 additions and 17 deletions
|
@ -26,7 +26,71 @@ elif [[ "$qcow_file" == *"centos"* ]]; then
|
||||||
elif [[ "$qcow_file" == *"almalinux"* ]]; then
|
elif [[ "$qcow_file" == *"almalinux"* ]]; then
|
||||||
virt-sysprep --enable almalinux -a "$qcow_file"
|
virt-sysprep --enable almalinux -a "$qcow_file"
|
||||||
fi
|
fi
|
||||||
if [[ "$qcow_file" == *"debian"* || "$qcow_file" == *"ubuntu"* || "$qcow_file" == *"arch"* || "$qcow_file" == *"almalinux"* || "$qcow_file" == *"centos9-stream"* || "$qcow_file" == *"centos8-stream"* || "$qcow_file" == *"centos7"* ]]; then
|
if [[ "$qcow_file" == *"debian"* || "$qcow_file" == *"ubuntu"* || "$qcow_file" == *"arch"* ]]; then
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/ssh_pwauth:[[:space:]]*0/ssh_pwauth: 1/g' /etc/cloud/cloud.cfg"
|
||||||
|
virt-customize -a $qcow_file --run-command "echo 'Modified from https://github.com/spiritLHLS/Images' >> /etc/motd"
|
||||||
|
virt-customize -a $qcow_file --run-command "echo 'Related repo https://github.com/spiritLHLS/pve' >> /etc/motd"
|
||||||
|
virt-customize -a $qcow_file --run-command "echo '--by https://t.me/spiritlhl' >> /etc/motd"
|
||||||
|
echo "启用SSH功能..."
|
||||||
|
virt-customize -a $qcow_file --run-command "systemctl enable ssh"
|
||||||
|
virt-customize -a $qcow_file --run-command "systemctl start ssh"
|
||||||
|
virt-customize -a $qcow_file --run-command "systemctl enable sshd"
|
||||||
|
virt-customize -a $qcow_file --run-command "systemctl start sshd"
|
||||||
|
echo "启用root登录..."
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/#Port 22/Port 22/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/#AddressFamily any/AddressFamily any/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/#ListenAddress ::/ListenAddress ::/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "service ssh restart"
|
||||||
|
virt-customize -a $qcow_file --run-command "service sshd restart"
|
||||||
|
virt-customize -a $qcow_file --run-command "systemctl restart sshd"
|
||||||
|
virt-customize -a $qcow_file --run-command "systemctl restart ssh"
|
||||||
|
elif [[ "$qcow_file" == *"alpine"* ]]; then
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/ssh_pwauth:[[:space:]]*0/ssh_pwauth: 1/g' /etc/cloud/cloud.cfg"
|
||||||
|
virt-customize -a $qcow_file --run-command "echo 'Modified from https://github.com/spiritLHLS/Images' >> /etc/motd"
|
||||||
|
virt-customize -a $qcow_file --run-command "echo 'Related repo https://github.com/spiritLHLS/pve' >> /etc/motd"
|
||||||
|
virt-customize -a $qcow_file --run-command "echo '--by https://t.me/spiritlhl' >> /etc/motd"
|
||||||
|
echo "启用SSH功能..."
|
||||||
|
# virt-customize -a $qcow_file --run-command "apk update"
|
||||||
|
# virt-customize -a $qcow_file --run-command "apk add --no-cache wget curl openssh-server sshpass"
|
||||||
|
# virt-customize -a $qcow_file --run-command "cd /etc/ssh"
|
||||||
|
# virt-customize -a $qcow_file --run-command "ssh-keygen -A"
|
||||||
|
echo "启用root登录..."
|
||||||
|
# virt-customize -a $qcow_file --run-command "sed -i.bak '/^#PermitRootLogin/c PermitRootLogin yes' /etc/ssh/sshd_config"
|
||||||
|
# virt-customize -a $qcow_file --run-command "sed -i.bak '/^#PasswordAuthentication/c PasswordAuthentication yes' /etc/ssh/sshd_config"
|
||||||
|
# virt-customize -a $qcow_file --run-command "sed -i.bak '/^#ListenAddress/c ListenAddress 0.0.0.0' /etc/ssh/sshd_config"
|
||||||
|
# virt-customize -a $qcow_file --run-command "sed -i.bak '/^#AddressFamily/c AddressFamily any' /etc/ssh/sshd_config"
|
||||||
|
# virt-customize -a $qcow_file --run-command "sed -i.bak 's/^#\?Port.*/Port 22/' /etc/ssh/sshd_config"
|
||||||
|
# virt-customize -a $qcow_file --run-command "/usr/sbin/sshd"
|
||||||
|
elif [[ "$qcow_file" == *"almalinux9"* ]]; then
|
||||||
|
virt-customize -a $qcow_file --run-command "echo 'Modified from https://github.com/spiritLHLS/Images' >> /etc/motd"
|
||||||
|
virt-customize -a $qcow_file --run-command "echo 'Related repo https://github.com/spiritLHLS/pve' >> /etc/motd"
|
||||||
|
virt-customize -a $qcow_file --run-command "echo '--by https://t.me/spiritlhl' >> /etc/motd"
|
||||||
|
echo "启用SSH功能..."
|
||||||
|
virt-customize -a $qcow_file --run-command "systemctl enable ssh"
|
||||||
|
virt-customize -a $qcow_file --run-command "systemctl start ssh"
|
||||||
|
virt-customize -a $qcow_file --run-command "systemctl enable sshd"
|
||||||
|
virt-customize -a $qcow_file --run-command "systemctl start sshd"
|
||||||
|
echo "启用root登录..."
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/ssh_pwauth:[[:space:]]*0/ssh_pwauth: 1/g' /etc/cloud/cloud.cfg"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/^ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config.d/50-redhat.conf"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/#Port 22/Port 22/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/#AddressFamily any/AddressFamily any/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/#ListenAddress ::/ListenAddress ::/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "service ssh restart"
|
||||||
|
virt-customize -a $qcow_file --run-command "service sshd restart"
|
||||||
|
virt-customize -a $qcow_file --run-command "systemctl restart sshd"
|
||||||
|
virt-customize -a $qcow_file --run-command "systemctl restart ssh"
|
||||||
|
elif [[ "$qcow_file" == *"almalinux"* || "$qcow_file" == *"centos9-stream"* || "$qcow_file" == *"centos8-stream"* || "$qcow_file" == *"centos7"* ]]; then
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/ssh_pwauth:[[:space:]]*0/ssh_pwauth: 1/g' /etc/cloud/cloud.cfg"
|
||||||
virt-customize -a $qcow_file --run-command "echo 'Modified from https://github.com/spiritLHLS/Images' >> /etc/motd"
|
virt-customize -a $qcow_file --run-command "echo 'Modified from https://github.com/spiritLHLS/Images' >> /etc/motd"
|
||||||
virt-customize -a $qcow_file --run-command "echo 'Related repo https://github.com/spiritLHLS/pve' >> /etc/motd"
|
virt-customize -a $qcow_file --run-command "echo 'Related repo https://github.com/spiritLHLS/pve' >> /etc/motd"
|
||||||
virt-customize -a $qcow_file --run-command "echo '--by https://t.me/spiritlhl' >> /etc/motd"
|
virt-customize -a $qcow_file --run-command "echo '--by https://t.me/spiritlhl' >> /etc/motd"
|
||||||
|
@ -40,6 +104,7 @@ if [[ "$qcow_file" == *"debian"* || "$qcow_file" == *"ubuntu"* || "$qcow_file" =
|
||||||
virt-customize -a $qcow_file --run-command "sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config"
|
virt-customize -a $qcow_file --run-command "sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config"
|
||||||
virt-customize -a $qcow_file --run-command "sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config"
|
virt-customize -a $qcow_file --run-command "sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config"
|
||||||
virt-customize -a $qcow_file --run-command "sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config"
|
virt-customize -a $qcow_file --run-command "sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config"
|
||||||
|
virt-customize -a $qcow_file --run-command "sed -i 's/^ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config.d/50-redhat.conf"
|
||||||
virt-customize -a $qcow_file --run-command "sed -i 's/#Port 22/Port 22/g' /etc/ssh/sshd_config"
|
virt-customize -a $qcow_file --run-command "sed -i 's/#Port 22/Port 22/g' /etc/ssh/sshd_config"
|
||||||
virt-customize -a $qcow_file --run-command "sed -i 's/#AddressFamily any/AddressFamily any/g' /etc/ssh/sshd_config"
|
virt-customize -a $qcow_file --run-command "sed -i 's/#AddressFamily any/AddressFamily any/g' /etc/ssh/sshd_config"
|
||||||
virt-customize -a $qcow_file --run-command "sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/g' /etc/ssh/sshd_config"
|
virt-customize -a $qcow_file --run-command "sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/g' /etc/ssh/sshd_config"
|
||||||
|
@ -48,22 +113,8 @@ if [[ "$qcow_file" == *"debian"* || "$qcow_file" == *"ubuntu"* || "$qcow_file" =
|
||||||
virt-customize -a $qcow_file --run-command "service sshd restart"
|
virt-customize -a $qcow_file --run-command "service sshd restart"
|
||||||
virt-customize -a $qcow_file --run-command "systemctl restart sshd"
|
virt-customize -a $qcow_file --run-command "systemctl restart sshd"
|
||||||
virt-customize -a $qcow_file --run-command "systemctl restart ssh"
|
virt-customize -a $qcow_file --run-command "systemctl restart ssh"
|
||||||
elif [[ "$qcow_file" == *"alpine"* ]]; then
|
else
|
||||||
virt-customize -a $qcow_file --run-command "echo 'Modified from https://github.com/spiritLHLS/Images' >> /etc/motd"
|
virt-customize -a $qcow_file --run-command "sed -i 's/ssh_pwauth:[[:space:]]*0/ssh_pwauth: 1/g' /etc/cloud/cloud.cfg"
|
||||||
virt-customize -a $qcow_file --run-command "echo 'Related repo https://github.com/spiritLHLS/pve' >> /etc/motd"
|
|
||||||
virt-customize -a $qcow_file --run-command "echo '--by https://t.me/spiritlhl' >> /etc/motd"
|
|
||||||
echo "启用SSH功能..."
|
|
||||||
virt-customize -a $qcow_file --run-command "apk update"
|
|
||||||
virt-customize -a $qcow_file --run-command "apk add --no-cache wget curl openssh-server sshpass"
|
|
||||||
virt-customize -a $qcow_file --run-command "cd /etc/ssh"
|
|
||||||
virt-customize -a $qcow_file --run-command "ssh-keygen -A"
|
|
||||||
echo "启用root登录..."
|
|
||||||
virt-customize -a $qcow_file --run-command "sed -i.bak '/^#PermitRootLogin/c PermitRootLogin yes' /etc/ssh/sshd_config"
|
|
||||||
virt-customize -a $qcow_file --run-command "sed -i.bak '/^#PasswordAuthentication/c PasswordAuthentication yes' /etc/ssh/sshd_config"
|
|
||||||
virt-customize -a $qcow_file --run-command "sed -i.bak '/^#ListenAddress/c ListenAddress 0.0.0.0' /etc/ssh/sshd_config"
|
|
||||||
virt-customize -a $qcow_file --run-command "sed -i.bak '/^#AddressFamily/c AddressFamily any' /etc/ssh/sshd_config"
|
|
||||||
virt-customize -a $qcow_file --run-command "sed -i.bak 's/^#\?Port.*/Port 22/' /etc/ssh/sshd_config"
|
|
||||||
virt-customize -a $qcow_file --run-command "/usr/sbin/sshd"
|
|
||||||
fi
|
fi
|
||||||
echo "创建备份..."
|
echo "创建备份..."
|
||||||
cp $qcow_file ${qcow_file}.bak
|
cp $qcow_file ${qcow_file}.bak
|
||||||
|
|
Loading…
Reference in a new issue