mirror of
https://github.com/bashclub/proxmox-zfs-postinstall.git
synced 2024-12-25 01:30:12 +01:00
Add virtio-win-updater
This commit is contained in:
parent
fe32ca48d3
commit
ca14233bcd
36
postinstall
36
postinstall
@ -585,6 +585,41 @@ EOF
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtiowin_updater() {
|
||||||
|
log "Installing virtio-win-updater"
|
||||||
|
cat << EOF > /usr/local/bin/virtio-win-updater
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# This script updates the virtio-win iso in Proxmox local storage
|
||||||
|
content=\$(wget -q -O - https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/)
|
||||||
|
server=https://fedorapeople.org
|
||||||
|
path=\$(echo -e "\$content" | grep -m1 title | cut -d "<" -f2 | cut -d " " -f3)
|
||||||
|
file=\$(echo -e "\$content" | grep -Eo "virtio-win-0.1.[0-9]+.iso" | grep -m1 virtio)
|
||||||
|
url=\$server\$path/\$file
|
||||||
|
if ! find /var/lib/vz/template/iso/\$file > /dev/null 2>&1 ; then
|
||||||
|
echo "\$(date) New version available. Downloading \$file."
|
||||||
|
wget -q -O /var/lib/vz/template/iso/\$file \$url
|
||||||
|
old_virtio=\$(find /var/lib/vz/template/iso/ -name virtio-win* | grep -v \$file)
|
||||||
|
if [ \$? -eq 0 ]; then
|
||||||
|
for line in \$old_virtio; do
|
||||||
|
if ! grep \$(echo \$line | cut -d'/' -f7) /etc/pve/qemu-server/* ; then
|
||||||
|
echo "\$(date) Deleting \$line."
|
||||||
|
rm -f \$line
|
||||||
|
else
|
||||||
|
echo "\$(date) Keeping \$line - Still in use by VMs."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "\$(date) Already on the current stable version: \$file."
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
chmod +x /usr/local/bin/virtio-win-updater
|
||||||
|
ln -sf /usr/local/bin/virtio-win-updater /etc/cron.daily/virtio-win-updater
|
||||||
|
log "Running virtio-win-updater"
|
||||||
|
virtio-win-updater
|
||||||
|
}
|
||||||
|
|
||||||
installation_task(){
|
installation_task(){
|
||||||
log "Starting Installation"
|
log "Starting Installation"
|
||||||
|
|
||||||
@ -604,6 +639,7 @@ installation_task(){
|
|||||||
set_mail_delivery
|
set_mail_delivery
|
||||||
create_swap_pool
|
create_swap_pool
|
||||||
set_default_volblocksize
|
set_default_volblocksize
|
||||||
|
virtiowin_updater
|
||||||
|
|
||||||
log "Updating initramfs - This will take some time..."
|
log "Updating initramfs - This will take some time..."
|
||||||
update-initramfs -u -k all > /dev/null 2>&1
|
update-initramfs -u -k all > /dev/null 2>&1
|
||||||
|
Loading…
Reference in New Issue
Block a user