Simplify cpu scheduler selector

This commit is contained in:
Tk-Glitch 2021-02-23 20:29:22 +01:00
parent ae9d056f35
commit b8657b4549

View File

@ -133,52 +133,48 @@ _tkg_initscript() {
fi fi
# CPU SCHED selector # CPU SCHED selector
if [ "$_basever" = "54" ] || [ "$_basever" = "57" ]; then
_CPUSCHEDARRAY=("PDS" "MuQSS" "BMQ" "CFS")
elif [ "$_basever" = "58" ]; then
_CPUSCHEDARRAY=("Undead PDS (TkG)" "Project C / PDS" "Project C / BMQ" "CFS")
elif [ "$_basever" = "59" ] || [ "$_basever" = "510" ]; then
_CPUSCHEDARRAY=("Undead PDS (TkG)" "Project C / PDS" "Project C / BMQ" "MuQSS" "CFS")
elif [ "$_basever" = "511" ]; then
_CPUSCHEDARRAY=("Project C / PDS" "Project C / BMQ" "MuQSS" "CFS")
else
_CPUSCHEDARRAY=("CFS")
fi
if [ -z "$_cpusched" ] && [ ! -e "${_path}"/cpuschedset ]; then if [ -z "$_cpusched" ] && [ ! -e "${_path}"/cpuschedset ]; then
plain "What CPU sched variant do you want to build/install?" plain "\nWhich CPU sched variant do you want to build/install?"
if [ "$_basever" = "54" ] || [ "$_basever" = "57" ]; then select CPUSCHED in "${_CPUSCHEDARRAY[@]}"
prompt="`echo $' > 1.PDS\n 2.MuQSS\n 3.BMQ\n 4.CFS\nchoice[1-4?]: '`" do
elif [ "$_basever" = "58" ]; then case $CPUSCHED in
prompt="`echo $' > 1.Undead PDS (TkG)\n 2.Project C / PDS\n 3.Project C / BMQ\n 4.CFS\nchoice[1-4?]: '`" "CFS")
elif [ "$_basever" = "59" ] || [ "$_basever" = "510" ]; then echo "_cpusched=\"cfs\"" > "${_path}"/cpuschedset
prompt="`echo $' > 1.Undead PDS (TkG)\n 2.Project C / PDS\n 3.Project C / BMQ\n 4.MuQSS\n 5.CFS\nchoice[1-5?]: '`" ;;
elif [ "$_basever" = "511" ]; then "PDS")
prompt="`echo $' > 1.Project C / PDS\n 2.Project C / BMQ\n 3.MuQSS\n 4.CFS\nchoice[1-4?]: '`" echo "_cpusched=\"pds\"" > "${_path}"/cpuschedset
else ;;
prompt="`echo $' > 1.CFS\nchoice[1-1?]: '`" "MuQSS")
fi echo "_cpusched=\"MuQSS\"" > "${_path}"/cpuschedset
read -rp "$prompt" CONDITION; ;;
if [ "$CONDITION" = "2" ];then "BMQ")
if [ "$_basever" = "54" ] || [ "$_basever" = "57" ]; then echo "_cpusched=\"bmq\"" > "${_path}"/cpuschedset
echo "_cpusched=\"MuQSS\"" > "${_path}"/cpuschedset ;;
elif [ "$_basever" = "58" ] || [ "$_basever" = "59" ] || [ "$_basever" = "510" ]; then "Project C / PDS")
echo "_cpusched=\"pds\"" > "${_path}"/cpuschedset echo "_cpusched=\"pds\"" > "${_path}"/cpuschedset
else ;;
echo "_cpusched=\"bmq\"" > "${_path}"/cpuschedset "Project C / BMQ")
fi echo "_cpusched=\"bmq\"" > "${_path}"/cpuschedset
elif [ "$CONDITION" = "3" ]; then ;;
if [ "$_basever" = "54" ] || [ "$_basever" = "57" ] || [ "$_basever" = "58" ] || [ "$_basever" = "59" ] || [ "$_basever" = "510" ]; then "Undead PDS (TkG)")
echo "_cpusched=\"bmq\"" > "${_path}"/cpuschedset echo "_cpusched=\"upds\"" > "${_path}"/cpuschedset
else ;;
echo "_cpusched=\"MuQSS\"" > "${_path}"/cpuschedset *)
fi esac
elif [ "$CONDITION" = "4" ]; then break
if [ "$_basever" = "54" ] || [ "$_basever" = "57" ] || [ "$_basever" = "58" ] || [ "$_basever" = "511" ]; then done
echo "_cpusched=\"cfs\"" > "${_path}"/cpuschedset
else
echo "_cpusched=\"MuQSS\"" > "${_path}"/cpuschedset
fi
elif [ "$CONDITION" = "5" ]; then
echo "_cpusched=\"cfs\"" > "${_path}"/cpuschedset
else
if [ "$_basever" = "58" ] || [ "$_basever" = "59" ] || [ "$_basever" = "510" ]; then
echo "_cpusched=\"upds\"" > "${_path}"/cpuschedset
else
echo "_cpusched=\"pds\"" > "${_path}"/cpuschedset
fi
fi
if [ -n "$_custom_pkgbase" ]; then
echo "_custom_pkgbase=\"${_custom_pkgbase}\"" >> "${_path}"/cpuschedset
fi
elif [ "$_cpusched" = "upds" ]; then elif [ "$_cpusched" = "upds" ]; then
echo "_cpusched=\"upds\"" > "${_path}"/cpuschedset echo "_cpusched=\"upds\"" > "${_path}"/cpuschedset
elif [ "$_cpusched" = "pds" ]; then elif [ "$_cpusched" = "pds" ]; then
@ -190,8 +186,9 @@ _tkg_initscript() {
elif [ "$_cpusched" = "muqss" ] || [ "$_cpusched" = "MuQSS" ]; then elif [ "$_cpusched" = "muqss" ] || [ "$_cpusched" = "MuQSS" ]; then
echo "_cpusched=\"MuQSS\"" > "${_path}"/cpuschedset echo "_cpusched=\"MuQSS\"" > "${_path}"/cpuschedset
else else
if [ "$_nofallback" != "true" ]; then if [ "$_nofallback" != "true" ] && ! [[ ${_CPUSCHEDARRAY[*]} =~ "$_cpusched" ]]; then
warning "Something is wrong with your cpusched selection. Do you want to fallback to CFS (default)?" warning "Your cpusched selection ( $_cpusched ) is not available for the selected kernel version."
msg2 "Do you want to fallback to CFS (default)?"
read -rp "`echo $' > N/y : '`" _fallback; read -rp "`echo $' > N/y : '`" _fallback;
fi fi
if [[ "$_fallback" =~ [yY] ]] || [ "$_nofallback" = "true" ]; then if [[ "$_fallback" =~ [yY] ]] || [ "$_nofallback" = "true" ]; then
@ -201,15 +198,11 @@ _tkg_initscript() {
exit 1 exit 1
fi fi
fi fi
if [ -n "$_custom_pkgbase" ]; then if [ -n "$_custom_pkgbase" ]; then
echo "_custom_pkgbase=\"${_custom_pkgbase}\"" >> "${_path}"/cpuschedset echo "_custom_pkgbase=\"${_custom_pkgbase}\"" >> "${_path}"/cpuschedset
fi fi
#if [ "$_basever" = "511" ] && [ "$_cpusched" != "cfs" ]; then
# warning "No support for alternative CPU schedulers on this kernel version. Defaulting to CFS."
# echo "_cpusched=\"cfs\"" > "${_path}"/cpuschedset
#fi
case $_compileroptlevel in case $_compileroptlevel in
"2") "2")
_compileropt="-O3" _compileropt="-O3"