diff --git a/s3 b/s3 index 37d2d84..dbcf7ed 100644 --- a/s3 +++ b/s3 @@ -68,6 +68,7 @@ declare -a SHORT_READERS; declare -a SHORT_CARD_READERS; declare -A INTERNAL_ config_cases=( all addons protocols readers card_readers ); s3opts=( help cedit clean tccheck tcrepair upload lang_select loadonly checkout ssh_profiles syscheck sysinfo svnup menu get_patch tedit svnpatch profiles svnrestore ); # extendable with plugins CUSTOM_CONFDIR="not_set"; +UPX="not_set"; #internal vars OPENBOX=0;UFS916003=0;_verbose=""; @@ -229,11 +230,26 @@ else pf_name="${2#*=}"; fi; fi; + if [ "${3:0:3}" == "-p=" ] || [ "${3:0:3}" == "-P=" ];then + if [ -f "$profdir/${2#*=}" ];then + pf=$(cat "$profdir/${2#*=}"); + pf_name="${2#*=}"; + fi; + fi; + if [ "${2:0:5}" == "-upx=" ] || [ "${2:0:5}" == "-UPX=" ];then + UPX=${2#*=};USE_vars[USE_COMPRESS]="USE_COMPRESS=1"; + fi; + if [ "${2:0:5}" == "-upx=" ] || [ "${2:0:5}" == "-UPX=" ];then + UPX=${2#*=};USE_vars[USE_COMPRESS]="USE_COMPRESS=1"; + fi; [ "$pf" == "empty" ] && c_m_d="$*" || c_m_d="all_off $pf $*"; # set only active module with profiles for cmd in $c_m_d;do if [ "${cmd:0:3}" == "-c=" ] || [ "${cmd:0:3}" == "-C=" ];then CUSTOM_CONFDIR="${cmd#*=}"; fi; + if [ "${cmd:0:5}" == "-upx=" ] || [ "${cmd:0:5}" == "-UPX=" ];then + UPX="${cmd#*=}";USE_vars[USE_COMPRESS]="USE_COMPRESS=1"; + fi; for cc in "${config_cases[@]}"; do [ "$cmd" == "$cc$on" ] && all_cc+=($cc$on) && break; @@ -260,7 +276,5 @@ else fi; done; _help; - fi; - exit; diff --git a/support/functions/_ansi b/support/functions/_ansi index 6a202e4..e7e86c9 100644 --- a/support/functions/_ansi +++ b/support/functions/_ansi @@ -6,34 +6,34 @@ #echo -e $r_n"red text"$re_"normal text" initializeANSI(){ -nc='\033[0;'; #nc normal color -lc='\033[1;'; #lc light color +nc='\033[0;';#nc normal color +lc='\033[1;';#lc light color # normal -r_n=$nc'31m'; #red -g_n=$nc'32m'; #green -y_n=$nc'33m'; #yellow -b_n=$nc'34m'; #blue -p_n=$nc'35m'; #pink -c_n=$nc'36m'; #cyan -w_n=$nc'37m'; #white +r_n=$nc'31m';#red +g_n=$nc'32m';#green +y_n=$nc'33m';#yellow +b_n=$nc'34m';#blue +p_n=$nc'35m';#pink +c_n=$nc'36m';#cyan +w_n=$nc'37m';#white #light -r_l=$lc'31m'; #red -g_l=$lc'32m'; #green -y_l=$lc'33m'; #yellow -b_l=$lc'34m'; #blue -p_l=$lc'35m'; #pink -c_l=$lc'36m'; #cyan -w_l=$lc'37m'; #white +r_l=$lc'31m';#red +g_l=$lc'32m';#green +y_l=$lc'33m';#yellow +b_l=$lc'34m';#blue +p_l=$lc'35m';#pink +c_l=$lc'36m';#cyan +w_l=$lc'37m';#white #reset to normal -re_='\033[0m'; #resets all colors -re_f='\033[39m'; #resets only foreground color -re_b='\033[49m'; #resets only background color +re_='\033[0m' ;#resets all colors +re_f='\033[39m';#resets only foreground color +re_b='\033[49m';#resets only background color #sed replace -W=$(echo -e '\033[0m'); #normal -Y=$(echo -e '\033[1;33m'); #yellow -R=$(echo -e '\033[1;31m'); #red -G=$(echo -e '\033[1;32m'); #green -P=$(echo -e '\033[1;35m'); #pink -C=$(echo -e '\033[1;36m'); #cyan -WH=$(echo -e '\033[1;37m'); #lightgray +W=$(echo -e '\033[0m') ;#normal +Y=$(echo -e '\033[1;33m') ;#yellow +R=$(echo -e '\033[1;31m') ;#red +G=$(echo -e '\033[1;32m') ;#green +P=$(echo -e '\033[1;35m') ;#pink +C=$(echo -e '\033[1;36m') ;#cyan +WH=$(echo -e '\033[1;37m');#lightgray }; \ No newline at end of file diff --git a/support/functions/_cmd_build b/support/functions/_cmd_build index 2b31fe6..cd907d8 100644 --- a/support/functions/_cmd_build +++ b/support/functions/_cmd_build @@ -29,7 +29,6 @@ _cmd_build(){ [ "$e" == "$d" ] && USE_vars[${e:0: -2}]=; done; done; - _nl; cd "$svndir"; #make clean @@ -39,10 +38,10 @@ _cmd_build(){ for am in "${all_cc[@]}";do chose="false"; if [ "${am:${#am} - 3}" == "_on" ];then - e="${am:0: -3}";"$svndir/config.sh" -E "$e" |awk '{printf "\033[1;37m"} {printf " | %s : ", $1} {printf "\033[1;32m"} {printf "%s\n", $2}'; + e="${am:0: -3}";"$svndir/config.sh" -E "$e" |awk '{printf "\033[1;37m"} {printf " | %s : ", $1} {printf "\033[1;32m"} {printf "%s\n", $2}'; fi; if [ "${am:${#am} - 4}" == "_off" ];then - d="${am:0: -4}";"$svndir/config.sh" -D "$d" |awk '{printf "\033[1;37m"} {printf " | %s : ", $1} {printf "\033[1;31m"} {printf "%s\n", $2}'; + d="${am:0: -4}";"$svndir/config.sh" -D "$d" |awk '{printf "\033[1;37m"} {printf " | %s : ", $1} {printf "\033[1;31m"} {printf "%s\n", $2}'; fi; done; @@ -116,10 +115,10 @@ fi; fi; #echo if build with profile - [ ! "$pf" == "empty" ] && echo -e "$y_l | PROFILE : $pf_name"; + [ ! "$pf" == "empty" ] && echo -e "$y_l | PROFILE : $pf_name"; #echo IF SVN is Patched - [ -f "$workdir/SVN-IS-PATCHED" ] && echo -e $w_l" ISPATCHED : "$P" YES"; + [ -f "$workdir/SVN-IS-PATCHED" ] && echo -e $w_l" | ISPATCHED :$P YES"; #echo max cpu usage if [ -f "$configdir/max_cpus" ];then @@ -198,6 +197,6 @@ fi; #build error message error_on_build=$(grep -c1 error "$ldir/$log_name"); [ "$error_on_build" -gt "0" ] && echo -e "$r_l\terrors on build found$w_l"; - echo -e "$re_"; + echo -e "$re_$w_l"; exit; }; diff --git a/support/functions/_compress b/support/functions/_compress index 6687849..86f007f 100644 --- a/support/functions/_compress +++ b/support/functions/_compress @@ -4,10 +4,11 @@ compress_cam(){ cd "$bdir"; upx_c="-1"; [ -f "$configdir/upx_option" ] && source "$configdir/upx_option"; + [ ! "$UPX" == "not_set" ] && upx_c=$UPX; erg=$(upx "$upx_c" "$1" |grep oscam |awk '{print $1" "$3" "$4 }'); - e1="$(echo "$erg"| awk '{printf("%4.2f k\n", $1 /1024)}')"; + e1="$(echo "$erg"| awk '{printf("%4.2fk\n", $1 /1024)}')"; e2="$(echo "$erg"| awk '{printf("%4.2fk\n", $2 /1024)}')"; - e3="$(echo "$erg"| awk '{print $3}')"; + e3="$(echo "$erg"| awk '{print $3}') (level=$upx_c)"; echo -e "$w_l\n\n BEFORE -----> $txt_compress1\t= $g_n$e1$w_l\n AFTER ------> $txt_compress2\t= $g_l$e2$w_l\n RESULT -----> $txt_compress3\t= $c_n$e3$rs_\n"; }; compress_cam_gui(){ @@ -90,4 +91,4 @@ untarsvn(){ fi; fi; [ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED"; -}; \ No newline at end of file +}; diff --git a/support/functions/_help b/support/functions/_help index b544092..cb564fb 100644 --- a/support/functions/_help +++ b/support/functions/_help @@ -9,12 +9,18 @@ helpline0(){ ll=0; echo -en " "; for s in "$@";do - ll=$((ll + (${#s} + 4))); - if [ "$ll" -lt "30" ];then - echo -en "$s(_off) "; - else - echo -en "$s(_off)\n "; - ll=""; + if [ ! "$s" == "USE_SSL" ] \ + && [ ! "$s" == "USE_MCA" ] \ + && [ ! "$s" == "USE_LIBUSB" ] \ + && [ ! "$s" == "USE_CONFDIR" ]; + then + ll=$((ll + (${#s} + 4))); + if [ "$ll" -lt "30" ];then + echo -en "$s(_off) "; + else + echo -en "$s(_off)\n "; + ll=""; + fi; fi; done; }; @@ -32,10 +38,10 @@ helpline1(){ done; }; _help(){ clear;s3logo; -echo -e " ----------------------------------"; +echo -e " --------------------------------------"; echo -e " $txt_help1 $0 menu"; echo -e " $txt_help2"; -echo -e " ----------------------------------"; +echo -e " --------------------------------------"; echo -e "$w_l\n toolchains :\n ------------$g_n"; helpline1 "${AVAI_TCLIST[@]}"; echo -e "$w_l\n simplebuild options :\n ---------------------$c_n"; @@ -52,4 +58,4 @@ echo -e "$w_l card_readers :\n --------------$b_l"; helpline0 "${SHORT_CARD_READERS[@]}"; echo -e "$w_l\n use_vars :\n --------$w_n"; helpline0 "${!USE_vars[@]}";_wait; -}; \ No newline at end of file +}; diff --git a/support/functions/_logos b/support/functions/_logos index 58c1dfb..47862ad 100644 --- a/support/functions/_logos +++ b/support/functions/_logos @@ -26,4 +26,4 @@ echo -e $C" / \\ / \\ =============== /_______ //______ / $y_l by gorgone$p_l 2019$C \\/ \/ ===============\n$W"; -}; \ No newline at end of file +}; diff --git a/support/functions/_patch b/support/functions/_patch index b7fe45f..841f0ee 100644 --- a/support/functions/_patch +++ b/support/functions/_patch @@ -67,17 +67,17 @@ _apply_consolepatch(){ for e in ${patchlist[@]};do _w=0;cd "$svndir"; patchlog="$(mktemp)"; - echo -e "$y_l| PATCH : apply $e"; + echo -e "$y_l | PATCH : apply $e"; patch -F 10 -f -p0 < "$pdir/$e" >>"$patchlog" 2>/dev/null; hunks=$(grep -c1 "^Hunk" "$patchlog"); fails=$(grep -c1 "hunks FAILED" "$patchlog"); if [ "$hunks" -gt "0" ];then - echo -e "$y_l| PATCH :$w_l $hunks x HUNK for $e"; + echo -e "$y_l | PATCH :$w_l $hunks x HUNK for $e"; _w=1; fi; if [ "$fails" -gt "0" ];then - echo -e "$y_l| PATCH :$r_n FAIL (breaking Build) = $fails"; - echo -en "$w_l| RESTORE :$c_w LAST SVN BACKUP in "; + echo -e "$y_l | PATCH :$r_n FAIL (breaking Build) = $fails"; + echo -en "$w_l | RESTORE :$c_w LAST SVN BACKUP in "; for (( i=6; i>0; i--));do sleep 1 & echo -en "$i\b"; wait; @@ -92,11 +92,11 @@ _apply_consolepatch(){ if [ "$_w" -gt "0" ];then echo -e "$y_l| PATCH : done with warnings"; touch "$workdir/SVN-IS-PATCHED"; else - echo -e "$y_l| PATCH :$g_l done all ok$rs_"; + echo -e "$y_l | PATCH :$g_l done all ok$rs_"; touch "$workdir/SVN-IS-PATCHED"; fi; else - echo -en "$y_l| PATCH : no patch found\n"; + echo -en "$y_l | PATCH : no patch found\n"; fi; fi; -}; \ No newline at end of file +}; diff --git a/support/functions/_subversion b/support/functions/_subversion index 91bfef1..a254001 100644 --- a/support/functions/_subversion +++ b/support/functions/_subversion @@ -65,6 +65,9 @@ svnrestore(){ fi; untarsvn $1; [ -f "$svndir/config.h" ]&& echo -en "$w_l"" SVN Revision : $y_l""$("$svndir/config.sh" -r) restored\n\n$re_"; + [ -L "$workdir/lastbuild.log" ]&& rm "$workdir/lastbuild.log"; + [ -L "$workdir/lastpatch.log" ]&& rm "$workdir/lastpatch.log"; + [ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED"; }; quicksvnrestore(){ untarsvn $1;