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. 5
      support/functions/_compress
  5. 22
      support/functions/_help
  6. 12
      support/functions/_patch
  7. 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 );
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;

52
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
};

11
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;
};

5
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(){

22
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";

12
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;
};

3
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;

Loading…
Cancel
Save