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
# Time-stamp: <2025-02-10 06:32:43 nomad>
# Time-stamp: <2025-02-10 07:05:07 nomad>
# Michel Le Cocq <lecocq@ipgp.fr>
# <nomad@neuronfarm.net>
@ -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,6 +51,8 @@ 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
@ -56,21 +60,27 @@ function check_ZFS_BOOT_MENU
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