From 4fafd17e1cb2e3805c1d901303bb8cf800e0741d Mon Sep 17 00:00:00 2001 From: Michel Le Cocq Date: Sun, 9 Feb 2025 14:41:07 +0100 Subject: [PATCH] amelioration check last zfs boot menu release --- upsnapz.sh | 53 ++++++++++++++++------------------------------------- 1 file changed, 16 insertions(+), 37 deletions(-) diff --git a/upsnapz.sh b/upsnapz.sh index 3158dff..bcf9bae 100755 --- a/upsnapz.sh +++ b/upsnapz.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Time-stamp: <2025-02-09 08:16:42 nomad> +# Time-stamp: <2025-02-09 14:40:32 nomad> # # Michel Le Cocq # @@ -19,6 +19,9 @@ # check zfs boot menu release # check zfs pool status +# Depend : +# - gh + # To do or not : # # ajouter zpool upgrade or not @@ -46,52 +49,28 @@ function check_zpool_status function check_ZFS_BOOT_MENU { - # need to do - # use https://github.com/zbm-dev/zfsbootmenu/releases/download/v3.0.1/sha256.txt - # check sha256sum /boot/efi/EFI/ZBM/VMLINUZ.EFI vs .../sha256.txt - # display your current using release - # - # affiche si la version que l'on a actuellement est dans le fichier sha256.txt du github - # grep $(sha256sum /boot/efi/EFI/ZBM/VMLINUZ.EFI | awk '{print $1}') sha256.txt - # - # le numero de version est dans l'URL - # url du dernier : https://get.zfsbootmenu.org/latest.EFI - # comment afficher le numero de version actuel ??? - - printf '\nCheck ZFS_BOOT_MENU:\n' + # check last zfs boot menu release + # compare if we are on last release - # curl -# -o /tmp/VMLINUZ.EFI -L https://get.zfsbootmenu.org/efi - # if [ $(md5sum /tmp/VMLINUZ.EFI | awk '{print $1}') != $(md5sum /boot/efi/EFI/ZBM/VMLINUZ.EFI | awk '{print $1}') ]; - # then - # printf '\n/!\ /boot/efi/EFI/ZBM/VMLINUZ.EFI is different as one present on https://get.zfsbootmenu.org/efi\n\n' - # printf '\n https://github.com/zbm-dev/zfsbootmenu/releases\n' - # printf 'considere update it by running:\n\n' - # printf ' curl -o /boot/efi/EFI/ZBM/VMLINUZ.EFI -L https://get.zfsbootmenu.org/efi\n' - # printf ' cp /boot/efi/EFI/ZBM/VMLINUZ.EFI /boot/efi/EFI/ZBM/VMLINUZ-BACKUP.EFI\n\n' - # else - # printf 'every things ok for ZFS_BOOT_MENU\n' - # fi - # rm /tmp/VMLINUZ.EFI - + printf '\nCheck ZFS_BOOT_MENU:\n' PA="https://get.zfsbootmenu.org/sha256.txt" - echo "Hit:zfsbootmenu "$PA + echo " Hit:zfsbootmenu "$PA curl -s -o /tmp/sha256.txt -L $PA e=$(grep $(sha256sum /boot/efi/EFI/ZBM/VMLINUZ.EFI | awk '{print $1}') /tmp/sha256.txt | awk -F"[()]" '{print $2}' ) - echo -n "zfsbootmenu version : " + echo -n " Installed Release : " echo $e | awk -F'-' '{print $4}' + f=$(gh release list --repo https://github.com/zbm-dev/zfsbootmenu | grep Latest | awk -F' ' '{print $4}') + printf ' Latest Release : ' + echo $f if [ ! -z $e ] then - echo "in sync with : "$PA + echo " in sync with :" $(echo $PA | awk -F'/' '{print $NF}') else - echo "/!\ not in sync with : "$PA - echo 'avaible release :' + echo " /!\ not in sync with : "$PA + echo ' avaible release :' cat /tmp/sha256.txt | grep EFI | grep release | awk -F"[()]" '{print $2}' fi - - # check with: - # GitHub/zfsbootmenu - # gh release list - # gh repo view https://github.com/zbm-dev/zfsbootmenu + rm /tmp/sha256.txt } function askpromote()