From 5cabd0d572f729862192b03f82486b0c67caeb3a Mon Sep 17 00:00:00 2001 From: gorgone Date: Tue, 17 Mar 2020 03:45:05 +0100 Subject: [PATCH 1/2] first branch change --- s3 | 2 +- support/functions/_logos | 2 +- support/toolchains.cfg/native | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/s3 b/s3 index 5447eea..f2b1957 100755 --- a/s3 +++ b/s3 @@ -1,7 +1,7 @@ #!/bin/bash VERSIONCOUNTER=310 -SIMPLEVERSION="Final" +SIMPLEVERSION="-NEXT-" OIFS=$IFS export NCURSES_NO_UTF8_ACS=1 diff --git a/support/functions/_logos b/support/functions/_logos index 3bfb2a9..66a65ae 100644 --- a/support/functions/_logos +++ b/support/functions/_logos @@ -17,7 +17,7 @@ s3logo(){ echo -e $C" _________________ / _____/\\_____ \\ =============== - \_____ \\ _(__ < $w_l Ver. $VERSIONCOUNTER$g_l $SIMPLEVERSION!$C + \_____ \\ _(__ < $w_l Ver. $VERSIONCOUNTER$g_l $SIMPLEVERSION$C / \\ / \\ =============== /_______ //______ / $y_l by gorgone$p_l 2020$C \\/ \/ ===============\n$W"; diff --git a/support/toolchains.cfg/native b/support/toolchains.cfg/native index 8c6d154..8c0fa28 100644 --- a/support/toolchains.cfg/native +++ b/support/toolchains.cfg/native @@ -2,8 +2,11 @@ _toolchainname="native"; default_use="USE_UTF8 USE_LIBCRYPTO"; _oscamconfdir_default="/usr/local/etc"; _oscamconfdir_custom="not_set"; -_compiler="-"; -_tc_info="Native System Compiler "; +_compiler="x86_64-linux-gnu-"; +_tc_info="Native System Compiler gcc (Debian 8.3.0-6) 8.3.0 +Copyright (C) 2018 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; _libsearchdir="/lib"; _menuname="native"; -_sysroot="/"; +_sysroot="/usr/include"; From c8b640a4ea9bb57519ceb57fb123f43666971eff Mon Sep 17 00:00:00 2001 From: WXbet <57314510+WXbet@users.noreply.github.com> Date: Thu, 19 Mar 2020 11:36:13 +0100 Subject: [PATCH 2/2] s3.TUP install crosstool-ng automatically (v0.11.2) create separate ctng-setup function add ctng-setup call in create toolchain process, if not installed (correctly) --- support/functions/_plugin_update_toolchain | 177 +++++++++++---------- 1 file changed, 91 insertions(+), 86 deletions(-) diff --git a/support/functions/_plugin_update_toolchain b/support/functions/_plugin_update_toolchain index 0f2735e..63ae398 100644 --- a/support/functions/_plugin_update_toolchain +++ b/support/functions/_plugin_update_toolchain @@ -3,7 +3,7 @@ #simplebuild_plugin tcupdate tcupdate(){ - pversion="0.11.1"; + pversion="0.11.2"; pname="s3.TUP"; pdesc="Plugin $pname v$pversion"; configname="$configdir/plugin_update_toolchain.config"; @@ -288,101 +288,81 @@ _create_tc(){ case $ret in 0) #Start - Build cross toolchain - if [ -f "$ctsrcdir/ct-ng" ]; then - icount=$(echo $opts | wc -w);i=0; + #Setup crosstool-NG automatically if not installed + 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 "$START_BUILD"; + fi; - for tpl in $opts;do - if [ -f "$cttpldir/$tpl" ]; then - - logfile="$ldir/$(date +%F)_$(date +%T)_update_toolchain_crosstoolchain_"$tpl".log"; ((i++)); - - clear; - sp=$(printf '%*s' 80 | tr ' ' '=') - echo -e "$sp\nbuild ($i/$icount): command list for cross toolchain $tpl:\n$sp" | tee -a "$logfile"; + #Build cross toolchains + icount=$(echo $opts | wc -w);i=0; + for tpl in $opts;do + if [ -f "$cttpldir/$tpl" ]; then + + logfile="$ldir/$(date +%F)_$(date +%T)_update_toolchain_crosstoolchain_"$tpl".log"; ((i++)); + + clear; + sp=$(printf '%*s' 80 | tr ' ' '=') + echo -e "$sp\nbuild ($i/$icount): command list for cross toolchain $tpl:\n$sp" | tee -a "$logfile"; + + #copy template and patching them + echo "rm \"$ctsrcdir/.config\"* 2>/dev/null;cp --no-preserve=mode,ownership -f \"$cttpldir/$tpl\" \"$ctsrcdir/.config\";" | tee -a "$logfile"; + rm "$ctsrcdir/.config"* 2>/dev/null;cp --no-preserve=mode,ownership -f "$cttpldir/$tpl" "$ctsrcdir/.config"; + + #CT_LOCAL_TARBALLS_DIR aka cache folder for downloads + echo "sed -i \"s#.*CT_LOCAL_TARBALLS_DIR=.*#CT_LOCAL_TARBALLS_DIR=\"$dldir\"#g\" \"$ctsrcdir/.config\";" | tee -a "$logfile"; + sed -i "s#.*CT_LOCAL_TARBALLS_DIR=.*#CT_LOCAL_TARBALLS_DIR=\"$dldir\"#g" "$ctsrcdir/.config"; + #CT_PREFIX_DIR aka folder that contains the final toolchain + echo "sed -i \"s#.*CT_PREFIX_DIR=.*#CT_PREFIX_DIR=\"$tcdir/$tpl\"#g\" \"$ctsrcdir/.config\";" | tee -a "$logfile"; + sed -i "s#.*CT_PREFIX_DIR=.*#CT_PREFIX_DIR=\"$tcdir/$tpl\"#g" "$ctsrcdir/.config"; + #CT_ALLOW_BUILD_AS_ROOT aka force build as root + _check_root && [ "$CTNG_BUILD_AS_ROOT" == "1" ] && echo "echo -e \"\nCT_EXPERIMENTAL=y\nCT_ALLOW_BUILD_AS_ROOT=y\nCT_ALLOW_BUILD_AS_ROOT_SURE=y\" >>\"$ctsrcdir/.config\";" | tee -a "$logfile"; + _check_root && [ "$CTNG_BUILD_AS_ROOT" == "1" ] && echo -e "\nCT_EXPERIMENTAL=y\nCT_ALLOW_BUILD_AS_ROOT=y\nCT_ALLOW_BUILD_AS_ROOT_SURE=y" >>"$ctsrcdir/.config"; + + #run build + bcl=$(printf '%s\n' "${CTNG_BUILD_tasks[@]}"); + echo -e "cd \"$ctsrcdir\";\n$(_replace_tokens "$bcl")\n$sp" | tee -a "$logfile"; + sleep 2; + + if [ $START_BUILD -eq 1 ]; then + cd "$ctsrcdir"; + #generate build command list + unset buildtasks; + for task in "${CTNG_BUILD_tasks[@]}";do + task=$(_replace_tokens "$task"); #replace tokens + buildtasks+=("$task"); + done; + ( eval "${buildtasks[@]}" ) 2>&1; + err=$(grep '\[ERROR\]' "$ctsrcdir/build.log" | wc -l) + + #save build.log in logs + cat "$ctsrcdir/build.log" >>"$logfile"; - #copy template and patching them - echo "rm \"$ctsrcdir/.config\"* 2>/dev/null;cp --no-preserve=mode,ownership -f \"$cttpldir/$tpl\" \"$ctsrcdir/.config\";" | tee -a "$logfile"; - rm "$ctsrcdir/.config"* 2>/dev/null;cp --no-preserve=mode,ownership -f "$cttpldir/$tpl" "$ctsrcdir/.config"; - - #CT_LOCAL_TARBALLS_DIR aka cache folder for downloads - echo "sed -i \"s#.*CT_LOCAL_TARBALLS_DIR=.*#CT_LOCAL_TARBALLS_DIR=\"$dldir\"#g\" \"$ctsrcdir/.config\";" | tee -a "$logfile"; - sed -i "s#.*CT_LOCAL_TARBALLS_DIR=.*#CT_LOCAL_TARBALLS_DIR=\"$dldir\"#g" "$ctsrcdir/.config"; - #CT_PREFIX_DIR aka folder that contains the final toolchain - echo "sed -i \"s#.*CT_PREFIX_DIR=.*#CT_PREFIX_DIR=\"$tcdir/$tpl\"#g\" \"$ctsrcdir/.config\";" | tee -a "$logfile"; - sed -i "s#.*CT_PREFIX_DIR=.*#CT_PREFIX_DIR=\"$tcdir/$tpl\"#g" "$ctsrcdir/.config"; - #CT_ALLOW_BUILD_AS_ROOT aka force build as root - _check_root && [ "$CTNG_BUILD_AS_ROOT" == "1" ] && echo "echo -e \"\nCT_EXPERIMENTAL=y\nCT_ALLOW_BUILD_AS_ROOT=y\nCT_ALLOW_BUILD_AS_ROOT_SURE=y\" >>\"$ctsrcdir/.config\";" | tee -a "$logfile"; - _check_root && [ "$CTNG_BUILD_AS_ROOT" == "1" ] && echo -e "\nCT_EXPERIMENTAL=y\nCT_ALLOW_BUILD_AS_ROOT=y\nCT_ALLOW_BUILD_AS_ROOT_SURE=y" >>"$ctsrcdir/.config"; - - #run build - bcl=$(printf '%s\n' "${CTNG_BUILD_tasks[@]}"); - echo -e "cd \"$ctsrcdir\";\n$(_replace_tokens "$bcl")\n$sp" | tee -a "$logfile"; - sleep 2; + if [ ! $err -gt 0 ]; then + #get target from build.log + target=$(sed -n -e '/target = / s/.*\= *//p' "$ctsrcdir/build.log"); - if [ $START_BUILD -eq 1 ]; then - cd "$ctsrcdir"; - #generate build command list - unset buildtasks; - for task in "${CTNG_BUILD_tasks[@]}";do - task=$(_replace_tokens "$task"); #replace tokens - buildtasks+=("$task"); - done; - ( eval "${buildtasks[@]}" ) 2>&1; - err=$(grep '\[ERROR\]' "$ctsrcdir/build.log" | wc -l) - - #save build.log in logs - cat "$ctsrcdir/build.log" >>"$logfile"; - - if [ ! $err -gt 0 ]; then - #get target from build.log - target=$(sed -n -e '/target = / s/.*\= *//p' "$ctsrcdir/build.log"); + #compress toolchain + _compress "$dldir/Toolchain-$tpl.tar.xz" "$tcdir/$tpl" | "$gui" "$st_" "$bt_" "$title_ - \Z0$pdesc\Zn" "--colors" "--title" " -[ Compress cross toolchain $tpl to Toolchain-$tpl.tar.xz ]- " "$pb_" "$_lines" "$_cols"; - #compress toolchain - _compress "$dldir/Toolchain-$tpl.tar.xz" "$tcdir/$tpl" | "$gui" "$st_" "$bt_" "$title_ - \Z0$pdesc\Zn" "--colors" "--title" " -[ Compress cross toolchain $tpl to Toolchain-$tpl.tar.xz ]- " "$pb_" "$_lines" "$_cols"; - - #create toolchain.cfg - desc=$(sed -n -e '/#toolchain template/ s/.*\: *//p' "$cttpldir/$tpl"); - _create_toolchaincfg "$tcdir/$tpl" "$tpl" "$target" "" "" "$desc" "" "$dldir/Toolchain-$tpl.tar.xz" "yes"; - else - _paktc_timer 10; - fi; + #create toolchain.cfg + desc=$(sed -n -e '/#toolchain template/ s/.*\: *//p' "$cttpldir/$tpl"); + _create_toolchaincfg "$tcdir/$tpl" "$tpl" "$target" "" "" "$desc" "" "$dldir/Toolchain-$tpl.tar.xz" "yes"; else - 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 - echo -e "$r_l $txt_error:$y_l $tpl$w_l Template $txt_n_installed""$rs_"; - sleep 2; + 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; - done; - else - echo -e "$r_l""\nCHECK -> crosstool-NG is not setup correctly. Please run 'Setup' from menu!\n""$re_"; - _paktc_timer 10; - fi;; + else + echo -e "$r_l $txt_error:$y_l $tpl$w_l Template $txt_n_installed""$rs_"; + sleep 2; + fi; + done;; 1) #Setup - Setup crosstool-NG - logfile="$ldir/$(date +%F)_$(date +%T)_update_toolchain_crosstool-NG_setup.log" - ( - bcl=$(printf '%s\n' "${CTNG_SETUP_tasks[@]}"); - sp=$(printf '%*s' 80 | tr ' ' '=') - echo -e "$sp\nbuild command list for crosstool-NG:\n$sp\ncd "$ctsrcdir"\n$(_replace_tokens "$bcl")\n$sp"; - sleep 2; - - if [ $START_BUILD -eq 1 ]; then - # setup crosstool wc - echo "Cleanup source directory "$ctsrcdir/"..." - rm -rf "$ctsrcdir" 2>/dev/null; - mkdir --parents "$ctsrcdir"; - cd "$ctsrcdir"; - #generate setup command list - for task in "${CTNG_SETUP_tasks[@]}";do - task=$(_replace_tokens "$task"); #replace tokens - setuptasks+=("$task"); - done - ( eval "${setuptasks[@]}" ) 2>&1; - else - 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"; + _ctng_setup "$START_BUILD"; _paktc_timer 10;; 2) #Edit tpl=$(echo "$opts" | awk '{printf $2}';); @@ -462,6 +442,31 @@ _ctng_menu(){ done; ( eval "${configtasks[@]}" ) 2>&1; }; +_ctng_setup(){ + logfile="$ldir/$(date +%F)_$(date +%T)_update_toolchain_crosstool-NG_setup.log" + ( + bcl=$(printf '%s\n' "${CTNG_SETUP_tasks[@]}"); + sp=$(printf '%*s' 80 | tr ' ' '=') + echo -e "$sp\nbuild command list for crosstool-NG:\n$sp\ncd "$ctsrcdir"\n$(_replace_tokens "$bcl")\n$sp"; + sleep 2; + + if [ $1 -eq 1 ]; then + # setup crosstool wc + echo "Cleanup source directory "$ctsrcdir/"..." + rm -rf "$ctsrcdir" 2>/dev/null; + mkdir --parents "$ctsrcdir"; + cd "$ctsrcdir"; + #generate setup command list + for task in "${CTNG_SETUP_tasks[@]}";do + task=$(_replace_tokens "$task"); #replace tokens + setuptasks+=("$task"); + done + ( eval "${setuptasks[@]}" ) 2>&1; + else + 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"; +}; _dl(){ [ -d "$dldir/#tmp" ] && rm --recursive --force "$dldir/#tmp" mkdir --parents "$dldir/#tmp";