Skip to content

Commit

Permalink
feat: Added additional dialog for menuconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
2b-t committed Mar 4, 2023
1 parent dbde070 commit 46007f8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/compile_kernel_preemptrt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ function install_kernel_interactive() {
set_recommended_preemptrt_settings
info_msg "Forcing unsigned kernel..."
unsign_kernel_configuration
info_msg "Override any settings if desired, else simply exit the menu..."
make menuconfig
info_msg "Override settings manually with menuconfig if desired..."
IS_MANUAL_CONFIG=$(select_manual_configuration)
if [ "${IS_MANUAL_CONFIG}" -eq 0 ]
then
make menuconfig
fi

local INSTALLATION_MODE=$(select_installation_mode)
if [ "${INSTALLATION_MODE}" == "Debian" ]
Expand Down
8 changes: 7 additions & 1 deletion src/lib_compile_kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ function set_recommended_preemptrt_settings() {
find_and_replace_in_config "${KERNEL_CONFIG_FILE}" "CONFIG_CPU_ISOLATION" "y"
}

function select_manual_configuration() {
declare desc="Decide whether to make additional changes with menuconfig to the kernel configuration or not"
dialog --keep-tite --stdout --title "Start menuconfig" --defaultno --yesno "Do you want to make manual changes to the kernel configuration with menuconfig?" 0 0
echo $?
}

function select_installation_mode() {
declare desc="Select installation modality"
echo $(dialog --keep-tite --stdout --default-item "Debian package" --menu "Select the desired installation mode:" 0 0 5 "Debian" "Debian package" "Classic" "Install directly")
Expand All @@ -218,7 +224,7 @@ function generate_preemptrt_kernel_debian_package() {

function select_install_now() {
declare desc="Decide whether to install the patched kernel from Debian package now or install it later on"
dialog --keep-tite --stdout --title "Install Debian package" --yesno "Want to install the Debian package now" 0 0
dialog --keep-tite --stdout --title "Install Debian package" --yesno "Want to install the Debian package now?" 0 0
echo $?
}

Expand Down
13 changes: 13 additions & 0 deletions test/test_lib_compile_kernel.bats
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,19 @@ function setup() {
assert_regex "${RESULT_CONFIG}" "^#SOME_SETTING"
}

@test "Test select_manual_configuration" {
declare desc="Test if the manual configuration can be started from the graphic user menu"
tmux new -d -A -s "bats_test_session"
local TEST_FILE=$(test_file)
tmux send-keys -t "bats_test_session" "source ${TEST_FILE}" Enter
tmux send-keys -t "bats_test_session" 'echo $(select_manual_configuration) >/tmp/capture' Enter
sleep 5
tmux send-keys -t "bats_test_session" Enter
tmux send-keys -t "bats_test_session" "exit" Enter
local IS_MANUAL_CONFIG=$(</tmp/capture)
assert_equal "${IS_MANUAL_CONFIG}" 1
}

@test "Test select_installation_mode" {
declare desc="Test if the installation mode can be selected from the graphic user menu"
tmux new -d -A -s "bats_test_session"
Expand Down

0 comments on commit 46007f8

Please sign in to comment.