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

@ -51,7 +51,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "arm64")
endif()
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://www.falco.org")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "dkms (>= 2.1.0.0), dialog")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "dkms (>= 2.1.0.0)")
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"${CMAKE_BINARY_DIR}/scripts/debian/postinst;${CMAKE_BINARY_DIR}/scripts/debian/prerm;${CMAKE_BINARY_DIR}/scripts/debian/postrm;${PROJECT_SOURCE_DIR}/cmake/cpack/debian/conffiles"
)
@ -59,7 +59,7 @@ set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
set(CPACK_RPM_PACKAGE_LICENSE "Apache v2.0")
set(CPACK_RPM_PACKAGE_ARCHITECTURE, "amd64")
set(CPACK_RPM_PACKAGE_URL "https://www.falco.org")
set(CPACK_RPM_PACKAGE_REQUIRES "dkms, kernel-devel, systemd, dialog")
set(CPACK_RPM_PACKAGE_REQUIRES "dkms, kernel-devel, systemd")
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/scripts/rpm/postinstall")
set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/scripts/rpm/preuninstall")
set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/scripts/rpm/postuninstall")

View File

@ -15,7 +15,7 @@ RUN if [ "$TARGETARCH" = "amd64" ] ; then curl -L -o grpcurl.tar.gz \
https://github.com/fullstorydev/grpcurl/releases/download/v1.8.6/grpcurl_1.8.6_linux_arm64.tar.gz; \
fi;
RUN dnf install -y python-pip python docker findutils jq unzip && dnf clean all
RUN dnf install -y python-pip python docker findutils jq unzip sed curl && dnf clean all
ENV PATH="/root/.local/bin/:${PATH}"
RUN pip install --user avocado-framework==69.0
RUN pip install --user avocado-framework-plugin-varianter-yaml-to-mux==69.0

View File

@ -17,42 +17,43 @@
#
set -e
DKMS_PACKAGE_NAME="@PACKAGE_NAME@"
DKMS_VERSION="@DRIVER_VERSION@"
NAME="@PACKAGE_NAME@"
chosen_driver="kmod"
case "$1" in
configure)
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
case "$chosen_driver" in
"kmod")
falco-driver-loader module
;;
"ebpf")
falco-driver-loader bpf
;;
esac
;;
if [ -z "$PS1" ]; then
echo "Skipping driver selection in non-interactive mode"
else
case "$1" in
configure)
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
;;
esac
fi
case "$chosen_driver" in
"kmod")
falco-driver-loader module
;;
"ebpf")
falco-driver-loader bpf
;;
esac
# Based off what debhelper dh_systemd_enable/13.3.4 would have added

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>`