feat: custom klipper repos

Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
th33xitus
2022-04-17 17:45:10 +02:00
parent 5f78228eb0
commit af0f03008c
6 changed files with 214 additions and 45 deletions

View File

@@ -14,14 +14,31 @@ set -e
function settings_ui() {
read_kiauh_ini
local custom_cfg_loc="${custom_klipper_cfg_loc}"
local custom_repo="${custom_klipper_repo}"
local custom_branch="${custom_klipper_repo_branch}"
local ms_pre_rls="${mainsail_install_unstable}"
local fl_pre_rls="${fluidd_install_unstable}"
### config location
if [ -z "${custom_cfg_loc}" ]; then
custom_cfg_loc="${cyan}${KLIPPER_CONFIG}${white}"
else
custom_cfg_loc="${cyan}${custom_cfg_loc}${white}"
fi
### custom repository
custom_repo=$(echo "${custom_repo}" | sed "s/https:\/\/github\.com\///" | sed "s/\.git$//" )
if [ -z "${custom_repo}" ]; then
custom_repo="${cyan}Klipper3D/klipper${white}"
else
custom_repo="${cyan}${custom_repo}${white}"
fi
### custom repository branch
if [ -z "${custom_branch}" ]; then
custom_branch="${cyan}master${white}"
else
custom_branch="${cyan}${custom_branch}${white}"
fi
### webinterface stable toggle
if [ "${ms_pre_rls}" == "false" ]; then
ms_pre_rls="${red}${ms_pre_rls}${white}"
else
@@ -37,15 +54,27 @@ function settings_ui() {
echo -e "| $(title_msg "~~~~~~~~~~~~ [ KIAUH Settings ] ~~~~~~~~~~~~~") |"
hr
echo -e "| Klipper: |"
printf "| Config folder: %-49s|\n" "${custom_cfg_loc}"
blank_line
echo -e "| ● Config folder: |"
printf "| %-60s|\n" "${custom_cfg_loc}"
echo -e "| ● Repository: |"
printf "| %-70s|\n" "${custom_repo} (${custom_branch})"
hr
echo -e "| Install unstable releases: |"
printf "| Mainsail: %-56s|\n" "${ms_pre_rls}"
printf "| Fluidd: %-56s|\n" "${fl_pre_rls}"
printf "| Mainsail: %-55s|\n" "${ms_pre_rls}"
printf "| Fluidd: %-55s|\n" "${fl_pre_rls}"
hr
echo -e "| 1) Change Klipper config folder location |"
echo -e "| 2) Allow / Disallow unstable Mainsail releases |"
echo -e "| 3) Allow / Disallow unstable Fluidd releases |"
echo -e "| 2) Set custom Klipper repository |"
if [ "${mainsail_install_unstable}" == "false" ]; then
echo -e "| 3) ${green}Allow${white} unstable Mainsail releases |"
else
echo -e "| 3) ${red}Disallow${white} unstable Mainsail releases |"
fi
if [ "${fluidd_install_unstable}" == "false" ]; then
echo -e "| 4) ${green}Allow${white} unstable Fluidd releases |"
else
echo -e "| 4) ${red}Disallow${white} unstable Fluidd releases |"
fi
back_help_footer
}
@@ -89,6 +118,7 @@ function show_settings_help(){
}
settings_menu(){
clear && print_header
settings_ui
while true; do
read -p "${cyan}Perform action:${white} " action; echo
@@ -96,9 +126,13 @@ settings_menu(){
1)
change_klipper_cfg_folder && settings_ui;;
2)
switch_mainsail_releasetype && settings_ui;;
clear && print_header
change_klipper_repo_menu
settings_ui;;
3)
switch_fluidd_releasetype && settings_ui;;
switch_mainsail_releasetype && settings_menu;;
4)
switch_fluidd_releasetype && settings_menu;;
B|b)
clear
main_menu