mirror of
https://github.com/bashclub/proxmox-zfs-postinstall.git
synced 2024-12-25 17:50:13 +01:00
remove virtio-win updater and use deb from repo
This commit is contained in:
parent
7546e8834e
commit
f69bd1d9ac
67
postinstall
67
postinstall
@ -294,6 +294,7 @@ ask_bashclub_repo(){
|
|||||||
|
|
||||||
bashclub_repo=0
|
bashclub_repo=0
|
||||||
install_zsync=0
|
install_zsync=0
|
||||||
|
install_virtio=0
|
||||||
if whiptail --title "INSTALL BASHCLUB REPOSITORY" \
|
if whiptail --title "INSTALL BASHCLUB REPOSITORY" \
|
||||||
--backtitle "$PROG" \
|
--backtitle "$PROG" \
|
||||||
--yes-button "INSTALL" \
|
--yes-button "INSTALL" \
|
||||||
@ -307,6 +308,13 @@ ask_bashclub_repo(){
|
|||||||
--yesno "Do you want to install checkzfs and bashclub-zsync?" 9 76 ; then
|
--yesno "Do you want to install checkzfs and bashclub-zsync?" 9 76 ; then
|
||||||
install_zsync=1
|
install_zsync=1
|
||||||
fi
|
fi
|
||||||
|
if whiptail --title "INSTALL VIRTIO-WIN-ISO" \
|
||||||
|
--backtitle "$PROG" \
|
||||||
|
--yes-button "INSTALL" \
|
||||||
|
--no-button "SKIP" \
|
||||||
|
--yesno "Do you want to install current stable virtio-win iso?" 9 76 ; then
|
||||||
|
install_virtio=1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,6 +454,9 @@ install_tools(){
|
|||||||
if [ $install_zsync -gt 0 ]; then
|
if [ $install_zsync -gt 0 ]; then
|
||||||
OPTIONAL_TOOLS="bashclub-zsync $OPTIONAL_TOOLS"
|
OPTIONAL_TOOLS="bashclub-zsync $OPTIONAL_TOOLS"
|
||||||
fi
|
fi
|
||||||
|
if [ $install_virtio -gt 0 ]; then
|
||||||
|
OPTIONAL_TOOLS="virtio-win-iso $OPTIONAL_TOOLS"
|
||||||
|
fi
|
||||||
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq install $REQUIRED_TOOLS $OPTIONAL_TOOLS > /dev/null 2>&1
|
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq install $REQUIRED_TOOLS $OPTIONAL_TOOLS > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,54 +645,14 @@ set_default_volblocksize(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
virtiowin_updater() {
|
remove_virtiowin_updater() {
|
||||||
log "Installing virtio-win-updater"
|
log "Removing virtio-win updater if exists"
|
||||||
cat << EOF > /usr/local/bin/virtio-win-updater
|
if [ -f /usr/local/bin/virtio-win-updater ]; then
|
||||||
#!/bin/bash
|
rm -f /usr/local/bin/virtio-win-updater
|
||||||
#
|
fi
|
||||||
# This script updates the virtio-win iso in Proxmox local storage
|
if [ -f /etc/cron.daily/virtio-win-updater]; then
|
||||||
content=\$(wget -q -O - https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/)
|
rm -f /etc/cron.daily/virtio-win-updater
|
||||||
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
|
fi
|
||||||
else
|
|
||||||
echo "\$(date) Already on the current stable version: \$file."
|
|
||||||
fi
|
|
||||||
EOF
|
|
||||||
chmod +x /usr/local/bin/virtio-win-updater
|
|
||||||
rm -f /etc/cron.daily/virtio-win-updater
|
|
||||||
cat << EOF > /etc/cron.daily/virtio-win-updater
|
|
||||||
#!/bin/bash
|
|
||||||
/usr/local/bin/virtio-win-updater >> /var/log/virtio-win-updater.log 2>&1
|
|
||||||
EOF
|
|
||||||
cat << EOF > /etc/logrotate.d/virtio-win-updater
|
|
||||||
/var/log/virtio-win-updater.log {
|
|
||||||
weekly
|
|
||||||
rotate 12
|
|
||||||
compress
|
|
||||||
delaycompress
|
|
||||||
missingok
|
|
||||||
notifempty
|
|
||||||
create 644 root root
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
log "Running virtio-win-updater"
|
|
||||||
virtio-win-updater
|
|
||||||
}
|
}
|
||||||
|
|
||||||
installation_task(){
|
installation_task(){
|
||||||
@ -703,7 +674,7 @@ installation_task(){
|
|||||||
set_notification
|
set_notification
|
||||||
create_swap_pool
|
create_swap_pool
|
||||||
set_default_volblocksize
|
set_default_volblocksize
|
||||||
virtiowin_updater
|
remove_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