Created
March 28, 2018 14:07
-
-
Save sizeofvoid/d90ed74cc4b06830222432274a4460a7 to your computer and use it in GitHub Desktop.
OpenBSD ports diff function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: portsdiff <diff-name> | |
# Creates a new diff from the current port cvs directory in DIR. | |
# If no parameter is passed PKGNAME will use as filename. | |
portsdiff () { | |
local DIR="$HOME/patches" | |
local SAVEFILE | |
if [ ! -d "$DIR" ]; then | |
echo "create $DIR" | |
mkdir -p $DIR | |
fi | |
if [ -n "$1" ]; then | |
SAVEFILE="$DIR/$1.diff" | |
if [ -e "$SAVEFILE" ]; then | |
echo "$SAVEFILE exist!" | |
echo -n "Override $SAVEFILE? (y):" | |
read yes | |
if [ "$yes" == "n" ]; then | |
return 0 | |
fi | |
fi | |
else | |
local SAVEDIFF="$(make show=PKGNAME)" | |
local DATE=$(date +%d_%m_%Y_%k%M%S) | |
if [ -e "$DIR/$SAVEDIFF.diff" ]; then | |
SAVEFILE="$DIR/${SAVEDIFF}_$DATE.diff" | |
else | |
SAVEFILE="$DIR/$SAVEDIFF.diff" | |
fi | |
fi | |
if [ -n "$SAVEFILE" ]; then | |
echo "Save diff in $SAVEFILE" | |
cvs diff -uNp . 2>&1 > $SAVEFILE | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment