diff --git a/bin/sde-create-package b/bin/sde-create-package index 8b2600c..33875df 100755 --- a/bin/sde-create-package +++ b/bin/sde-create-package @@ -125,4 +125,92 @@ confdir=$( package_confdir "$pkg" ) echo_info "Creating package/$repo/$pkg from $hive:${hiveindex:-$pkg}" -"$SDEROOT/lib/sde-package/hives/$hive" "${hiveindex:-$pkg}" "$@" +# get info form the hive +output=$( "$SDEROOT/lib/sde-package/hives/$hive" "${hiveindex:-$pkg}" "$@" ) +[ -n "$output" ] || echo_abort 1 "$hive failed to fetch ${hiveindex:-$pkg} information" + +# do we have content for the $1 tag? +output_has_tag() +{ + echo "$output" | grep -q "^\[$1\]" +} + +# what do we know for the $1 tag? +output_tag() +{ + echo "$output" | grep "^\[$1\]" | sed -e 's,^\[\([A-Z-]\+\)\][ \t]*,,' -e 's,[ \t]*\$,,' +} + +# checks if output has $1, and return $2 if not +output_parse() +{ + if output_has_tag "$1"; then + output_tag "$1" + else + echo "$2" + fi +} + +# parse the output of the hive +# + +# title +title=$( output_parse I 'TODO: Short Information' ) +# desc +desc=$( output_parse T 'TODO: Long Expanation +TODO: Long Expanation +TODO: Long Expanation +TODO: Long Expanation +TODO: Long Expanation' ) +# url +url=$( output_parse U 'TODO: URL' ) +# author +author=$( output_parse A 'TODO: Author' ) +# category +category=$( output_parse C 'TODO: Category' ) +# license +license=$( output_parse L 'TODO: License' ) +# status +status=$( output_parse S 'TODO: Status' ) +# version +version=$( output_parse V 'TODO: Version' ) +# download +download=$( output_parse D '' ) + +TAG=SDE-COPYRIGHT-NOTE +cat < + +[C] $category + +[L] $license +[S] $status +[V] $version +[P] X -----5---9 800.000 + +EOT +echo "$download" | while read l; do + echo "[D] $l" +done +