feat: version select on startup (#499)

This commit is contained in:
dw-0
2024-08-17 18:50:43 +02:00
committed by GitHub
parent 9b2960594e
commit 660481af5a
15 changed files with 533 additions and 129 deletions

View File

@@ -28,6 +28,21 @@ function check_euid() {
fi
}
function check_if_ratos() {
if [[ -n $(which ratos) ]]; then
echo -e "${red}"
top_border
echo -e "| !!! RatOS 2.1 or greater detected !!! |"
echo -e "| |"
echo -e "| KIAUH does currently not support RatOS. |"
echo -e "| If you have any questions, please ask for help on the |"
echo -e "| RatRig Community Discord: https://discord.gg/ratrig |"
bottom_border
echo -e "${white}"
exit 1
fi
}
#================================================#
#============= MESSAGE FORMATTING ===============#
#================================================#
@@ -178,6 +193,10 @@ function init_ini() {
echo -e "\nmulti_instance_names=\c" >> "${INI_FILE}"
fi
if ! grep -Eq "^version_to_launch=" "${INI_FILE}"; then
echo -e "\nversion_to_launch=\n\c" >> "${INI_FILE}"
fi
### strip all empty lines out of the file
sed -i "/^[[:blank:]]*$/ d" "${INI_FILE}"
}
@@ -362,9 +381,9 @@ function create_required_folders() {
function update_system_package_lists() {
local cache_mtime update_age update_interval silent
if [[ $1 == '--silent' ]]; then silent="true"; fi
if [[ -e /var/lib/apt/periodic/update-success-stamp ]]; then
cache_mtime="$(stat -c %Y /var/lib/apt/periodic/update-success-stamp)"
elif [[ -e /var/lib/apt/lists ]]; then
@@ -396,10 +415,10 @@ function update_system_package_lists() {
function check_system_updates() {
local updates_avail status
if ! update_system_package_lists --silent; then
status="${red}Update check failed! ${white}"
status="${red}Update check failed! ${white}"
else
updates_avail="$(apt list --upgradeable 2>/dev/null | sed "1d")"
if [[ -n ${updates_avail} ]]; then
status="${yellow}System upgrade available!${white}"
# add system to application_updates_available in kiauh.ini
@@ -408,7 +427,7 @@ function check_system_updates() {
status="${green}System up to date! ${white}"
fi
fi
echo "${status}"
}