diff options
Diffstat (limited to 'examples/lvm_menu/lvm_menu.sh')
-rw-r--r-- | examples/lvm_menu/lvm_menu.sh | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/examples/lvm_menu/lvm_menu.sh b/examples/lvm_menu/lvm_menu.sh index 3f5c076..791237e 100644 --- a/examples/lvm_menu/lvm_menu.sh +++ b/examples/lvm_menu/lvm_menu.sh @@ -1,5 +1,19 @@ #!/usr/bin/env bash +# ==================== # +# Fatal error function # +# ==================== # +function error +{ + echo $* >&2 + exit 1 +} + +# Check for the presence of smenu +# """"""""""""""""""""""""""""""" +SMENU=$(which smenu 2>/dev/null) +[[ -x "$SMENU" ]] || error "smenu is not in the PATH or not executable." + MENU+="\ 'Create' 'Delete' 'Extend' 'Shrink' 'VGC VG' 'VGD VG' 'VGE VG' 'VGS VG' @@ -19,7 +33,7 @@ do echo MESSAGE="LVM management" - read REP <<< $(echo "$MENU" | ./menu.sh -i "$MESSAGE" "-Re1") + read REP <<< $(echo "$MENU" | ./menu.sh -p $SMENU -i "$MESSAGE" "-Re1") case $REP in ABORT) exit 1 ;; |