From 16c3dc6b667347d388f380c5edfa2016cb1f3b70 Mon Sep 17 00:00:00 2001 From: Adrian Wannenmacher Date: Sat, 19 Jun 2021 15:17:59 +0200 Subject: [PATCH] feat: :sparkles: make efibootmgr and sbsign optional dependencies --- src/snap-pac-uki.fish | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/snap-pac-uki.fish b/src/snap-pac-uki.fish index 4b497e4..eeda028 100755 --- a/src/snap-pac-uki.fish +++ b/src/snap-pac-uki.fish @@ -7,10 +7,8 @@ end function check_deps -d "checks if all dependencies are available" set -l dependencies \ - "efibootmgr" \ "jq" \ "rg" \ - "sbsign" \ "sed" \ "snapper" \ @@ -21,6 +19,18 @@ function check_deps -d "checks if all dependencies are available" error "missing depenency: $dep" end end + + which "efibootmgr" >/dev/null 2>/dev/null + if test $status != "0" -a $CFG_EFI = "yes" + set -g CFG_EFI "no" + echo "CFG_EFI overwriten to \"no\": 'efibootmgr' not available" + end + + which "sbsign" >/dev/null 2>/dev/null + if test $status != "0" -a $CFG_EFI = "yes" + set -g CFG_SECUREBOOT "no" + echo "CFG_SECUREBOOT overwriten to \"no\": 'sbsign' not available" + end end function find_tasks -d "finds out what the program needs to do" @@ -122,9 +132,9 @@ end function main # prepare for execution - check_deps source "/etc/snap-pac-uki/config.fish" config + check_deps switch $argv[1] case "snapshots"