From 10ef1c3abeb88af473c34f8ddd18da3148796823 Mon Sep 17 00:00:00 2001 From: Justin Davis Date: Sun, 15 Apr 2012 18:47:53 -0400 Subject: Rename mkpkgmeta script to prepkg. --- bin/genpkg | 2 +- bin/mkpkgmeta | 67 ----------------------------------------------------------- bin/prepkg | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 68 deletions(-) delete mode 100755 bin/mkpkgmeta create mode 100755 bin/prepkg (limited to 'bin') diff --git a/bin/genpkg b/bin/genpkg index c1895ac..7d8e222 100755 --- a/bin/genpkg +++ b/bin/genpkg @@ -80,7 +80,7 @@ do mkdir PKGTREE trap 'rm -f PKGDATA' 1 2 15 - if METABIN="$metad" PKGVAR="$vard" mkpkgmeta "$pkg" > PKGDATA + if METABIN="$metad" PKGVAR="$vard" prepkg "$pkg" > PKGDATA then echo "$pkgd/$pkg" else diff --git a/bin/mkpkgmeta b/bin/mkpkgmeta deleted file mode 100755 index 2296a28..0000000 --- a/bin/mkpkgmeta +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh - -prog=mkpkgmeta - -err() -{ - echo "$prog: $*" 1>&2 - exit 1 -} - -basicmeta() -{ - printf "pkgname\n%s\n\n" "$pkgname" - printf "pkgrel\n%d\n\n" "${PKGREL:-1}" - printf "packager\n%s\n\n" "${PACKAGER:-Anonymous}" - - if [ "$MAINTAINER" ] - then - printf "maintainer\n%s\n\n" "$MAINTAINER" - fi - - return 0 -} - -prependmeta() -{ - if basicmeta | cat - "$1" > "$1.new" - then - mv "$1.new" "$1" - return 0 - else - rm "$1.new" - return 1 - fi -} - -case $# in -0) echo "usage: $prog [package name]" 1>&2 - exit 1 -esac - -case "$METABIN" in -'') err "set METABIN before calling $prog" -esac - -tmp="/tmp/$prog.$$" -for flav in "$METABIN"/* -do - pkgname="$1" - [ -f "$flav" -a -x "$flav" ] || continue - PATH="$PATH:$flav.d" "$flav" "$pkgname" - metaret=$? - - case "$metaret" in - 0) if prependmeta PKGDATA - then - exit 0 - else - err "failed to prepend to PKGDATA" - fi ;; - 1) err "$flav encountered an error" ;; - 2) ;; # loop - *) err "$flav returned error code $metaret" ;; - esac -done - -err "no matching meta generator found for '$1'" diff --git a/bin/prepkg b/bin/prepkg new file mode 100755 index 0000000..2296a28 --- /dev/null +++ b/bin/prepkg @@ -0,0 +1,67 @@ +#!/bin/sh + +prog=mkpkgmeta + +err() +{ + echo "$prog: $*" 1>&2 + exit 1 +} + +basicmeta() +{ + printf "pkgname\n%s\n\n" "$pkgname" + printf "pkgrel\n%d\n\n" "${PKGREL:-1}" + printf "packager\n%s\n\n" "${PACKAGER:-Anonymous}" + + if [ "$MAINTAINER" ] + then + printf "maintainer\n%s\n\n" "$MAINTAINER" + fi + + return 0 +} + +prependmeta() +{ + if basicmeta | cat - "$1" > "$1.new" + then + mv "$1.new" "$1" + return 0 + else + rm "$1.new" + return 1 + fi +} + +case $# in +0) echo "usage: $prog [package name]" 1>&2 + exit 1 +esac + +case "$METABIN" in +'') err "set METABIN before calling $prog" +esac + +tmp="/tmp/$prog.$$" +for flav in "$METABIN"/* +do + pkgname="$1" + [ -f "$flav" -a -x "$flav" ] || continue + PATH="$PATH:$flav.d" "$flav" "$pkgname" + metaret=$? + + case "$metaret" in + 0) if prependmeta PKGDATA + then + exit 0 + else + err "failed to prepend to PKGDATA" + fi ;; + 1) err "$flav encountered an error" ;; + 2) ;; # loop + *) err "$flav returned error code $metaret" ;; + esac +done + +err "no matching meta generator found for '$1'" -- cgit v1.2.3-24-g4f1b