chore(scripts): manage dialog cancel button, and increase dialog vertical size to comprehend all of 5 options.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
This commit is contained in:
Federico Di Pierro
2022-11-17 09:53:00 +01:00
committed by poiana
parent 76c8a645f1
commit 4c550bbe06
2 changed files with 39 additions and 32 deletions

View File

@@ -14,38 +14,42 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
set -e
chosen_driver=
if [ $1 -eq 1 ]; then
if [ -x /usr/bin/dialog ]; then
# 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 5 \
1 "Don't start" \
2 "Kmod" \
3 "eBPF" \
4 "Modern eBPF" \
5 "Plugin" \
2>&1 >/dev/tty)
# When user presses cancel, go on as default (don't start)
if [ $? -eq 0 ]; then
case $CHOICE in
2)
chosen_driver="kmod"
;;
3)
chosen_driver="bpf"
;;
4)
chosen_driver="modern-bpf"
;;
5)
chosen_driver="plugin"
;;
esac
fi
clear
case $CHOICE in
2)
chosen_driver="kmod"
;;
3)
chosen_driver="bpf"
;;
4)
chosen_driver="modern-bpf"
;;
5)
chosen_driver="plugin"
;;
esac
fi
fi
set -e
# If needed, try to load/compile the driver through falco-driver-loader
case "$chosen_driver" in
"kmod")