src/zlevis-mkinitfs.in: update

Added check functionality, to check if zlevis is installed into mkinitfs
and if the features are active.
This commit is contained in:
Luc Bijl 2025-10-28 22:14:05 +01:00
parent 6e769464cf
commit ca5daa5453

View file

@ -24,7 +24,7 @@ fi
# Function to display usage information of zlevis-mkinitfs
info() {
exec >&2
echo "Usage: \"zlevis-mkinitfs {install|uninstall}\""
echo "Usage: \"zlevis-mkinitfs {install|uninstall|check}\""
exit 2
}
@ -95,9 +95,31 @@ uninstall() {
fi
}
# Function to check if zlevis is installed in mkinitfs
check() {
if grep -q "zlevis" "${loc_mkinitfs}/initramfs-init"; then
if [ -f "${loc_mkinitfs}/initramfs-init.bak" ]; then
echo "[+] zlevis is installed in mkinitfs with zlevis-mkinitfs"
else
echo "[+] zlevis is installed in mkinitfs without zlevis-mkinitfs"
fi
else
echo "[-] zlevis is not installed into mkinitfs"
fi
if grep -q "^features=.*zlevis" "$loc_conf"; then
echo "[+] zlevis is present in features"
exit 0
else
echo "[-] zlevis is not present in features"
exit 0
fi
}
# Determine the argument path and execute the relevant function
case "$1" in
"install") install;;
"uninstall") uninstall;;
"check") check;;
*) info;;
esac