You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
3.1 KiB
138 lines
3.1 KiB
#!/bin/bash
|
|
|
|
get_patch(){ _get_patch; }
|
|
|
|
_get_patch(){
|
|
cd $pdir
|
|
[ -f patch.url ] && source patch.url
|
|
clear
|
|
printf $C
|
|
ologo
|
|
printf $WH;
|
|
[ -f $PATCHNAME ] && printf "$Y $PATCHNAME $txt_found\n $txt_delete $P$PATCHNAME" && rm -f $PATCHNAME
|
|
printf $W"\n $txt_load $PATCHNAME"
|
|
|
|
if [[ `wget -S --spider $PATCHURL 2>&1 | grep 'HTTP/1.1 200 OK'` ]]
|
|
then
|
|
wget -q -O$PATCHNAME $PATCHURL
|
|
[ -f $PATCHNAME ] && printf $G" ok$W\n\n"
|
|
else
|
|
printf $R"\n\n $PATCHURL\n\n >> $txt_not_found <<$W\n\n"
|
|
fi
|
|
}
|
|
|
|
_apply_menupatch(){
|
|
[ -f "$workdir/SVN-IS-PATCHED" ] && quicksvnrestore $_toolchainname 2>/dev/null
|
|
cd "$pdir"
|
|
(if [ "$(ls -1 "$pdir"/*.patch 2>/dev/null | wc -l)" -gt "0" ]
|
|
then
|
|
|
|
cd "$pdir"
|
|
unset patchlist
|
|
patchlist=`ls *.patch | sort -st '/' -k1,1`
|
|
patchlog="$(mktemp)"
|
|
|
|
for e in ${patchlist[@]}
|
|
do
|
|
|
|
_w="ok"
|
|
cd "$svndir"
|
|
printf "PATCH : apply $e"
|
|
patch -f -p1 < "$pdir/$e" >>"$patchlog" 2>/dev/null
|
|
hunks=$(grep -c1 '^Hunk' "$patchlog")
|
|
fails=$(grep -c1 'hunks FAILED' "$patchlog")
|
|
|
|
if [ "$hunks" -gt "0" ]
|
|
then
|
|
printf "PATCH : $hunks x HUNK for $e"
|
|
_w="hunk"
|
|
fi
|
|
|
|
if [ "$fails" -gt "0" ]
|
|
then
|
|
printf "PATCH : $fails x FAILS for $e"
|
|
_w="fail"
|
|
fi
|
|
|
|
done
|
|
|
|
case $_w in
|
|
ok)
|
|
printf "PATCH : done all ok"
|
|
touch "$workdir/SVN-IS-PATCHED";;
|
|
hunk)
|
|
printf "PATCH : done with warnings save $e.log"
|
|
cp -f $patchlog "$ldir/$e.log"
|
|
ln -sf "$ldir/$e.log" "$workdir/lastpatch.log"
|
|
touch "$workdir/SVN-IS-PATCHED";;
|
|
fail)
|
|
printf "PATCH : break build save $e.log"
|
|
cp -f $patchlog "$ldir/$e.log"
|
|
ln -sf "$ldir/$e.log" "$workdir/lastpatch.log"
|
|
touch "$workdir/SVN-IS-PATCHED";;
|
|
esac
|
|
|
|
rm -rf "$patchlog"
|
|
fi;)|"$gui" "$st_" "$bt_" "$title_" "$pb_" 12 62
|
|
sleep 2
|
|
}
|
|
|
|
_apply_consolepatch(){
|
|
if [ ! -f "$workdir/SVN-IS-PATCHED" ]
|
|
then
|
|
|
|
cd "$pdir"
|
|
if [ "$(ls -1 "$pdir"/*.patch 2>/dev/null | wc -l)" -gt "0" ]
|
|
then
|
|
|
|
unset patchlist;patchlist=`ls *.patch | sort -st '/' -k1,1`
|
|
patchlog="$(mktemp)"
|
|
for e in ${patchlist[@]}
|
|
do
|
|
|
|
_w=0
|
|
cd "$svndir"
|
|
printf "$y_l\n | PATCH : apply $e"
|
|
patch -F 10 -f -p1 < "$pdir/$e" >>"$patchlog" 2>/dev/null
|
|
hunks=$(grep -c1 "^Hunk" "$patchlog")
|
|
fails=$(grep -c1 "hunks FAILED" "$patchlog")
|
|
|
|
if [ "$hunks" -gt "0" ]
|
|
then
|
|
printf "$y_l\n | PATCH :$w_l $hunks x HUNK for $e"
|
|
_w=1
|
|
fi
|
|
|
|
if [ "$fails" -gt "0" ]
|
|
then
|
|
printf "$y_l\n | PATCH :$r_n FAIL (breaking Build) = $fails"
|
|
printf "$w_l\n | RESTORE :$c_w LAST SVN BACKUP in "
|
|
for (( i=6; i>0; i--))
|
|
do
|
|
sleep 1 & echo -en "$i\b"
|
|
wait
|
|
done
|
|
svnrestore lastsvn;
|
|
exit
|
|
fi
|
|
|
|
cat $patchlog >"$ldir/$e.log";
|
|
ln -sf "$ldir/$e.log" "$workdir/lastpatch.log";
|
|
done
|
|
|
|
rm -rf "$patchlog"
|
|
|
|
if [ "$_w" -gt "0" ]
|
|
then
|
|
printf "$y_l\n | PATCH : done with warnings"
|
|
touch "$workdir/SVN-IS-PATCHED"
|
|
else
|
|
printf "$y_l\n | PATCH :$g_l done all ok$rs_"
|
|
touch "$workdir/SVN-IS-PATCHED"
|
|
fi
|
|
|
|
else
|
|
printf "$y_l\n | PATCH : no patch found\n"
|
|
fi
|
|
fi
|
|
}
|
|
|