chore(scripts): when running in non-interactive mode, do not enable neither start any driver.

Eg: when building Falco docker image, and installing Falco package, we don't want it to build any driver.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
This commit is contained in:
Federico Di Pierro
2022-10-14 09:05:38 +02:00
committed by poiana
parent 818f717622
commit e26aa6a385
2 changed files with 40 additions and 32 deletions

View File

@@ -17,14 +17,14 @@
# #
set -e set -e
chosen_driver="kmod" chosen_driver=
if [ -z "$PS1" ]; then case "$1" in
echo "Skipping driver selection in non-interactive mode"
else
case "$1" in
configure) configure)
if [ -x /usr/bin/dialog ]; then if [ ! -t 0 ] ; then
echo "Skipping driver selection in non-interactive mode"
else
if [ -x /usr/bin/dialog ]; then
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 "Kmod" \
2 "eBPF" \ 2 "eBPF" \
@@ -42,10 +42,12 @@ else
chosen_driver= chosen_driver=
;; ;;
esac esac
else
chosen_driver="kmod"
fi fi
fi
;; ;;
esac esac
fi
case "$chosen_driver" in case "$chosen_driver" in
"kmod") "kmod")

View File

@@ -16,31 +16,37 @@
# #
set -e set -e
chosen_driver="kmod" chosen_driver=
if [ -z "$PS1" ]; then case "$1" in
echo "Skipping driver selection in non-interactive mode" configure)
else if [ ! -t 0 ] ; then
if [ -x /usr/bin/dialog ]; then echo "Skipping driver selection in non-interactive mode"
CHOICE=$(dialog --clear --backtitle "Choose your preferred driver" --title "Falco driver" --menu "Choose one of the following options:" 15 40 4 \ else
1 "Kmod" \ if [ -x /usr/bin/dialog ]; then
2 "eBPF" \ CHOICE=$(dialog --clear --backtitle "Choose your preferred driver" --title "Falco driver" --menu "Choose one of the following options:" 15 40 4 \
3 "Don't start" \ 1 "Kmod" \
2>&1 >/dev/tty) 2 "eBPF" \
clear 3 "Don't start" \
case $CHOICE in 2>&1 >/dev/tty)
1) clear
chosen_driver="kmod" case $CHOICE in
;; 1)
2) chosen_driver="kmod"
chosen_driver="ebpf" ;;
;; 2)
3) chosen_driver="ebpf"
chosen_driver= ;;
;; 3)
esac chosen_driver=
fi ;;
fi esac
else
chosen_driver="kmod"
fi
fi
;;
esac
case "$chosen_driver" in case "$chosen_driver" in
"kmod") "kmod")