grub-btrfs: print version of the script with --version

Close #225

Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
This commit is contained in:
Pascal Jäger
2022-11-21 22:59:22 +01:00
parent 1969132073
commit 33810a9274
3 changed files with 36 additions and 1 deletions
Regular → Executable
+21
View File
@@ -51,6 +51,27 @@ print_error()
exit 0
}
# parse arguments
while getopts :V-: opt; do
case "$opt" in
-)
case "${OPTARG}" in
version)
printf "Version %s\n" "${GRUB_BTRFS_VERSION}" >&2 ;
exit 0
;;
esac;;
V)
printf "Version %s\n" "${GRUB_BTRFS_VERSION}" >&2 ;
exit 0
;;
*)
printf "Unknown flag, exiting...\n"
exit 0
;;
esac
done
## Exit the script, if:
[[ "${GRUB_BTRFS_DISABLE,,}" == "true" ]] && print_error "GRUB_BTRFS_DISABLE is set to true (default=false)"
if ! type btrfs >/dev/null 2>&1; then print_error "btrfs-progs isn't installed"; fi