amelioration check last zfs boot menu release

This commit is contained in:
Michel Le Cocq 2025-02-09 14:41:07 +01:00
parent c1c1d34d63
commit 4fafd17e1c

View File

@ -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 <lecocq@ipgp.fr>
# <nomad@neuronfarm.net>
@ -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 ???
# check last zfs boot menu release
# compare if we are on last release
printf '\nCheck ZFS_BOOT_MENU:\n'
# 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
PA="https://get.zfsbootmenu.org/sha256.txt"
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 :'
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()