X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fkernel_patches%2Fscripts%2Fexport_patch;fp=lustre%2Fkernel_patches%2Fscripts%2Fexport_patch;h=d378417cba938eeaaa509aad8b545920d0b1ad3d;hp=0000000000000000000000000000000000000000;hb=d2d56f38da01001c92a09afc6b52b5acbd9bc13c;hpb=bf527ab7e56d4445f81223b23302b3cbf0dc5fb1 diff --git a/lustre/kernel_patches/scripts/export_patch b/lustre/kernel_patches/scripts/export_patch new file mode 100755 index 0000000..d378417 --- /dev/null +++ b/lustre/kernel_patches/scripts/export_patch @@ -0,0 +1,55 @@ +#!/bin/sh + +. patchfns >/dev/null || . /usr/lib/patch-scripts/patchfns >/dev/null || { \ + echo "Impossible to find my library 'patchfns'." + echo "Check your install, or go to the right directory" + exit 1 +} + +usage() +{ + echo "export_patch: export the patches listed in ./series" 1>&2 + echo "usage: export_patch destination-directory [prefix] " 1>&2 + exit 1 +} + +DIR="$1" +PREFIX="$2""_" + +if [ "$DIR" = "" ] +then + usage +fi + +if [ -e "$DIR" -a ! -d "$DIR" ] +then + echo "$DIR exists already, but is not a directory." 1>&2 + exit 1 +fi + +if [ ! -r ./series ] +then + echo "./series is not readable." 1>&2 + exit 1 +fi + +mkdir -p "$DIR" || exit 1 + +count=1 +for x in `cat ./series` +do + fname=`echo "$count" "$PREFIX" "$x" |\ + awk '{ if ( $2 != "_" ) + printf("p%05d_%s%s\n", $1, $2, $3); + else + printf("p%05d_%s\n", $1, $3); + }'` + if [ ! -r $P/patches/"$x" ] + then + echo "$P/patches/"$x" is not readable. skipping." 1>&2 + continue; + fi + cp -f $P/patches/"$x" "$DIR"/"$fname" || continue; + count=`expr $count + 1` +done +