* updated konsole (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / misc / archive / newpackage.sh
blob23008e671c5a602dbf1f5b54f04d0e812634f837
1 #!/bin/bash
3 # Written by Benjamin Schieder <blindcoder@scavenger.homeip.net>
5 # Use:
6 # newpackage.sh [-main] <rep>/<pkg> http://www.example.com/down/pkg.tar.bz2
8 # will create <pkg>.desc and <pkg>.conf. .desc will contain the [D] and [COPY]
9 # already filled in. The other tags are mentioned with TODO.
11 # .conf will contain an empty <pkg>_main() { } and custmain="<pkg>_main"
12 # if -main is specified.
14 # --- T2-COPYRIGHT-NOTE-BEGIN ---
15 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
17 # T2 SDE: misc/archive/newpackage.sh
18 # Copyright (C) 2004 - 2005 The T2 SDE Project
19 # Copyright (C) 1998 - 2003 ROCK Linux Project
21 # More information can be found in the files COPYING and README.
23 # This program is free software; you can redistribute it and/or modify
24 # it under the terms of the GNU General Public License as published by
25 # the Free Software Foundation; version 2 of the License. A copy of the
26 # GNU General Public License can be found in the file COPYING.
27 # --- T2-COPYRIGHT-NOTE-END ---
30 if [ "$1" == "-main" ] ; then
31 create_main=1
32 shift
35 if [ $# -lt 2 ] ; then
36 cat <<-EEE
37 Usage:
38 $0 <option> package/repository/packagename Download_1 < Download_2, Download_n >
40 Where <option> may be:
41 -main Create a package.conf file with main-function
43 EEE
44 exit 1
48 dir=${1#package/} ; shift
49 package=${dir##*/}
50 if [ "$package" = "$dir" ]; then
51 echo "failed"
52 echo -e "\t$dir must be <rep>/<pkg>!\n"
53 exit
56 rep="$( echo package/*/$package | cut -d'/' -f 2 )"
57 if [ "$rep" != "*" ]; then
58 echo "failed"
59 echo -e "\tpackage $package belongs to $rep!\n"
60 exit
63 rep=${dir/\/$package/}
64 confdir="package/$dir"
65 maintainer='The T2 Project <t2@t2-project.org>'
67 echo -n "Creating $confdir ... "
68 if [ -e $confdir ] ; then
69 echo "failed"
70 echo -e "\t$confdir already exists!\n"
71 exit
73 if mkdir -p $confdir ; then
74 echo "ok"
75 else
76 echo "failed"
77 exit
80 echo -n "Creating $package.desc ... "
81 cat >$confdir/$package.desc <<EEE
82 [I] TODO: Short Information
84 [T] TODO: Long Expanation
85 [T] TODO: Long Expanation
86 [T] TODO: Long Expanation
87 [T] TODO: Long Expanation
88 [T] TODO: Long Expanation
90 [U] TODO: URL
92 [A] TODO: Author
93 [M] ${maintainer:-TODO: Maintainer}
95 [C] TODO: Category
97 [L] TODO: License
98 [S] TODO: Status
99 [V] TODO: Version
100 [P] X -----5---9 800.000
104 while [ "$1" ]; do
105 dl=$1; shift
106 file=`echo $dl | sed 's,^.*/,,g'`
107 server=${dl%$file}
108 echo [D] 0 $file $server >> $confdir/$package.desc
109 done
110 echo >> $confdir/$package.desc
112 echo "ok"
113 echo -n "Creating $package.conf ... "
115 if [ "$create_main" == "1" ] ; then
116 cat >>$confdir/$package.conf <<-EEE
117 ${package}_main() {
118 : TODO
121 custmain="${package}_main"
125 echo "ok"
126 echo "Remember to fill in the TODO's:"
127 grep TODO $confdir/$package.*
128 echo