kernel-cp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. # A simple wrapper to the kernel.org script checkpatch.pl
  3. # Usage:
  4. #
  5. # svn diff | ./build_tools/kernel-cp -
  6. # ./build_tools/kernel-cp my.diff
  7. # ./build_tools/kernel-cp --file drivers/dahdi/wctdm.c
  8. mydir=`dirname $0`
  9. check_patch_dir="$mydir/cp"
  10. rel_path="scripts/checkpatch.pl"
  11. check_patch="$mydir/checkpatch.pl"
  12. URL='http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=scripts/checkpatch.pl;hb=HEAD'
  13. # Required files in directories in the tree
  14. SUBDIRS="fs ipc lib arch init scripts drivers kernel Documentation include"
  15. set -e
  16. if [ "$1" = 'download' ]; then
  17. if [ -x "$check_patch" ]; then
  18. exit 0
  19. fi
  20. wget -O "$check_patch" "$URL"
  21. if [ `wc -c <"$check_patch"` -lt 1000 ]; then
  22. # already downloaded
  23. # FIXME: redirection fails on downloading and you get a
  24. # short HTML file as your "script".
  25. echo >&2 "$0: Error: Download failed".
  26. exit 1
  27. fi
  28. chmod +x "$check_patch"
  29. exit 0
  30. fi
  31. if [ ! -x "$check_patch" ]; then
  32. echo >&2 "Script $check_patch not found. Download it?"
  33. echo >&2 ""
  34. echo >&2 " $0 download"
  35. exit 1
  36. fi
  37. exec $check_patch --no-tree --no-signoff "$@"