chore: make dontstart default dialog selection.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
This commit is contained in:
Federico Di Pierro 2022-10-25 10:22:51 +02:00 committed by poiana
parent 4596c919a6
commit ca55e70a33
2 changed files with 41 additions and 49 deletions

View File

@ -21,33 +21,29 @@ chosen_driver=
case "$1" in case "$1" in
configure) configure)
if [ ! -t 0 ] ; then if [ -x /usr/bin/dialog ]; then
echo "Skipping driver selection in non-interactive mode" # If dialog is installed, create a dialog to let users choose the correct driver for them
CHOICE=$(dialog --clear --backtitle "Choose your preferred driver" --title "Falco driver" --menu "Choose one of the following options:" 15 40 4 \
1 "Don't start" \
2 "Kmod" \
3 "eBPF" \
4 "Plugin" \
2>&1 >/dev/tty)
clear
case $CHOICE in
1)
chosen_driver="kmod"
;;
2)
chosen_driver="ebpf"
;;
3)
chosen_driver="plugin"
;;
esac
else else
if [ -x /usr/bin/dialog ]; then # Default at old behavior: enable kmod driver
# If dialog is installed, create a dialog to let users choose the correct driver for them chosen_driver="kmod"
CHOICE=$(dialog --clear --backtitle "Choose your preferred driver" --title "Falco driver" --menu "Choose one of the following options:" 15 40 4 \
1 "Kmod" \
2 "eBPF" \
3 "Plugin" \
4 "Don't start" \
2>&1 >/dev/tty)
clear
case $CHOICE in
1)
chosen_driver="kmod"
;;
2)
chosen_driver="ebpf"
;;
3)
chosen_driver="plugin"
;;
esac
else
# Default at old behavior: enable kmod driver
chosen_driver="kmod"
fi
fi fi
;; ;;
esac esac

View File

@ -20,33 +20,29 @@ chosen_driver=
case "$1" in case "$1" in
configure) configure)
if [ ! -t 0 ] ; then if [ -x /usr/bin/dialog ]; then
echo "Skipping driver selection in non-interactive mode"
else
if [ -x /usr/bin/dialog ]; then
# If dialog is installed, create a dialog to let users choose the correct driver for them # If dialog is installed, create a dialog to let users choose the correct driver for them
CHOICE=$(dialog --clear --backtitle "Choose your preferred driver" --title "Falco driver" --menu "Choose one of the following options:" 15 40 4 \ CHOICE=$(dialog --clear --backtitle "Choose your preferred driver" --title "Falco driver" --menu "Choose one of the following options:" 15 40 4 \
1 "Kmod" \ 1 "Don't start" \
2 "eBPF" \ 2 "Kmod" \
3 "Plugin" \ 3 "eBPF" \
4 "Don't start" \ 4 "Plugin" \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
clear clear
case $CHOICE in case $CHOICE in
1) 1)
chosen_driver="kmod" chosen_driver="kmod"
;; ;;
2) 2)
chosen_driver="ebpf" chosen_driver="ebpf"
;; ;;
3) 3)
chosen_driver="plugin" chosen_driver="plugin"
;; ;;
esac esac
else else
# Default at old behavior: enable kmod driver # Default at old behavior: enable kmod driver
chosen_driver="kmod" chosen_driver="kmod"
fi
fi fi
;; ;;
esac esac