===== This is a set of three simple tools written in sh(1) for generating single patches for use in Ports. This set is ideal for creating a new patch when it is inconvenient or undesirable to use the "make makepatch" utility. The first tool is "dupe" which is a quick copy utility. The second tool is "genpatch" which creates patches in the standards diff format and using the standard file name conventions. The last tool is "portfix" which runs "dupe", an editor of choice, and "genpatch" serially as a macro as a convenient and quick way to create port patches. Please see the dupe, genpatch, and portfix man pages for details.
39 lines
784 B
Bash
39 lines
784 B
Bash
#!/bin/sh
|
|
#
|
|
# usage: portfix origfile
|
|
#
|
|
# This is a wrapper. It runs consecutively:
|
|
# 1. dupe XXX
|
|
# 2. <editor> XXX
|
|
# 3. genpatch XXX
|
|
#
|
|
# If PORTEDITOR is defined in the environment, that program will be
|
|
# used instead of the EDITOR env. variable. If neither are defined
|
|
# it will fall back to vi.
|
|
|
|
|
|
if [ $# -eq 1 ]; then
|
|
old=${1}
|
|
if [ ! -f ${old} ]; then
|
|
echo "${0}: '${old}' does not exist! aborting..."
|
|
exit 1;
|
|
fi
|
|
else
|
|
echo "${0}: need exactly one argument"
|
|
echo "${0} <path/to/original/file>"
|
|
exit 1;
|
|
fi
|
|
|
|
if [ -n "${PORTEDITOR}" ]; then
|
|
MYPORTEDITOR=${PORTEDITOR}
|
|
elif [ -n "${EDITOR}" ]; then
|
|
MYPORTEDITOR=${EDITOR}
|
|
else
|
|
MYPORTEDITOR=/usr/bin/vi
|
|
fi
|
|
|
|
%%PREFIX%%/bin/dupe ${old}
|
|
${MYPORTEDITOR} ${old}
|
|
if [ $? -eq 0 ]; then
|
|
%%PREFIX%%/bin/genpatch ${old}
|
|
fi
|