Files
mc/buildscripts/patch.sh
T
Harshavardhana ac8a0e109f Move checkdeps to buildscripts/, additionally add patch.sh
patch.sh patches any source codepath with the patch provided,
for now the patch file included is a way to Hide flags for
codegangsta until it is merged upstream.

Not part of the build yet.
2015-03-18 11:20:26 -07:00

44 lines
600 B
Bash
Executable File

#!/bin/bash
usage() {
echo "Invalid arguments needs a <patch> <directory> "
exit 1
}
_init() {
if [ $# -lt 2 ]; then
usage;
fi
if [ ! -f $1 ]; then
usage;
fi
if [ ! -d $2 ]; then
usage;
fi
CODEPATH=$2
PATCH=$1
CP="/bin/cp"
P="/usr/bin/patch"
B="/usr/bin/basename"
R="/bin/rm"
}
main () {
echo ${PWD}
echo "Copying ${PATCH} to ${CODEPATH}"
${CP} -f ${PATCH} ${CODEPATH}
_pwd=${PWD}
cd ${CODEPATH}
patch=$(${B} ${PATCH})
${P} -p1 -R < ${patch}
${R} -f ${patch}
cd ${_pwd}
}
_init "$@" && main "$@"