From 1790392d8f33b2dbcc1831cbad4868a81d5b520e Mon Sep 17 00:00:00 2001 From: WXbet Date: Fri, 3 Apr 2020 19:27:49 +0200 Subject: [PATCH] Revert "Merge Next Branch (#29)" This reverts commit d8d72f3f6d5e5bf5aa3f65f478af32bc29f4bbe0. --- .../{ds216play_armv7 => ds126play_armv7} | 0 support/functions/_plugin_update_toolchain | 81 ++++++------------- 2 files changed, 23 insertions(+), 58 deletions(-) rename support/crosstool/templates/{ds216play_armv7 => ds126play_armv7} (100%) diff --git a/support/crosstool/templates/ds216play_armv7 b/support/crosstool/templates/ds126play_armv7 similarity index 100% rename from support/crosstool/templates/ds216play_armv7 rename to support/crosstool/templates/ds126play_armv7 diff --git a/support/functions/_plugin_update_toolchain b/support/functions/_plugin_update_toolchain index 59ce9bb..8847078 100644 --- a/support/functions/_plugin_update_toolchain +++ b/support/functions/_plugin_update_toolchain @@ -3,7 +3,7 @@ #simplebuild_plugin tcupdate tcupdate(){ - pversion="0.12.0"; + pversion="0.11.5"; pname="s3.TUP"; pdesc="Plugin $pname v$pversion"; configname="$configdir/plugin_update_toolchain.config"; @@ -17,7 +17,6 @@ tcupdate(){ [ -z "$4" ] && FLAG="0" || FLAG="$4"; #1 - tcupdate call from s3 main menu, 2 - tcupdate call from s3 toolchain menu; tc="$CMDTC"; - #check/install prerequisites clear && _check_pkg; #backup config @@ -46,28 +45,12 @@ tcupdate(){ _paktc_timer 5; fi; - #change config value's - if [ "$CMDTC" == "-cfg" ] || [ "$CMDTC" == "--config" ];then - _change_config "$OPTION1" "$OPTION2"; - CMDTC="" && OPTION1="$2" && OPTION2="$3"; - fi; - #load config source "$configname"; #check config _check_config; - #ct-ng must not be run as root unless you forcing it by config - if [ ! _check_root ] || [ "$CTNG_BUILD_AS_ROOT" == "1" ];then - CTNG_START_BUILD=1; - else - CTNG_START_BUILD=0; - sp=$(printf '%*s' 9); - CTNG_ROOT_BUILD_ERROR="\nERROR -> The execution of crosstool-NG was aborted because it must not run as root!\n\n""$sp""If you are aware of the danger of running crosstool-NG as root and you\n""$sp""know what you are doing, you can force it with the following command:\n\n"; - CTNG_ROOT_BUILD_CMD="$sp""./s3 tcupdate --config \"CTNG_BUILD_AS_ROOT\" \"1\"\n"; - fi; - if [ "$CMDTC" == "-c" ] || [ "$CMDTC" == "--create" ];then #start toolchain builder menu _create_tc "$OPTION1" "" "$FLAG"; [ "$FLAG" == "1" ] && return || bye; @@ -88,7 +71,7 @@ tcupdate(){ else _nl && exit; fi; - elif [ "$CMDTC" == "-ctng" ] || [ "$CMDTC" == "--crosstool-ng" ];then #croostool-NG menu + elif [ "$CMDTC" == "-ctng" ];then #croostool-NG menu _ctng_menu "$OPTION1"; bye; elif [ -z "$CMDTC" ];then @@ -265,6 +248,9 @@ tcupdate(){ _create_tc(){ _sz; # Prepare DIALOG settings + #ct-ng must not be run as root unless you forcing it by config + ! _check_root && START_BUILD=1 || [ "$CTNG_BUILD_AS_ROOT" == "1" ] && START_BUILD=1 || START_BUILD=0; + local menu_close; while [ ! $menu_close ] do @@ -310,7 +296,7 @@ _create_tc(){ if [ ! -f "$ctsrcdir/ct-ng" ]; then echo -e "$r_l""\nCHECK -> crosstool-NG is not setup correctly. Try to fix it automatically...\n""$re_"; _paktc_timer 5; - _ctng_setup "$CTNG_START_BUILD"; + _ctng_setup "$START_BUILD"; fi; #Build cross toolchains @@ -343,7 +329,7 @@ _create_tc(){ echo -e "cd \"$ctsrcdir\";\n$(_replace_tokens "$bcl")\n$sp""$re_" | tee -a "$logfile"; sleep 2; - if [ $CTNG_START_BUILD -eq 1 ]; then + if [ $START_BUILD -eq 1 ]; then cd "$ctsrcdir"; #print out crosstool-NG version echo -e "$g_l\n$(./ct-ng | grep 'crosstool-NG version' &2>/dev/null | tail -1)\n""$re_" | tee -a "$logfile"; @@ -377,7 +363,7 @@ _create_tc(){ _paktc_timer 10; fi; else - echo -e "$r_l""$CTNG_ROOT_BUILD_ERROR""$y_l""$CTNG_ROOT_BUILD_CMD""$re_" | tee -a "$logfile"; + echo -e "$r_l""\nERROR -> The execution of crosstool-NG was aborted\n because it must not run as root!\n""$re_" | tee -a "$logfile"; _paktc_timer 10; fi; else @@ -386,7 +372,7 @@ _create_tc(){ fi; done;; 1) #Setup - Setup crosstool-NG - _ctng_setup "$CTNG_START_BUILD"; + _ctng_setup "$START_BUILD"; _paktc_timer 10;; 2) #Edit tpl=$(echo "$opts" | awk '{printf $2}';); @@ -487,7 +473,7 @@ _ctng_setup(){ done ( eval "${setuptasks[@]}" ) 2>&1; else - echo -e "$CTNG_ROOT_BUILD_ERROR$CTNG_ROOT_BUILD_CMD" + echo -e "\nERROR -> The execution of crosstool-NG was aborted\n because it must not run as root!\n"; fi; ) | tee "$logfile" | "$gui" "$st_" "$bt_" "$title_ - \Z0$pdesc\Zn" "--colors" "--title" " -[ Setup crosstool-NG ]- " "$pb_" "$_lines" "$_cols"; }; @@ -658,6 +644,19 @@ _check_pkg(){ echo -e "$r_l""\nCHECK -> You need to manually install the following packages to use this plugin properly:\n"$y_l"$prefix apt install$packages\n""$re_" && _paktc_timer 10; fi; }; +_check_config(){ + nok=0; + [ -z ${CTNG_CONFIG_tasks+x} ] && nok=1; + [ -z ${CTNG_BUILD_AS_ROOT+x} ] && nok=1; + [ -z ${LIBS+x} ] && nok=1; + + if [ $nok -eq 1 ]; then + clear; + echo -e "$r_l""\nCHECK -> Your config file seems to be outdated. Please restart s3 as follows to recreate an updated config file:\n"$y_l"./s3 tcupdate -r\n""$re_"; + _paktc_timer 10; + return $nok; + fi; +}; _check_github_api_limits(){ limit=$(curl --silent "https://api.github.com/rate_limit" | jq -r '.resources.core.limit'); @@ -677,40 +676,6 @@ _check_github_api_limits(){ return 1; fi; }; -_check_config(){ - nok=0; - [ -z ${CTNG_CONFIG_tasks+x} ] && nok=1; - [ -z ${CTNG_BUILD_AS_ROOT+x} ] && nok=1; - [ -z ${LIBS+x} ] && nok=1; - - if [ $nok -eq 1 ]; then - clear; - echo -e "$r_l""\nCHECK -> Your config file seems to be outdated. Please restart s3 as follows to recreate an updated config file:\n"$y_l"./s3 tcupdate -r\n""$re_"; - _paktc_timer 10; - return $nok; - fi; -}; -_change_config(){ - nok=1; - ts="$(date +%F) $(date +%T)"; - [[ ! $2 =~ "(" ]] && [[ ! $string =~ ")" ]] && qte="\"" || qte=""; #no quotes if value contains parentheses - - if ! grep -Eq "^$1=.*" "$configname";then - echo -e "$r_l""\nCHECK -> Variable "$y_l"$1"$r_l" does not exist in the configuration file!\n""$re_"; - _paktc_timer 10; - elif [ "${1:(-6)}" == "_tasks" ];then - echo -e "$r_l""\nCHECK -> Modifying "$y_l"tasks-variables"$r_l" not implemented yet!\n""$re_"; - _paktc_timer 10; - else - sed -i "s#^$1=.*#$1=$qte$2$qte; \#changed on $ts via tcupdate commandline#g" "$configname"; - result=$(grep -E "^$1=.*" "$configname" | awk '{printf $1}'); - echo -e "$g_l""\nDONE -> Variable changed to: "$y_l"$result\n""$re_"; - _paktc_timer 5; - nok=0; - fi; - - return $nok; -}; _create_config(){ #check existing jq if [ ! $(which jq) ];then