#! /bin/bash # listallpatch: list quilt patches below $topdir # Copyright 2006 Randy Dunlap # # list all quilt patches below the current working dir or a specified dir; # usage: listallpatch [topdir] [patch-dir-name] # topdir defaults to current working dir; # patch-dir-name defaults to "patches" if ~/.quiltrc is not found # or it does not set QUILT_PATCHES=patchdir; if [[ "$1" == "-h" || $1 == "--help" ]]; then echo " usage: listallpatch [topdir:\$PWD] [patch-dir-name:\$QUILT_PATCHES:patches]" exit 1 fi if [ -r ~/.quiltrc ]; then source ~/.quiltrc QPDIR=$QUILT_PATCHES else QPDIR= fi # find dirs in topdir that match patchdirname then print out the series file # (if present) topdir=${1-.} ##patchdirname=${2-"patches"} if [ "$2" != "" ]; then patchdirname=$2 elif [ "$QPDIR" != "" ]; then patchdirname=$QPDIR else patchdirname="patches" echo using 'patches' fi sercount=0 startdir=`/bin/pwd` if [ -d $topdir ]; then cd $topdir else echo "not a directory: $topdir" exit 1 fi currdir=$PWD #basedir=`basename $PWD` echo "searching in [$currdir] for patch-dir: $patchdirname" echo "=========================" for dir in `find $currdir -maxdepth 1 -type d` do if [ -d $dir/$patchdirname ]; then if [ -f $dir/$patchdirname/series ]; then sercount=$((sercount + 1)) echo "# $dir/$patchdirname/series:" cat $dir/$patchdirname/series echo "=========================" ##cd $dir ##quilt series ##cd $currdir fi fi done echo "$sercount 'series' files found." cd $startdir #end.