gorgone
5 years ago
5 changed files with 120 additions and 77 deletions
@ -1,94 +1,137 @@ |
|||||
#!/bin/bash |
#!/bin/bash |
||||
|
|
||||
compress_cam(){ |
compress_cam(){ |
||||
cd "$bdir"; |
cd "$bdir" |
||||
upx_c="-1"; |
upx_c="-1" |
||||
[ -f "$configdir/upx_option" ] && source "$configdir/upx_option"; |
|
||||
[ ! "$UPX" == "not_set" ] && upx_c=$UPX; |
[ -f "$configdir/upx_option" ] && source "$configdir/upx_option" |
||||
erg=$(upx "$upx_c" "$1" |grep oscam |awk '{print $1" "$3" "$4 }'); |
[ "$UPX" == "not_set" ] || upx_c=$UPX |
||||
e1="$(echo "$erg"| awk '{printf("%4.2fk\n", $1 /1024)}')"; |
|
||||
e2="$(echo "$erg"| awk '{printf("%4.2fk\n", $2 /1024)}')"; |
erg=$(upx "$upx_c" "$1" |grep oscam |awk '{print $1" "$3" "$4 }') |
||||
e3="$(echo "$erg"| awk '{print $3}') (level=$upx_c)"; |
e1="$(echo "$erg"| awk '{printf("%4.2fk\n", $1 /1024)}')" |
||||
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"; |
e2="$(echo "$erg"| awk '{printf("%4.2fk\n", $2 /1024)}')" |
||||
}; |
e3="$(echo "$erg"| awk '{print $3}') (level=$upx_c)" |
||||
|
|
||||
|
echo -e "\n |
||||
|
$w_l\r BEFORE -----> $txt_compress1\t= $g_n$e1 |
||||
|
$w_l\r AFTER ------> $txt_compress2\t= $g_l$e2 |
||||
|
$w_l\r RESULT -----> $txt_compress3\t= $c_n$e3 |
||||
|
$rs_" |
||||
|
} |
||||
|
|
||||
compress_cam_gui(){ |
compress_cam_gui(){ |
||||
cd "$bdir"; |
cd "$bdir" |
||||
upx_c="-1"; |
upx_c="-1" |
||||
[ -f "$configdir/upx_option" ] && source "$configdir/upx_option"; |
|
||||
erg=$(upx "$upx_c" "$1" |grep oscam |awk '{print $1" "$3" "$4 }'); |
[ -f "$configdir/upx_option" ] && source "$configdir/upx_option" |
||||
e1="$(echo "$erg"| awk '{printf("%4.2f k\n", $1 /1024)}')"; |
[ "$UPX" == "not_set" ] || upx_c=$UPX |
||||
e2="$(echo "$erg"| awk '{printf("%4.2fk\n", $2 /1024)}')"; |
|
||||
e3="$(echo "$erg"| awk '{print $3}')"; |
erg=$(upx "$upx_c" "$1" |grep oscam |awk '{print $1" "$3" "$4 }') |
||||
echo -e "\n $txt_compress1\t= $e1\n $txt_compress2\t= $e2\n $txt_compress3\t= $e3"; |
e1="$(echo "$erg"| awk '{printf("%4.2f k\n", $1 /1024)}')" |
||||
|
e2="$(echo "$erg"| awk '{printf("%4.2fk\n", $2 /1024)}')" |
||||
|
e3="$(echo "$erg"| awk '{print $3}')" |
||||
|
|
||||
|
echo -e "\n |
||||
|
$txt_compress1\t= $e1\n |
||||
|
$txt_compress2\t= $e2\n |
||||
|
$txt_compress3\t= $e3" |
||||
}; |
}; |
||||
|
|
||||
tar_cam_gui(){ |
tar_cam_gui(){ |
||||
cd "$bdir"; |
cd "$bdir" |
||||
erg=$(tar zcf $1.tar.gz $1 $2); |
erg=$(tar zcf $1.tar.gz $1 $2) |
||||
if [ -f "$1.tar.gz" ];then |
|
||||
echo -e "\n $1.tar.gz\n created"; |
if [ -f "$1.tar.gz" ] |
||||
if [ -f "$adir/$1.tar.gz" ];then |
then |
||||
rm -rf "$adir/$1.tar.gz"; |
printf "\n $1.tar.gz\n created\n" |
||||
mv -f "$1.tar.gz" "$adir"; |
if [ -f "$adir/$1.tar.gz" ] |
||||
echo -e "\n $1.tar.gz\n moved to $workdir/archive\n"; |
then |
||||
|
rm -rf "$adir/$1.tar.gz" |
||||
|
mv -f "$1.tar.gz" "$adir" |
||||
|
printf "\n $1.tar.gz\n moved to $workdir/archive\n" |
||||
else |
else |
||||
mv -f "$1.tar.gz" "$adir"; |
mv -f "$1.tar.gz" "$adir" |
||||
echo -e "\n $1.tar.gz\n moved to $workdir/archive\n"; |
printf "\n $1.tar.gz\n moved to $workdir/archive\n" |
||||
fi; |
fi |
||||
else |
else |
||||
echo -e "\nerror\n no $1.tar.gz\n created"; |
printf "\nerror\n no $1.tar.gz\n created\n" |
||||
fi; |
fi |
||||
}; |
} |
||||
|
|
||||
tar_cam(){ |
tar_cam(){ |
||||
cd "$bdir"; |
cd "$bdir" |
||||
if [ -n $2 ];then |
|
||||
echo -en "$y_n\n TAR -------->$w_l $1$g_l $txt_as$w_l $1.tar.gz$rs_"; |
if [ -n $2 ] |
||||
fi; |
then |
||||
erg=$(tar zcf $1.tar.gz $1 $2); |
echo -en "$y_n\n TAR -------->$w_l $1$g_l $txt_as$w_l $1.tar.gz$rs_" |
||||
if [ -f "$1.tar.gz" ];then |
fi |
||||
echo -e "$p_n$txt_done$rs_"; |
|
||||
if [ -f "$adir/$1.tar.gz" ];then |
erg=$(tar zcf $1.tar.gz $1 $2) |
||||
rm -rf "$adir/$1.tar.gz"; |
|
||||
mv -f "$1.tar.gz" "$adir"; |
if [ -f "$1.tar.gz" ] |
||||
echo -e "$c_l"" MOVE -------> $p_l$1.tar.gz $g_l$txt_to $y_n$workdir/archive\n$rs_"; |
then |
||||
|
printf "$p_n$txt_done$rs_\n" |
||||
|
|
||||
|
if [ -f "$adir/$1.tar.gz" ] |
||||
|
then |
||||
|
rm -rf "$adir/$1.tar.gz" |
||||
|
mv -f "$1.tar.gz" "$adir" |
||||
|
printf "$c_l"" MOVE -------> $p_l$1.tar.gz $g_l$txt_to $y_n$workdir/archive\n$rs_" |
||||
else |
else |
||||
mv -f "$1.tar.gz" "$adir"; |
mv -f "$1.tar.gz" "$adir" |
||||
echo -e "$c_l"" MOVE -------> $p_l$1.tar.gz $g_l$txt_to $y_n$workdir/archive\n$rs_"; |
echo -e "$c_l"" MOVE -------> $p_l$1.tar.gz $g_l$txt_to $y_n$workdir/archive\n$rs_" |
||||
fi; |
fi |
||||
|
|
||||
else |
else |
||||
echo -e "$r_l\nerror\n no $1.tar.gz\n created$rs_"; |
printf -e "$r_l\nerror\n no $1.tar.gz\n created$rs_\n" |
||||
fi; |
fi |
||||
}; |
} |
||||
|
|
||||
tarsvn(){ |
tarsvn(){ |
||||
cd "$workdir"; |
cd "$workdir" |
||||
if [ -f "$svndir/config.sh" ];then |
|
||||
cat "$svndir/config.sh" >"$configdir/config.sh.master"; |
if [ -f "$svndir/config.sh" ] |
||||
[ -f "$svndir/Makefile" ]&& cat "$svndir/Makefile" >"$configdir/Makefile.master"; |
then |
||||
echo -en "$w_l SVN Backup :$c_l "; |
cp -f "$svndir/config.sh" "$configdir/config.sh.master" |
||||
tar -zcf "$bsvn/$("$svndir/config.sh" -r).tar.gz" oscam-svn; |
[ -f "$svndir/Makefile" ] && cp -f "$svndir/Makefile" "$configdir/Makefile.master" |
||||
fi; |
printf "$w_l SVN Backup :$c_l " |
||||
cd "$bsvn"; |
tar -zcf "$bsvn/$("$svndir/config.sh" -r).tar.gz" oscam-svn |
||||
ln -sf "$bsvn/$("$svndir/config.sh" -r).tar.gz" "last.tar.gz"; |
fi |
||||
echo -e "done\n$re_"; |
|
||||
}; |
cd "$bsvn" |
||||
|
ln -sf "$bsvn/$("$svndir/config.sh" -r).tar.gz" "last.tar.gz" |
||||
|
printf "done$re_\n" |
||||
|
} |
||||
|
|
||||
untarsvn(){ |
untarsvn(){ |
||||
cd "$workdir"; |
cd "$workdir" |
||||
|
|
||||
[ -d oscam-svn ] && rm -rf oscam-svn; |
[ -d oscam-svn ] && rm -rf oscam-svn; |
||||
if [ -z "$1" ];then |
|
||||
[ -f "$bsvn/last.tar.gz" ] && tar -xf "$bsvn/last.tar.gz"; |
if [ -z "$1" ] |
||||
|
then |
||||
|
[ -f "$bsvn/last.tar.gz" ] && tar -xf "$bsvn/last.tar.gz" |
||||
else |
else |
||||
if [ -f "$bsvn/$1.tar.gz" ];then |
|
||||
tar -xf "$bsvn/$1.tar.gz"; |
if [ -f "$bsvn/$1.tar.gz" ] |
||||
cd $bsvn; |
then |
||||
ln -sf "$bsvn/$("$svndir/config.sh" -r).tar.gz" "last.tar.gz"; |
tar -xf "$bsvn/$1.tar.gz" |
||||
|
cd $bsvn |
||||
|
ln -sf "$bsvn/$("$svndir/config.sh" -r).tar.gz" "last.tar.gz" |
||||
else |
else |
||||
if [ -f "$bsvn/last.tar.gz" ];then |
|
||||
tar -xf "$bsvn/last.tar.gz"; |
if [ -f "$bsvn/last.tar.gz" ] |
||||
|
then |
||||
|
tar -xf "$bsvn/last.tar.gz" |
||||
else |
else |
||||
echo -en "$w_l SVN Backup :$r_l $txt_not_found"; |
printf "$w_l SVN Backup :$r_l $txt_not_found\n" |
||||
sleep 3; |
sleep 3 |
||||
checkout; |
checkout |
||||
fi; |
fi |
||||
fi; |
|
||||
fi; |
fi |
||||
[ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED"; |
|
||||
}; |
fi |
||||
|
|
||||
|
[ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED" |
||||
|
} |
||||
|
Loading…
Reference in new issue