dynup/kpatch — pull request #261 by goldyfruit (2014-06-20 18:08:38+00:00)
Title: kpatch-build: add -k option to allow a change of the CACHEDIR path

I added an option to allow a user to change the CACHEDIR path.
If the -k option is not used, CACHEDIR will be equal to $HOME/.kpatch (as default).

```
# kpatch-build -k /media/src -s /usr/src/linux-source-3.14 -t vmlinux meminfo-string.patch -d
```
Result :
```
/media/src/.kpatch
DEBUG mode enabled
+ shift
+ [[ 2 -gt 0 ]]
+ case "$1" in
+ [[ -z meminfo-string.patch ]]
++ readlink -f meminfo-string.patch
+ PATCHFILE=/usr/src/meminfo-string.patch
+ [[ ! -f /usr/src/meminfo-string.patch ]]
+ break
+ SRCDIR=/media/src/.kpatch/src
+ OBJDIR=/media/src/.kpatch/obj
+ OBJDIR2=/media/src/.kpatch/obj2
+ [[ -z vmlinux ]]
++ basename /usr/src/meminfo-string.patch
+ PATCHNAME=meminfo-string.patch
+ [[ meminfo-string.patch =~ \.patch ]]
+ PATCHNAME=meminfo-string
+ PATCHNAME=meminfo-string
++ mktemp -d /tmp/kpatch-build-XXXXXX
+ TEMPDIR=/tmp/kpatch-build-duoMPy
+ trap cleanup EXIT INT TERM
+ find_dirs
+ [[ -e /usr/local/bin/create-diff-object ]]
+ [[ -e /usr/local/bin/../libexec/kpatch/create-diff-object ]]
++ readlink -f /usr/local/bin/../libexec/kpatch
+ TOOLSDIR=/usr/local/libexec/kpatch
++ readlink -f /usr/local/bin/../share/kpatch
+ DATADIR=/usr/local/share/kpatch
+++ uname -r
++ readlink -f /usr/local/bin/../lib/modules/3.14.5/extra/kpatch/Module.symvers
+ SYMVERSFILE=/usr/local/lib/modules/3.14.5/extra/kpatch/Module.symvers
+ return
+ [[ -e /usr/local/lib/modules/3.14.5/extra/kpatch/Module.symvers ]]
+ source /etc/os-release
++ PRETTY_NAME='Debian GNU/Linux 7 (wheezy)'
++ NAME='Debian GNU/Linux'
++ VERSION_ID=7
++ VERSION='7 (wheezy)'
++ ID=debian
++ ANSI_COLOR='1;31'
++ HOME_URL=http://www.debian.org/
++ SUPPORT_URL=http://www.debian.org/support/
++ BUG_REPORT_URL=http://bugs.debian.org/
+ DISTRO=debian
+ [[ debian = fedora ]]
+ [[ debian = rhel ]]
+ [[ debian = ubuntu ]]
+ [[ -n /usr/src/linux-source-3.14 ]]
+ SRCDIR=/media/src/.kpatch/src
+ OBJDIR=/media/src/.kpatch/obj
+ OBJDIR2=/media/src/.kpatch/obj2
+ rm -rf /media/src/.kpatch
+ mkdir -p /media/src/.kpatch
+ mkdir -p /media/src/.kpatch/obj /media/src/.kpatch/obj2
+ [[ -n '' ]]
+ cp /usr/src/linux-source-3.14/.config /media/src/.kpatch/obj
+ echo 'Copying source to /media/src/.kpatch/src'
Copying source to /media/src/.kpatch/src
+ cp -a /usr/src/linux-source-3.14 /media/src/.kpatch/src
+ echo 'Testing patch file'
Testing patch file
+ cd /media/src/.kpatch/src
+ patch -N -p1 --dry-run
```

What do you think about it ?