chore(scripts,cmake): dialog is an optional dep, do not list it among deps.

Cleaned up unused vars in postinst scripts.
Finally, only show dialog window in interactive shells.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
This commit is contained in:
Federico Di Pierro
2022-10-13 08:45:22 +02:00
committed by poiana
parent 9232383616
commit 818f717622
4 changed files with 67 additions and 63 deletions

View File

@@ -16,36 +16,39 @@
#
set -e
mod_version="@DRIVER_VERSION@"
chosen_driver="kmod"
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
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 "$chosen_driver" in
"kmod")
falco-driver-loader module
;;
"ebpf")
falco-driver-loader bpf
;;
"kmod")
falco-driver-loader module
;;
"ebpf")
falco-driver-loader bpf
;;
esac
# validate rpm macros by `rpm -qp --scripts <rpm>`