diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2010-05-28 13:52:47 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2010-05-29 18:39:16 +0000 |
commit | a57baec7cc9ae091a6b285cfece86ca2f8c21a61 (patch) | |
tree | 694623a44d2eb990e0438bf354346668bc6b82df /newapkbuild.in | |
parent | 89f17561e3144061010cbe10c80b98e0dc688fb6 (diff) | |
download | abuild-a57baec7cc9ae091a6b285cfece86ca2f8c21a61.tar.gz abuild-a57baec7cc9ae091a6b285cfece86ca2f8c21a61.tar.bz2 abuild-a57baec7cc9ae091a6b285cfece86ca2f8c21a61.tar.xz abuild-a57baec7cc9ae091a6b285cfece86ca2f8c21a61.zip |
newapkbuild: support for creating new from http source
newapkbuild http://example.com/path/foo-1.0.tar.gz
will set
pkgname=foo
pkgver=1.0
source="http://example.com/path/foo-1.0.tar.gz"
Diffstat (limited to 'newapkbuild.in')
-rwxr-xr-x | newapkbuild.in | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/newapkbuild.in b/newapkbuild.in index 3fa0b87..8c7df33 100755 --- a/newapkbuild.in +++ b/newapkbuild.in @@ -18,13 +18,24 @@ error() { echo "$@" >&2 } +is_url() { + case "$1" in + http://*|ftp://*) return 0;; + esac +} + + # create new aport from templates newaport() { - local newname="$1" + local newname="${1##*/}" local pn=${newname%-[0-9]*} local pv + local source= + is_url "$1" && source="$1" + if [ "$pn" != "$newname" ]; then pv=${newname#$pn-} + pv=${pv%.t*} #strip .tar.gz .tgz .tar.bz2 etc fi if [ -e "$pn"/APKBUILD ] && [ -z "$force" ]; then error "$pn/APKBUILD already exist" @@ -38,6 +49,9 @@ newaport() { -e "s/^pkgname=.*/pkgname=$pn/" \ -e "s/^pkgver=.*/pkgver=$pv/" \ "$datadir"/sample.APKBUILD > APKBUILD || return 1 + if [ -n "$source" ]; then + sed -i -e "/^source=/s|=.*|=\"$source\"|" APKBUILD || return 1 + fi #-e '1,/^\#$/d' \ if [ -n "$cpinitd" ]; then cp "$datadir"/sample.initd $pn.initd |