feat: KIAUH v4.0.0 #191
@@ -23,34 +23,11 @@ function check_for_backup_dir(){
|
||||
fi
|
||||
}
|
||||
|
||||
function toggle_backups(){
|
||||
function backup_before_update(){
|
||||
read_kiauh_ini
|
||||
if [ "${backup_before_update}" = "true" ]; then
|
||||
sed -i '/backup_before_update=/s/true/false/' "${INI_FILE}"
|
||||
BB4U_STATUS="${green}[Enable]${white} backups before updating "
|
||||
CONFIRM_MSG=" Backups before updates are now >>> DISABLED <<< !"
|
||||
fi
|
||||
if [ "${backup_before_update}" = "false" ]; then
|
||||
sed -i '/backup_before_update=/s/false/true/' "${INI_FILE}"
|
||||
BB4U_STATUS="${red}[Disable]${white} backups before updating "
|
||||
CONFIRM_MSG=" Backups before updates are now >>> ENABLED <<< !"
|
||||
fi
|
||||
}
|
||||
|
||||
function bb4u(){
|
||||
read_kiauh_ini
|
||||
if [ "${backup_before_update}" = "true" ]; then
|
||||
backup_"${1}"
|
||||
fi
|
||||
}
|
||||
|
||||
function read_bb4u_stat(){
|
||||
read_kiauh_ini
|
||||
if [ ! "${backup_before_update}" = "true" ]; then
|
||||
BB4U_STATUS="${green}[Enable]${white} backups before updating "
|
||||
else
|
||||
BB4U_STATUS="${red}[Disable]${white} backups before updating "
|
||||
fi
|
||||
local state="${backup_before_update}"
|
||||
[ "${state}" = "false" ] && return
|
||||
backup_"${1}"
|
||||
}
|
||||
|
||||
function backup_printer_cfg(){
|
||||
|
||||
@@ -233,7 +233,7 @@ function remove_fluidd(){
|
||||
#===================================================#
|
||||
|
||||
function update_fluidd(){
|
||||
bb4u "fluidd"
|
||||
backup_before_update "fluidd"
|
||||
status_msg "Updating Fluidd ..."
|
||||
fluidd_setup
|
||||
match_nginx_configs
|
||||
|
||||
@@ -341,7 +341,7 @@ function update_klipper(){
|
||||
if [ ! -d "${KLIPPER_DIR}" ]; then
|
||||
cd "${HOME}" && git clone "${KLIPPER_REPO}"
|
||||
else
|
||||
bb4u "klipper"
|
||||
backup_before_update "klipper"
|
||||
status_msg "Updating Klipper ..."
|
||||
cd "${KLIPPER_DIR}" && git pull
|
||||
### read PKGLIST and install possible new dependencies
|
||||
|
||||
@@ -238,7 +238,7 @@ function remove_mainsail(){
|
||||
#===================================================#
|
||||
|
||||
function update_mainsail(){
|
||||
bb4u "mainsail"
|
||||
backup_before_update "mainsail"
|
||||
status_msg "Updating Mainsail ..."
|
||||
mainsail_setup
|
||||
match_nginx_configs
|
||||
|
||||
@@ -395,7 +395,7 @@ function update_moonraker(){
|
||||
if [ ! -d "${MOONRAKER_DIR}" ]; then
|
||||
cd "${HOME}" && git clone "${MOONRAKER_REPO}"
|
||||
else
|
||||
bb4u "moonraker"
|
||||
backup_before_update "moonraker"
|
||||
status_msg "Updating Moonraker ..."
|
||||
cd "${MOONRAKER_DIR}" && git pull
|
||||
### read PKGLIST and install possible new dependencies
|
||||
|
||||
@@ -18,6 +18,7 @@ function settings_ui() {
|
||||
local custom_branch="${custom_klipper_repo_branch}"
|
||||
local ms_pre_rls="${mainsail_install_unstable}"
|
||||
local fl_pre_rls="${fluidd_install_unstable}"
|
||||
local bbu="${backup_before_update}"
|
||||
|
||||
### config location
|
||||
if [ -z "${custom_cfg_loc}" ]; then
|
||||
@@ -49,6 +50,12 @@ function settings_ui() {
|
||||
else
|
||||
fl_pre_rls="${green}● ${fl_pre_rls}${white}"
|
||||
fi
|
||||
### backup before update toggle
|
||||
if [ "${bbu}" == "false" ]; then
|
||||
bbu="${red}● ${bbu}${white}"
|
||||
else
|
||||
bbu="${green}● ${bbu}${white}"
|
||||
fi
|
||||
|
||||
top_border
|
||||
echo -e "| $(title_msg "~~~~~~~~~~~~ [ KIAUH Settings ] ~~~~~~~~~~~~~") |"
|
||||
@@ -63,6 +70,8 @@ function settings_ui() {
|
||||
printf "| Mainsail: %-55s|\n" "${ms_pre_rls}"
|
||||
printf "| Fluidd: %-55s|\n" "${fl_pre_rls}"
|
||||
hr
|
||||
printf "| Backup before updating: %-42s|\n" "${bbu}"
|
||||
hr
|
||||
echo -e "| 1) Change Klipper config folder location |"
|
||||
echo -e "| 2) Set custom Klipper repository |"
|
||||
if [ "${mainsail_install_unstable}" == "false" ]; then
|
||||
@@ -75,6 +84,11 @@ function settings_ui() {
|
||||
else
|
||||
echo -e "| 4) ${red}Disallow${white} unstable Fluidd releases |"
|
||||
fi
|
||||
if [ "${backup_before_update}" == "false" ]; then
|
||||
echo -e "| 5) ${green}Enable${white} automatic backups before updates |"
|
||||
else
|
||||
echo -e "| 5) ${red}Disable${white} automatic backups before updates |"
|
||||
fi
|
||||
back_help_footer
|
||||
}
|
||||
|
||||
@@ -133,6 +147,8 @@ function settings_menu(){
|
||||
switch_mainsail_releasetype && settings_menu;;
|
||||
4)
|
||||
switch_fluidd_releasetype && settings_menu;;
|
||||
5)
|
||||
toggle_backup_before_update && settings_menu;;
|
||||
B|b)
|
||||
clear
|
||||
main_menu
|
||||
|
||||
@@ -15,8 +15,6 @@ function update_ui(){
|
||||
top_border
|
||||
echo -e "| ${green}~~~~~~~~~~~~~~ [ Update Menu ] ~~~~~~~~~~~~~~${white} | "
|
||||
hr
|
||||
echo -e "| 0) ${BB4U_STATUS}| "
|
||||
hr
|
||||
echo -e "| a) [Update all] | | | "
|
||||
echo -e "| | Installed: | Latest: | "
|
||||
echo -e "| Klipper & API: |---------------|--------------| "
|
||||
@@ -40,7 +38,6 @@ function update_ui(){
|
||||
|
||||
function update_menu(){
|
||||
unset update_arr
|
||||
read_bb4u_stat
|
||||
do_action "" "update_ui"
|
||||
while true; do
|
||||
read -p "${cyan}####### Perform action:${white} " action
|
||||
|
||||
@@ -310,6 +310,16 @@ function switch_fluidd_releasetype() {
|
||||
|
|
||||
fi
|
||||
}
|
||||
|
||||
function toggle_backup_before_update(){
|
||||
```suggestion
sudo cp "/etc/hosts" "/etc/hosts.${current_date}.bak"
```
I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk. I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk.
```
###### Creating backup of hosts file ...
cp: missing destination file operand after '/etc/hosts /etc/hosts.220503-2314.bak'
Try 'cp --help' for more information.
```
Thank you! Yes that was indeed a typo and i just fixed it. Thank you! Yes that was indeed a typo and i just fixed it.
|
||||
read_kiauh_ini
|
||||
```suggestion
sudo cp "/etc/hosts" "/etc/hosts.${current_date}.bak"
```
I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk. I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk.
```
###### Creating backup of hosts file ...
cp: missing destination file operand after '/etc/hosts /etc/hosts.220503-2314.bak'
Try 'cp --help' for more information.
```
Thank you! Yes that was indeed a typo and i just fixed it. Thank you! Yes that was indeed a typo and i just fixed it.
|
||||
local state="${backup_before_update}"
|
||||
```suggestion
sudo cp "/etc/hosts" "/etc/hosts.${current_date}.bak"
```
I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk. I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk.
```
###### Creating backup of hosts file ...
cp: missing destination file operand after '/etc/hosts /etc/hosts.220503-2314.bak'
Try 'cp --help' for more information.
```
Thank you! Yes that was indeed a typo and i just fixed it. Thank you! Yes that was indeed a typo and i just fixed it.
|
||||
if [ "${state}" = "false" ]; then
|
||||
```suggestion
sudo cp "/etc/hosts" "/etc/hosts.${current_date}.bak"
```
I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk. I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk.
```
###### Creating backup of hosts file ...
cp: missing destination file operand after '/etc/hosts /etc/hosts.220503-2314.bak'
Try 'cp --help' for more information.
```
Thank you! Yes that was indeed a typo and i just fixed it. Thank you! Yes that was indeed a typo and i just fixed it.
|
||||
sed -i '/backup_before_update=/s/false/true/' "${INI_FILE}"
|
||||
```suggestion
sudo cp "/etc/hosts" "/etc/hosts.${current_date}.bak"
```
I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk. I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk.
```
###### Creating backup of hosts file ...
cp: missing destination file operand after '/etc/hosts /etc/hosts.220503-2314.bak'
Try 'cp --help' for more information.
```
Thank you! Yes that was indeed a typo and i just fixed it. Thank you! Yes that was indeed a typo and i just fixed it.
|
||||
else
|
||||
```suggestion
sudo cp "/etc/hosts" "/etc/hosts.${current_date}.bak"
```
I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk. I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk.
```
###### Creating backup of hosts file ...
cp: missing destination file operand after '/etc/hosts /etc/hosts.220503-2314.bak'
Try 'cp --help' for more information.
```
Thank you! Yes that was indeed a typo and i just fixed it. Thank you! Yes that was indeed a typo and i just fixed it.
|
||||
sed -i '/backup_before_update=/s/true/false/' "${INI_FILE}"
|
||||
```suggestion
sudo cp "/etc/hosts" "/etc/hosts.${current_date}.bak"
```
I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk. I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk.
```
###### Creating backup of hosts file ...
cp: missing destination file operand after '/etc/hosts /etc/hosts.220503-2314.bak'
Try 'cp --help' for more information.
```
Thank you! Yes that was indeed a typo and i just fixed it. Thank you! Yes that was indeed a typo and i just fixed it.
|
||||
fi
|
||||
```suggestion
sudo cp "/etc/hosts" "/etc/hosts.${current_date}.bak"
```
I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk. I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk.
```
###### Creating backup of hosts file ...
cp: missing destination file operand after '/etc/hosts /etc/hosts.220503-2314.bak'
Try 'cp --help' for more information.
```
Thank you! Yes that was indeed a typo and i just fixed it. Thank you! Yes that was indeed a typo and i just fixed it.
|
||||
}
|
||||
```suggestion
sudo cp "/etc/hosts" "/etc/hosts.${current_date}.bak"
```
I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk. I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk.
```
###### Creating backup of hosts file ...
cp: missing destination file operand after '/etc/hosts /etc/hosts.220503-2314.bak'
Try 'cp --help' for more information.
```
Thank you! Yes that was indeed a typo and i just fixed it. Thank you! Yes that was indeed a typo and i just fixed it.
|
||||
|
||||
```suggestion
sudo cp "/etc/hosts" "/etc/hosts.${current_date}.bak"
```
I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk. I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk.
```
###### Creating backup of hosts file ...
cp: missing destination file operand after '/etc/hosts /etc/hosts.220503-2314.bak'
Try 'cp --help' for more information.
```
Thank you! Yes that was indeed a typo and i just fixed it. Thank you! Yes that was indeed a typo and i just fixed it.
|
||||
function set_custom_klipper_repo() {
|
||||
read_kiauh_ini
|
||||
local repo_url=${1} branch=${2}
|
||||
|
||||
```suggestion
sudo cp "/etc/hosts" "/etc/hosts.${current_date}.bak"
```
```suggestion
sudo cp "/etc/hosts" "/etc/hosts.${current_date}.bak"
```
I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk. I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk.
```
###### Creating backup of hosts file ...
cp: missing destination file operand after '/etc/hosts /etc/hosts.220503-2314.bak'
Try 'cp --help' for more information.
```
I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk. I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk.
```
###### Creating backup of hosts file ...
cp: missing destination file operand after '/etc/hosts /etc/hosts.220503-2314.bak'
Try 'cp --help' for more information.
```
Thank you! Yes that was indeed a typo and i just fixed it. Thank you! Yes that was indeed a typo and i just fixed it.
Thank you! Yes that was indeed a typo and i just fixed it. Thank you! Yes that was indeed a typo and i just fixed it.
|
||||
I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk.
I had to make this change in order to fix the error I got when I attempted to change the hostname (4/advanced, 7/change hostname from the menus) on armbian-22.05-trunk.
Thank you! Yes that was indeed a typo and i just fixed it.
Thank you! Yes that was indeed a typo and i just fixed it.