From 73d68a2a9f76a8cda0df4343d5c13586bc248b88 Mon Sep 17 00:00:00 2001 From: Michel Le Cocq Date: Mon, 10 Feb 2025 07:05:16 +0100 Subject: [PATCH] add require et deplacement d'un test --- upsnapz.sh | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/upsnapz.sh b/upsnapz.sh index 321769d..91d5622 100755 --- a/upsnapz.sh +++ b/upsnapz.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Time-stamp: <2025-02-10 06:32:43 nomad> +# Time-stamp: <2025-02-10 07:05:07 nomad> # Michel Le Cocq # @@ -18,8 +18,10 @@ # zfs clone promote # check zfs boot menu release # check zfs pool status + # Depend : # - gh +# - full sudo permission # To do or not : # @@ -49,28 +51,36 @@ function check_ZFS_BOOT_MENU # check last zfs boot menu release # compare if we are on last release + # pas tout à fait satisfait de cette fonction ! + printf '\nCheck ZFS_BOOT_MENU:\n' 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}' ) + e=$(grep $(sha256sum /boot/efi/EFI/ZBM/VMLINUZ.EFI | awk '{print $1}') /tmp/sha256.txt | awk -F"[()]" '{print $2}' ) echo -n " Installed Release : " e=$(echo $e | awk -F'-' '{print $4}') - echo $e - # pas tout a fait satisfait de cette methode avec gh - # force a s'authentifier sur github ! - f=$(gh release list --repo https://github.com/zbm-dev/zfsbootmenu | grep Latest | awk -F' ' '{print $4}') - if [ "$e" != "$f" ] - then - echo " /!\ Installed Release and lastest are not same !"$PA - printf ' Latest Release : ' - echo $f - fi if [ -z $e ] then - echo " /!\ not in sync with : "$PA + echo " /!\ sha256sum of ZBM/VMLINUZ.EFI" + echo " not in sync with : "$PA echo ' avaible release :' cat /tmp/sha256.txt | grep EFI | grep release | awk -F"[()]" '{print $2}' + else + echo $e + # pas tout a fait satisfait de cette methode avec gh + # force a s'authentifier sur github ! + dpkg -l gh &> /dev/null + if [ $? -eq 0 ] + then + f=$(gh release list --repo https://github.com/zbm-dev/zfsbootmenu | grep Latest | awk -F' ' '{print $4}') + if [ "$e" != "$f" ] + then + echo " /!\ Installed Release and lastest are not same !"$PA + printf ' Latest Release : ' + echo $f + fi + fi fi rm /tmp/sha256.txt } @@ -167,6 +177,7 @@ function askautoclean() fi fi sudo apt autoclean + echo } function asksnap() @@ -197,6 +208,19 @@ function asksnap() fi } +function snapchange +{ + # check/show snap change/refresh + + dpkg -l snapd &> /dev/null + if [ $? -eq 0 ] + then + printf '%s\n' 'snap refresh && snap changes' + sudo snap refresh + snap changes + fi +} + function askupgrade() { # run apt update @@ -263,6 +287,7 @@ done askupgrade askautoclean +snapchange echo check_zpool_status check_ZFS_BOOT_MENU