Browse Source

add cmdline compression option

examples:
-upx=-1
-UPX=-9
also usable in profiles
pull/9/head
gorgone 6 years ago
parent
commit
119527719a
  1. 18
      s3
  2. 52
      support/functions/_ansi
  3. 11
      support/functions/_cmd_build
  4. 7
      support/functions/_compress
  5. 24
      support/functions/_help
  6. 2
      support/functions/_logos
  7. 14
      support/functions/_patch
  8. 3
      support/functions/_subversion

18
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 ); 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 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"; CUSTOM_CONFDIR="not_set";
UPX="not_set";
#internal vars #internal vars
OPENBOX=0;UFS916003=0;_verbose=""; OPENBOX=0;UFS916003=0;_verbose="";
@ -229,11 +230,26 @@ else
pf_name="${2#*=}"; pf_name="${2#*=}";
fi; fi;
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 [ "$pf" == "empty" ] && c_m_d="$*" || c_m_d="all_off $pf $*"; # set only active module with profiles
for cmd in $c_m_d;do for cmd in $c_m_d;do
if [ "${cmd:0:3}" == "-c=" ] || [ "${cmd:0:3}" == "-C=" ];then if [ "${cmd:0:3}" == "-c=" ] || [ "${cmd:0:3}" == "-C=" ];then
CUSTOM_CONFDIR="${cmd#*=}"; CUSTOM_CONFDIR="${cmd#*=}";
fi; 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[@]}"; for cc in "${config_cases[@]}";
do do
[ "$cmd" == "$cc$on" ] && all_cc+=($cc$on) && break; [ "$cmd" == "$cc$on" ] && all_cc+=($cc$on) && break;
@ -260,7 +276,5 @@ else
fi; fi;
done; done;
_help; _help;
fi; fi;
exit; exit;

52
support/functions/_ansi

@ -6,34 +6,34 @@
#echo -e $r_n"red text"$re_"normal text" #echo -e $r_n"red text"$re_"normal text"
initializeANSI(){ initializeANSI(){
nc='\033[0;'; #nc normal color nc='\033[0;';#nc normal color
lc='\033[1;'; #lc light color lc='\033[1;';#lc light color
# normal # normal
r_n=$nc'31m'; #red r_n=$nc'31m';#red
g_n=$nc'32m'; #green g_n=$nc'32m';#green
y_n=$nc'33m'; #yellow y_n=$nc'33m';#yellow
b_n=$nc'34m'; #blue b_n=$nc'34m';#blue
p_n=$nc'35m'; #pink p_n=$nc'35m';#pink
c_n=$nc'36m'; #cyan c_n=$nc'36m';#cyan
w_n=$nc'37m'; #white w_n=$nc'37m';#white
#light #light
r_l=$lc'31m'; #red r_l=$lc'31m';#red
g_l=$lc'32m'; #green g_l=$lc'32m';#green
y_l=$lc'33m'; #yellow y_l=$lc'33m';#yellow
b_l=$lc'34m'; #blue b_l=$lc'34m';#blue
p_l=$lc'35m'; #pink p_l=$lc'35m';#pink
c_l=$lc'36m'; #cyan c_l=$lc'36m';#cyan
w_l=$lc'37m'; #white w_l=$lc'37m';#white
#reset to normal #reset to normal
re_='\033[0m'; #resets all colors re_='\033[0m' ;#resets all colors
re_f='\033[39m'; #resets only foreground color re_f='\033[39m';#resets only foreground color
re_b='\033[49m'; #resets only background color re_b='\033[49m';#resets only background color
#sed replace #sed replace
W=$(echo -e '\033[0m'); #normal W=$(echo -e '\033[0m') ;#normal
Y=$(echo -e '\033[1;33m'); #yellow Y=$(echo -e '\033[1;33m') ;#yellow
R=$(echo -e '\033[1;31m'); #red R=$(echo -e '\033[1;31m') ;#red
G=$(echo -e '\033[1;32m'); #green G=$(echo -e '\033[1;32m') ;#green
P=$(echo -e '\033[1;35m'); #pink P=$(echo -e '\033[1;35m') ;#pink
C=$(echo -e '\033[1;36m'); #cyan C=$(echo -e '\033[1;36m') ;#cyan
WH=$(echo -e '\033[1;37m'); #lightgray WH=$(echo -e '\033[1;37m');#lightgray
}; };

11
support/functions/_cmd_build

@ -29,7 +29,6 @@ _cmd_build(){
[ "$e" == "$d" ] && USE_vars[${e:0: -2}]=; [ "$e" == "$d" ] && USE_vars[${e:0: -2}]=;
done; done;
done; done;
_nl;
cd "$svndir"; cd "$svndir";
#make clean #make clean
@ -39,10 +38,10 @@ _cmd_build(){
for am in "${all_cc[@]}";do for am in "${all_cc[@]}";do
chose="false"; chose="false";
if [ "${am:${#am} - 3}" == "_on" ];then 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; fi;
if [ "${am:${#am} - 4}" == "_off" ];then 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; fi;
done; done;
@ -116,10 +115,10 @@ fi;
fi; fi;
#echo if build with profile #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 #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 #echo max cpu usage
if [ -f "$configdir/max_cpus" ];then if [ -f "$configdir/max_cpus" ];then
@ -198,6 +197,6 @@ fi;
#build error message #build error message
error_on_build=$(grep -c1 error "$ldir/$log_name"); error_on_build=$(grep -c1 error "$ldir/$log_name");
[ "$error_on_build" -gt "0" ] && echo -e "$r_l\terrors on build found$w_l"; [ "$error_on_build" -gt "0" ] && echo -e "$r_l\terrors on build found$w_l";
echo -e "$re_"; echo -e "$re_$w_l";
exit; exit;
}; };

7
support/functions/_compress

@ -4,10 +4,11 @@ compress_cam(){
cd "$bdir"; cd "$bdir";
upx_c="-1"; upx_c="-1";
[ -f "$configdir/upx_option" ] && source "$configdir/upx_option"; [ -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 }'); 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)}')"; 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"; 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(){ compress_cam_gui(){
@ -90,4 +91,4 @@ untarsvn(){
fi; fi;
fi; fi;
[ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED"; [ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED";
}; };

24
support/functions/_help

@ -9,12 +9,18 @@ helpline0(){
ll=0; ll=0;
echo -en " "; echo -en " ";
for s in "$@";do for s in "$@";do
ll=$((ll + (${#s} + 4))); if [ ! "$s" == "USE_SSL" ] \
if [ "$ll" -lt "30" ];then && [ ! "$s" == "USE_MCA" ] \
echo -en "$s(_off) "; && [ ! "$s" == "USE_LIBUSB" ] \
else && [ ! "$s" == "USE_CONFDIR" ];
echo -en "$s(_off)\n "; then
ll=""; ll=$((ll + (${#s} + 4)));
if [ "$ll" -lt "30" ];then
echo -en "$s(_off) ";
else
echo -en "$s(_off)\n ";
ll="";
fi;
fi; fi;
done; done;
}; };
@ -32,10 +38,10 @@ helpline1(){
done; done;
}; };
_help(){ clear;s3logo; _help(){ clear;s3logo;
echo -e " ----------------------------------"; echo -e " --------------------------------------";
echo -e " $txt_help1 $0 menu"; echo -e " $txt_help1 $0 menu";
echo -e " $txt_help2"; echo -e " $txt_help2";
echo -e " ----------------------------------"; echo -e " --------------------------------------";
echo -e "$w_l\n toolchains :\n ------------$g_n"; echo -e "$w_l\n toolchains :\n ------------$g_n";
helpline1 "${AVAI_TCLIST[@]}"; helpline1 "${AVAI_TCLIST[@]}";
echo -e "$w_l\n simplebuild options :\n ---------------------$c_n"; 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[@]}"; helpline0 "${SHORT_CARD_READERS[@]}";
echo -e "$w_l\n use_vars :\n --------$w_n"; echo -e "$w_l\n use_vars :\n --------$w_n";
helpline0 "${!USE_vars[@]}";_wait; helpline0 "${!USE_vars[@]}";_wait;
}; };

2
support/functions/_logos

@ -26,4 +26,4 @@ echo -e $C"
/ \\ / \\ =============== / \\ / \\ ===============
/_______ //______ / $y_l by gorgone$p_l 2019$C /_______ //______ / $y_l by gorgone$p_l 2019$C
\\/ \/ ===============\n$W"; \\/ \/ ===============\n$W";
}; };

14
support/functions/_patch

@ -67,17 +67,17 @@ _apply_consolepatch(){
for e in ${patchlist[@]};do for e in ${patchlist[@]};do
_w=0;cd "$svndir"; _w=0;cd "$svndir";
patchlog="$(mktemp)"; 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; patch -F 10 -f -p0 < "$pdir/$e" >>"$patchlog" 2>/dev/null;
hunks=$(grep -c1 "^Hunk" "$patchlog"); hunks=$(grep -c1 "^Hunk" "$patchlog");
fails=$(grep -c1 "hunks FAILED" "$patchlog"); fails=$(grep -c1 "hunks FAILED" "$patchlog");
if [ "$hunks" -gt "0" ];then 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; _w=1;
fi; fi;
if [ "$fails" -gt "0" ];then if [ "$fails" -gt "0" ];then
echo -e "$y_l| PATCH :$r_n FAIL (breaking Build) = $fails"; echo -e "$y_l | PATCH :$r_n FAIL (breaking Build) = $fails";
echo -en "$w_l| RESTORE :$c_w LAST SVN BACKUP in "; echo -en "$w_l | RESTORE :$c_w LAST SVN BACKUP in ";
for (( i=6; i>0; i--));do for (( i=6; i>0; i--));do
sleep 1 & echo -en "$i\b"; sleep 1 & echo -en "$i\b";
wait; wait;
@ -92,11 +92,11 @@ _apply_consolepatch(){
if [ "$_w" -gt "0" ];then echo -e "$y_l| PATCH : done with warnings"; if [ "$_w" -gt "0" ];then echo -e "$y_l| PATCH : done with warnings";
touch "$workdir/SVN-IS-PATCHED"; touch "$workdir/SVN-IS-PATCHED";
else 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"; touch "$workdir/SVN-IS-PATCHED";
fi; fi;
else else
echo -en "$y_l| PATCH : no patch found\n"; echo -en "$y_l | PATCH : no patch found\n";
fi; fi;
fi; fi;
}; };

3
support/functions/_subversion

@ -65,6 +65,9 @@ svnrestore(){
fi; fi;
untarsvn $1; untarsvn $1;
[ -f "$svndir/config.h" ]&& echo -en "$w_l"" SVN Revision : $y_l""$("$svndir/config.sh" -r) restored\n\n$re_"; [ -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(){ quicksvnrestore(){
untarsvn $1; untarsvn $1;

Loading…
Cancel
Save