Enhance backport-rev script

pbcopy is not available in Linux (only in Mac OS)
Add check if pbcopy is available or xsel (a linux variante)

svn path=/trunk/; revision=49483
This commit is contained in:
Alexis La Goutte 2013-05-21 16:57:55 +00:00
parent aaa1f1bef9
commit c97865c179
1 changed files with 14 additions and 1 deletions

View File

@ -28,12 +28,25 @@ if [ -z "$VISUAL" ] ; then
VISUAL=$EDITOR
fi
#Check if pbcopy (or similar) is available...
if [ `builtin type -p pbcopy` ] ; then
PBCOPY="pbcopy"
fi
if [ `builtin type -p xsel` ] ; then
PBCOPY="xsel --clipboard --input"
fi
if [ -z "$PBCOPY" ] ; then
echo "Can't find an clipboard copy. Check if pbcopy or xsel is installed in your system"
exit 1
fi
function exit_err
{
if [ -n "$*" ] ; then
echo "$*"
fi
echo -n $patchfile | pbcopy
echo -n $patchfile | $PBCOPY
echo "Patch saved to $patchfile and copied to pasteboard"
if [ -n "$VISUAL" ] ; then
"$VISUAL" $patchfile $logfile