diff options
author | Martin Quinson <mquinson@debian.org> | 2003-01-21 09:49:29 +0000 |
---|---|---|
committer | Martin Quinson <mquinson@debian.org> | 2003-01-21 09:49:29 +0000 |
commit | 02dc4a5f8c1979e9a23f7b6851f693d29b640c4d (patch) | |
tree | 2f397f5df89f4529b89fd0e7a021238d0f290007 /needs-checking/export_patch | |
parent | 4d11e99bfc25e0261111d202a3a2afdf97daea5c (diff) | |
download | quilt-02dc4a5f8c1979e9a23f7b6851f693d29b640c4d.tar.gz |
Version 0.11, from Andreas Gruenbacher
Diffstat (limited to 'needs-checking/export_patch')
-rwxr-xr-x | needs-checking/export_patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/needs-checking/export_patch b/needs-checking/export_patch new file mode 100755 index 0000000..8e7116a --- /dev/null +++ b/needs-checking/export_patch @@ -0,0 +1,58 @@ +#!/bin/sh + +. patchfns 2>/dev/null || +. /usr/lib/patch-scripts/patchfns 2>/dev/null || +. $PATCHSCRIPTS_LIBDIR/patchfns 2>/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 + |