Annotation of embedaddon/readline/support/mkdist, revision 1.1.1.1
1.1 misho 1: #! /bin/bash -
2: #
3: # mkdist - make a distribution directory from a master manifest file
4: #
5: # usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-t] [-v] version
6: #
7: # SRCDIR defaults to src
8: # MANIFEST defaults to $SRCDIR/MANIFEST
9: #
10: # Chet Ramey
11: # chet@po.cwru.edu
12:
13: # Copyright (C) 1996-2002 Free Software Foundation, Inc.
14: #
15: # This program is free software: you can redistribute it and/or modify
16: # it under the terms of the GNU General Public License as published by
17: # the Free Software Foundation, either version 3 of the License, or
18: # (at your option) any later version.
19: #
20: # This program is distributed in the hope that it will be useful,
21: # but WITHOUT ANY WARRANTY; without even the implied warranty of
22: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23: # GNU General Public License for more details.
24: #
25: # You should have received a copy of the GNU General Public License
26: # along with this program. If not, see <http://www.gnu.org/licenses/>.
27: #
28:
29: SRCDIR=src
30: ROOTNAME=bash
31:
32: usage()
33: {
34: echo usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-t] [-v] version 1>&2
35: exit 2
36: }
37:
38: vmsg()
39: {
40: if [ -n "$verbose" ]; then
41: echo mkdist: "$@"
42: fi
43: }
44:
45: while getopts m:s:r:tv name
46: do
47: case $name in
48: m) MANIFEST=$OPTARG ;;
49: s) SRCDIR=$OPTARG ;;
50: r) ROOTNAME=$OPTARG ;;
51: t) maketar=yes ;;
52: v) verbose=yes ;;
53: ?) usage ;;
54: esac
55: done
56:
57: : ${MANIFEST:=$SRCDIR/MANIFEST}
58:
59: vmsg using $MANIFEST
60:
61: shift $(( $OPTIND - 1 ))
62:
63: if [ $# -lt 1 ]; then
64: usage
65: fi
66:
67: version=$1
68: newdir=${ROOTNAME}-$version
69:
70: tarfile=${newdir}.tar
71:
72: vmsg creating distribution for $ROOTNAME version $version in $newdir
73:
74: if [ ! -d $newdir ]; then
75: mkdir $newdir || { echo $0: cannot make directory $newdir 1>&2 ; exit 1; }
76: fi
77:
78: dirmode=755
79: filmode=644
80:
81: while read fname type mode
82: do
83: [ -z "$fname" ] && continue
84:
85: case "$fname" in
86: \#*) continue ;;
87: esac
88:
89: case "$type" in
90: d) mkdir $newdir/$fname ;;
91: f) cp -p $SRCDIR/$fname $newdir/$fname ;;
92: s) ln -s $mode $newdir/$fname ; mode= ;; # symlink
93: l) ln $mode $newdir/$fname ; mode= ;; # hard link
94: *) echo "unknown file type $type" 1>&2 ;;
95: esac
96:
97: if [ -n "$mode" ]; then
98: chmod $mode $newdir/$fname
99: fi
100:
101: done < $MANIFEST
102:
103: # cut off the `-alpha' in something like `2.0-alpha', leaving just the
104: # numeric version
105: #version=${version%%-*}
106:
107: #case "$version" in
108: #*.*.*) vers=${version%.*} ;;
109: #*.*) vers=${version} ;;
110: #esac
111:
112: #echo $vers > $newdir/.distribution
113:
114: #case "$version" in
115: #*.*.*) plevel=${version##*.} ;;
116: #*) plevel=0 ;;
117: #esac
118: #[ -z "$plevel" ] && plevel=0
119: #echo ${plevel} > $newdir/.patchlevel
120:
121: vmsg $newdir created
122:
123: if [ -n "$maketar" ]; then
124: tar cf ${tarfile} $newdir
125: gzip $tarfile
126: vmsg ${tarfile}.gz created
127: fi
128:
129: exit 0
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>