#!/bin/bash #Copyright 2005 William Stearns #Released under the GPL Usage () { echo 'Usage:' >&2 echo 'apply-quilt-packages /path/to/tree/to/be/patched/' >&2 echo 'run this from the directory with "series" in it' >&2 exit 1 } PatchDir=`pwd` if [ -z "$1" -o ! -d "$1" -o ! -f "$PatchDir"/series ]; then Usage fi cat series | \ while read OnePatch ExtraParams ; do if [ -z "$ExtraParams" ]; then ExtraParams=' -p1 ' fi echo "==== Applying $PatchDir/$OnePatch" >&2 if [ ! -f "$PatchDir/$OnePatch" ]; then echo "Cannot find $OnePatch, skipping" >&2 elif cd "$1" ; patch --forward $ExtraParams --dry-run <"$PatchDir/$OnePatch" ; then echo "Test patch worked fine, applying for real" >&2 cd "$1" ; patch --forward -s $ExtraParams <"$PatchDir/$OnePatch" else echo "Something went wrong with $PatchDir/$OnePatch . Press enter when ready to move on." >&2 read JUNK fi done