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
chosen_driver="kmod"
chosen_driver=
if [ -z "$PS1" ]; then
echo "Skipping driver selection in non-interactive mode"
else
case "$1" in
case "$1" in
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 \
1 "Kmod" \
2 "eBPF" \
@@ -42,10 +42,12 @@ else
chosen_driver=
;;
esac
else
chosen_driver="kmod"
fi
fi
;;
esac
fi
esac
case "$chosen_driver" in
"kmod")

View File

@@ -16,31 +16,37 @@
#
set -e
chosen_driver="kmod"
chosen_driver=
if [ -z "$PS1" ]; 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 \
1 "Kmod" \
2 "eBPF" \
3 "Don't start" \
2>&1 >/dev/tty)
clear
case $CHOICE in
1)
chosen_driver="kmod"
;;
2)
chosen_driver="ebpf"
;;
3)
chosen_driver=
;;
esac
fi
fi
case "$1" in
configure)
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 \
1 "Kmod" \
2 "eBPF" \
3 "Don't start" \
2>&1 >/dev/tty)
clear
case $CHOICE in
1)
chosen_driver="kmod"
;;
2)
chosen_driver="ebpf"
;;
3)
chosen_driver=
;;
esac
else
chosen_driver="kmod"
fi
fi
;;
esac
case "$chosen_driver" in
"kmod")