add require et deplacement d'un test

This commit is contained in:
Michel Le Cocq 2025-02-10 07:05:16 +01:00
parent f0d3c6a36c
commit 73d68a2a9f

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# Time-stamp: <2025-02-10 06:32:43 nomad> # Time-stamp: <2025-02-10 07:05:07 nomad>
# Michel Le Cocq <lecocq@ipgp.fr> # Michel Le Cocq <lecocq@ipgp.fr>
# <nomad@neuronfarm.net> # <nomad@neuronfarm.net>
@ -18,8 +18,10 @@
# zfs clone promote # zfs clone promote
# check zfs boot menu release # check zfs boot menu release
# check zfs pool status # check zfs pool status
# Depend : # Depend :
# - gh # - gh
# - full sudo permission
# To do or not : # To do or not :
# #
@ -49,28 +51,36 @@ function check_ZFS_BOOT_MENU
# check last zfs boot menu release # check last zfs boot menu release
# compare if we are on last release # compare if we are on last release
# pas tout à fait satisfait de cette fonction !
printf '\nCheck ZFS_BOOT_MENU:\n' printf '\nCheck ZFS_BOOT_MENU:\n'
PA="https://get.zfsbootmenu.org/sha256.txt" PA="https://get.zfsbootmenu.org/sha256.txt"
echo " Hit:zfsbootmenu "$PA echo " Hit:zfsbootmenu "$PA
curl -s -o /tmp/sha256.txt -L $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 : " echo -n " Installed Release : "
e=$(echo $e | awk -F'-' '{print $4}') 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 ] if [ -z $e ]
then then
echo " /!\ not in sync with : "$PA echo " /!\ sha256sum of ZBM/VMLINUZ.EFI"
echo " not in sync with : "$PA
echo ' avaible release :' echo ' avaible release :'
cat /tmp/sha256.txt | grep EFI | grep release | awk -F"[()]" '{print $2}' 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 fi
rm /tmp/sha256.txt rm /tmp/sha256.txt
} }
@ -167,6 +177,7 @@ function askautoclean()
fi fi
fi fi
sudo apt autoclean sudo apt autoclean
echo
} }
function asksnap() function asksnap()
@ -197,6 +208,19 @@ function asksnap()
fi 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() function askupgrade()
{ {
# run apt update # run apt update
@ -263,6 +287,7 @@ done
askupgrade askupgrade
askautoclean askautoclean
snapchange
echo echo
check_zpool_status check_zpool_status
check_ZFS_BOOT_MENU check_ZFS_BOOT_MENU