| 1 |
operz |
11 |
#!/bin/ksh |
| 2 |
|
|
# |
| 3 |
|
|
# $Id: newpkg 827 2006-09-19 17:26:09Z comand $ |
| 4 |
|
|
# $URL: svn://svn.code.sf.net/p/gar/code/csw/mgar/gar/v2/bin/newpkg $ |
| 5 |
|
|
# |
| 6 |
|
|
# Copyright 2006 Cory Omand <comand@blastwave.org> |
| 7 |
|
|
# All rights reserved. Use is subject to license terms. |
| 8 |
|
|
# |
| 9 |
|
|
# Redistribution and/or use, with or without modification, is |
| 10 |
|
|
# permitted. This software is without warranty of any kind. The |
| 11 |
|
|
# author(s) shall not be liable in the event that use of the |
| 12 |
|
|
# software causes damage. |
| 13 |
|
|
# |
| 14 |
|
|
# newpkg - copy the system package template to one or more |
| 15 |
|
|
# package directories. |
| 16 |
|
|
# |
| 17 |
|
|
|
| 18 |
|
|
repo="http://svn:5957/csw/trunk" |
| 19 |
|
|
template="$repo/template" |
| 20 |
|
|
|
| 21 |
|
|
if [ -z "$@" ]; then |
| 22 |
|
|
print "Usage: $0 <distname>..." |
| 23 |
|
|
exit 1 |
| 24 |
|
|
fi |
| 25 |
|
|
|
| 26 |
|
|
CWD=`pwd` |
| 27 |
|
|
for distname in $@ |
| 28 |
|
|
do |
| 29 |
|
|
svn export $template $distname 1>/dev/null |
| 30 |
|
|
if [ ! -d $distname ]; then |
| 31 |
|
|
print "Error: failed to export template to $distname" |
| 32 |
|
|
exit 2 |
| 33 |
|
|
fi |
| 34 |
|
|
|
| 35 |
|
|
category=`basename $CWD` |
| 36 |
|
|
softname=`echo $distname | tr '[A-Z]' '[a-z]' | tr -d '-'` |
| 37 |
|
|
pkgname="CSW$softname" |
| 38 |
|
|
|
| 39 |
|
|
if [ "$category" = "cpan" ]; then |
| 40 |
|
|
pkgname="CSWpm$softname" |
| 41 |
|
|
softname="pm_$softname" |
| 42 |
|
|
fi |
| 43 |
|
|
|
| 44 |
|
|
gsed -i -e s,PACKAGE,$distname, \ |
| 45 |
|
|
-e s,CATEGORY,$category, \ |
| 46 |
|
|
-e s,CSWpackage,$pkgname, $distname/Makefile |
| 47 |
|
|
|
| 48 |
|
|
mv $distname/files/CSWpackage.gspec $distname/files/$pkgname.gspec |
| 49 |
|
|
gsed -i -e s,CSWpackage,$pkgname, \ |
| 50 |
|
|
-e s,package,$softname, $distname/files/$pkgname.gspec |
| 51 |
|
|
|
| 52 |
|
|
print "Created skeleton build dir for $distname" |
| 53 |
|
|
|
| 54 |
|
|
done |
| 55 |
|
|
|