gorgone
5 years ago
1 changed files with 45 additions and 32 deletions
@ -1,40 +1,53 @@ |
|||
#!/bin/bash |
|||
|
|||
enable_emu(){ |
|||
clear;s3logo; |
|||
if [ -d "$svndir" ];then |
|||
quicksvnrestore; |
|||
else |
|||
checkout; |
|||
fi; |
|||
pname="oscam-emu.patch"; |
|||
source "$configdir/urls"; |
|||
emulocal="$dldir/emu_github"; |
|||
clear |
|||
s3logo |
|||
if [ -d "$svndir" ] |
|||
then |
|||
printf "$w_l quicksvnrestore $G$txt_wait\n" |
|||
quicksvnrestore |
|||
else |
|||
printf "$w_l checkout $G$txt_wait\n" |
|||
checkout |
|||
fi |
|||
|
|||
if [ -f "$emulocal/oscam-emu.patch" ];then |
|||
echo -en "$w_l Emu Revision : $y_l"; |
|||
grep '\+#define EMU_VERSION' "$emulocal/oscam-emu.patch" |cut -d " " -f 3; |
|||
if [ -f "$emulocal/$pname" ];then |
|||
cp -rf "$emulocal/$pname" "$svndir"; |
|||
fi |
|||
fi |
|||
echo -e $re_;cd $svndir;echo $(date)>"$workdir/patch.log"; |
|||
patch -p0 < $pname |tee -a "$workdir/patch.log" \ |
|||
|grep --line-buffered -v '^[0-9]\|^/' \ |
|||
|sed -e "s@^patching file@$Y patching file $WH----->$C@g;" \ |
|||
|sed -e "s@^Hunk@$P Hunk@g;" \ |
|||
|sed -e "s@FAILED@"$R"FAILED@g;" \ |
|||
|sed -e "s@succeeded@"$WH"succeeded@g;"; |
|||
pname="oscam-emu.patch" |
|||
source "$configdir/urls" |
|||
emulocal="$dldir/emu_github" |
|||
|
|||
if [ -f "$emulocal/oscam-emu.patch" ] |
|||
then |
|||
printf "$w_l Emu Revision : $y_l" |
|||
grep '\+#define EMU_VERSION' "$emulocal/oscam-emu.patch" |cut -d " " -f 3 |
|||
if [ -f "$emulocal/$pname" ] |
|||
then |
|||
cp -rf "$emulocal/$pname" "$svndir" |
|||
fi |
|||
fi |
|||
|
|||
printf $re_ |
|||
cd $svndir |
|||
printf $(date)>"$workdir/patch.log" |
|||
patch -p0 < $pname |tee -a "$workdir/patch.log" \ |
|||
|grep --line-buffered -v '^[0-9]\|^/' \ |
|||
|sed -e "s@^patching file@$Y patching file $WH----->$C@g;" \ |
|||
|sed -e "s@^Hunk@$P Hunk@g;" \ |
|||
|sed -e "s@FAILED@"$R"FAILED@g;" \ |
|||
|sed -e "s@succeeded@"$WH"succeeded@g;" |
|||
|
|||
fcount=0;fcount=$(grep -o 'FAILED at' -i "$workdir/patch.log" | wc -l) |
|||
hcount=0;hcount=$(grep -o 'Hunk #' -i "$workdir/patch.log" | wc -l) |
|||
if [ ! "$fcount" == "0" ] || [ ! "$hcount" == "0" ];then |
|||
echo -e "\n$WH Patch Result\n ------------\n Hunk Count :" $hcount; |
|||
echo -e " Fail Count :" $fcount; |
|||
# todo ask for restore svn yes / no / show log |
|||
fcount=0 |
|||
fcount=$(grep -o 'FAILED at' -i "$workdir/patch.log" | wc -l) |
|||
hcount=0; |
|||
hcount=$(grep -o 'Hunk #' -i "$workdir/patch.log" | wc -l) |
|||
if [ ! "$fcount" == "0" ] || [ ! "$hcount" == "0" ] |
|||
then |
|||
printf "\n$WH Patch Result\n ------------\n Hunk Count : $hcount\n" |
|||
printf " Fail Count : $fcount\n\n" |
|||
# todo ask for restore svn yes / no / show log |
|||
else |
|||
echo -e "\n$WH Patch Staus :$G CLEAN "; |
|||
touch "$workdir/EMU_ON"; |
|||
printf "\n$WH Patch Staus :$G CLEAN " |
|||
touch "$workdir/EMU_ON" |
|||
fi |
|||
echo -e $re_; |
|||
printf $re_ |
|||
} |
|||
|
Loading…
Reference in new issue