Improve distro determine

This commit is contained in:
clsty
2025-11-11 09:16:47 +08:00
parent 6fedb70f69
commit e00e703af2
2 changed files with 61 additions and 42 deletions
+18 -10
View File
@@ -31,15 +31,7 @@ function print_os_group_id_unofficial(){
printf "============\n\n"
printf "${STY_RST}"
}
function print_os_group_id_fallback(){
printf "${STY_RED}"
printf "===CAUTION===\n"
printf "No support provided for your distro, using fallback method.\n"
printf "Proceed only at your own risk.\n"
printf "=============\n\n"
printf "${STY_RST}"
}
function print_os_group_id_force_vianix(){
function print_os_group_id_unsupported(){
printf "${STY_RED}"
printf "===CAUTION===\n"
printf "\"--via-nix\" is forcely specified as the only method to support your distro.\n"
@@ -48,6 +40,14 @@ function print_os_group_id_force_vianix(){
printf "Proceed only at your own risk.\n"
printf "=============\n\n"
printf "${STY_RST}"
sleep 3
}
function print_os_group_id_fallback(){
printf "${STY_RED}"
printf "===CAUTION===\n"
printf "Distro not recognized, determined as fallback.\n"
printf "=============\n\n"
printf "${STY_RST}"
}
function print_os_group_id_architecture(){
printf "${STY_RED}"
@@ -99,10 +99,18 @@ elif [[ "$OS_DISTRO_ID" == "fedora" ]]; then
elif [[ "$OS_DISTRO_ID_LIKE" == "fedora" ]]; then
OS_GROUP_ID="fedora"
print_os_group_id_functions=(print_os_group_id{,_alike,_unofficial})
elif [[ "$OS_DISTRO_ID" =~ ^(opensuse-leap|opensuse-tumbleweed)$ ]] || [[ "$OS_DISTRO_ID_LIKE" =~ ^(opensuse|suse)(\ (opensuse|suse))?$ ]]; then
OS_GROUP_ID="suse"
INSTALL_VIA_NIX=true
print_os_group_id_functions=(print_os_group_id{,_unsupported})
elif [[ "$OS_DISTRO_ID" == "debian" || "$OS_DISTRO_ID_LIKE" == "debian" ]]; then
OS_GROUP_ID="debian"
INSTALL_VIA_NIX=true
print_os_group_id_functions=(print_os_group_id{,_unsupported})
else
OS_GROUP_ID="fallback"
INSTALL_VIA_NIX=true
print_os_group_id_functions=(print_os_group_id{,_fallback,_force_vianix})
print_os_group_id_functions=(print_os_group_id{,_fallback,_unsupported})
fi
####################