#!/bin/bash # description format shameless stolen from Andrew Morton's patch scripts # some code stolen too, variables renamed to unprotect the guilty # the rest, copyright (c) Ray Lee, 2003 # GPL'd, use as you wish # expects a tree of patches and descriptions, and recurses until covered # Example: # . # |-- index.footer # |-- index.header # |-- linux_kernel # | |-- fishcamp # | |-- fishcamp.dir_desc # | |-- vaio # | | |-- apm-power-status-workaround-1.desc # | | |-- apm-power-status-workaround-1.diff # | | |-- apm-power-status-workaround-2.desc # | | `-- apm-power-status-workaround-2.diff # | `-- vaio.dir_desc # |-- linux_kernel.dir_desc # |-- obsolete # | |-- gnomepim.desc # | |-- gnomepim.diff # | |-- waste.desc # | `-- waste.diff # `-- obsolete.dir_desc # for each directory to recurse into, have a $DIR.dir_desc file # for each diff to describe, have a $DIFF.desc file # the format of the file is: # DESC # one line of pithy description # EDESC # # Longer, multiline description will # go here. description_summary() { local state=0 while read x do if [ x"$x" = xDESC ] then state=1 elif [ x"$x" = xEDESC ] then state=0 elif [ $state = 1 ] then echo -n "$x " fi done } description_body() { local file=$1 local found_description=0 while read x do if [ x"$x" = xEDESC ] then cat found_description=1 fi done < $file if [ $found_description = 0 ] then cat $file fi } rootname() { local ret=$(basename $1) ret=$(echo $ret | sed -e 's/\.patch$//') ret=$(echo $ret | sed -e 's/\.diff$//') ret=$(echo $ret | sed -e 's/\.pc$//') ret=$(echo $ret | sed -e 's/\.txt$//') ret=$(echo $ret | sed -e 's/\.desc$//') ret=$(echo $ret | sed -e 's/\.dir_desc$//') echo $ret } describe_directory() { local printed_something=0 local subdirs=$(ls 2>/dev/null $1/*.dir_desc | wc -l) if [ $subdirs != 0 ] then for directory_description in $1/*.dir_desc do DIR=$(rootname $directory_description) echo -n "