diff --git a/scripts/debian/postinst.in b/scripts/debian/postinst.in index c7c3d3ac..59738ffc 100755 --- a/scripts/debian/postinst.in +++ b/scripts/debian/postinst.in @@ -15,38 +15,41 @@ # See the License for the specific language governing permissions and # limitations under the License. # -set -e chosen_driver= if [ "$1" = "configure" ]; 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) + 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") diff --git a/scripts/rpm/postinstall.in b/scripts/rpm/postinstall.in index 75a66bd9..4dce2756 100755 --- a/scripts/rpm/postinstall.in +++ b/scripts/rpm/postinstall.in @@ -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")