diff options
-rwxr-xr-x | bin/addln | 21 | ||||
-rw-r--r-- | pbj/perlbrew.pbj | 5 |
2 files changed, 25 insertions, 1 deletions
diff --git a/bin/addln b/bin/addln new file mode 100755 index 0000000..6a39dbd --- /dev/null +++ b/bin/addln @@ -0,0 +1,21 @@ +#!/bin/sh + +if [ $# -lt 1 ] ; then + cat 1>&2 <<EOF +Usage: addln [PKGBUILD function] [line of bash] + +Reads the PKGBUILD from standard input, adding a line at the end of the +specified bash function. The line can be empty to just add a newline. +EOF + exit 1 +fi + +fname=$1 +shift + +awk -v fname="$fname" -v line="$*" ' +match($0, "^[ \\t]*" fname "\\(\\)") { active = 1 } +active && match($0, /^[ ]+/) { indent = substr($0, 1, RLENGTH) } +active && /^}/ { active = 0; print indent "" line } +1 +' diff --git a/pbj/perlbrew.pbj b/pbj/perlbrew.pbj index 6a61bdc..78e7482 100644 --- a/pbj/perlbrew.pbj +++ b/pbj/perlbrew.pbj @@ -4,4 +4,7 @@ > checkdepends < makedepends perl-path-class > checkdepends -= license MIT += license custom:MIT +| addln package +| addln package 'mkdir -p "$pkgdir/usr/share/licenses/perlbrew"' +| addln package 'cp LICENSE "$pkgdir/usr/share/licenses/perlbrew/LICENSE"' |