Tue, 28 Aug 2012 18:29:30 +0200
Update from Drupal 6.x to 7.x and introduce several new HTML5 themes. Because
many themes from Drupal 6.x have since been abandoned, left unmaintained, or
not ported to Drupal 7.x, this package has changed in size and utility.
1 #!@l_prefix@/lib/openpkg/bash
2 ##
3 ## release -- OpenPKG Release Determination Utility
4 ## Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
5 ##
6 ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
7 ## All rights reserved. Licenses which grant limited permission to use,
8 ## copy, modify and distribute this software are available from the
9 ## OpenPKG GmbH.
10 ##
11 ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
12 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
15 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
17 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
20 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
21 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22 ## SUCH DAMAGE.
23 ##
25 # configuration
26 prefix="@l_prefix@"
28 # minimum command line parsing
29 opt_F="OpenPKG-%t %u"
30 opt_r=""
31 while [ $# -gt 0 ]; do
32 case "$1" in
33 -F ) opt_F="$2"; shift; shift ;;
34 --fmt ) opt_F="$2"; shift; shift ;;
35 -F* ) opt_F="`expr ".$1" : '.-F\(.*\)'`"; shift ;;
36 --fmt=* ) opt_F="`expr ".$1" : '.--fmt=\(.*\)'`"; shift ;;
37 -r ) opt_r="$2"; shift; shift ;;
38 --release ) opt_r="$2"; shift; shift ;;
39 -r* ) opt_r="`expr ".$1" : '.-r\(.*\)'`"; shift ;;
40 --release=* ) opt_r="`expr ".$1" : '.--release=\(.*\)'`"; shift ;;
41 * ) break ;;
42 esac
43 done
45 # translate a release number to a release tag
46 number_to_tag () {
47 sed -e 's;^;X;' \
48 -e 's;^X\([^.-][^.-]*\.[^.-][^.-]*\)\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].*$;\1-SOLID;' \
49 -e 's;^X\([^.-][^.-]*\.[^.-][^.-]*\)\.[^.-][^.-]*.*$;\1-RELEASE;' \
50 -e 's;^X\([^.-][^.-]*\)\.[^.-][^.-]*.*$;\1-STABLE;' \
51 -e 's;^X[^.-][^.-]*.*$;CURRENT;' \
52 -e 's;^X.*$;UNKNOWN;'
53 }
55 # sanity check a release tag
56 tag_sanity () {
57 sed -e 's;^;X;' \
58 -e 's;^X[^.-][^.-]*\.[^.-][^.-]*-RELEASE$;OK;' \
59 -e 's;^X[^.-][^.-]*\.[^.-][^.-]*-SOLID-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$;OK;' \
60 -e 's;^X[^.-][^.-]*\.[^.-][^.-]*-SOLID$;OK;' \
61 -e 's;^X[^.-][^.-]*-STABLE-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$;OK;' \
62 -e 's;^X[^.-][^.-]*-STABLE$;OK;' \
63 -e 's;^XCURRENT-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$;OK;' \
64 -e 's;^XCURRENT$;OK;' \
65 -e 's;^X.*$;ERROR;'
66 }
68 # determine release
69 tag=""
70 if [ ".$opt_r" != . ]; then
71 tag=`echo ".$opt_r" | sed -e 's;^\.;;' | number_to_tag`
72 elif [ -f "$prefix/etc/openpkg/release" ]; then
73 tag=`(cat $prefix/etc/openpkg/release; echo "") | sed \
74 -e 's;^;X;' \
75 -e 's;^X *TAG *= *\([^ ][^ ]*\).*;\1;' \
76 -e '/^X/d' | \
77 sed -n -e '$p'`
78 fi
79 if [ ".$tag" = . ]; then
80 tag=`$prefix/bin/openpkg rpm \
81 -q --qf '%{RELEASE}\n' openpkg | number_to_tag`
82 fi
83 if [ .`echo ".$tag" | sed -e 's;^\.;;' | tag_sanity` = .ERROR ]; then
84 echo "openpkg:release: WARNING: unable to determine OpenPKG release tag" 1>&2
85 tag="UNKNOWN"
86 fi
88 # determine distribution URL
89 url=""
90 if [ -f "$prefix/etc/openpkg/release" ]; then
91 url=`(cat $prefix/etc/openpkg/release; echo "") | sed \
92 -e 's;^;X;' \
93 -e 's;^X *URL *= *\([^ ][^ ]*\).*;\1;' \
94 -e '/^X/d' | \
95 sed -n -e '$p'`
96 fi
97 if [ ".$url" = . ]; then
98 url="http://download.openpkg.org/stacks/*"
99 fi
100 case ".$url" in
101 */\* )
102 url=`echo ".$url" | sed -e 's;^\.;;' -e 's;/\*$;;'`
103 case "$tag" in
104 CURRENT )
105 url="$url/current/"
106 ;;
107 CURRENT-* )
108 version=`echo "$tag" | sed -e 's;^CURRENT-;;'`
109 url="$url/current/$version/"
110 ;;
111 *-STABLE )
112 version=`echo "$tag" | sed -e 's;^\(.*\)-STABLE$;\1;'`
113 url="$url/stable/$version/"
114 ;;
115 *-STABLE-* )
116 version=`echo "$tag" | sed -e 's;^\(.*\)-STABLE-\(.*\)$;\1.\2;'`
117 url="$url/stable/$version/"
118 ;;
119 *-SOLID )
120 version=`echo "$tag" | sed -e 's;^\(.*\)-SOLID$;\1;'`
121 url="$url/solid/$version/"
122 ;;
123 *-SOLID-* )
124 version=`echo "$tag" | sed -e 's;^\(.*\)-SOLID-\(.*\)$;\1.\2;'`
125 url="$url/solid/$version/"
126 ;;
127 *-RELEASE )
128 version=`echo "$tag" | sed -e 's;^\(.*\)-RELEASE$;\1;'`
129 url="$url/release/$version/"
130 ;;
131 * )
132 subdir=`echo "$tag" | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
133 url="$url/$subdir/"
134 ;;
135 esac
136 ;;
137 esac
139 # read uuid
140 [ -f "$prefix/etc/openpkg/uuid" ] && . "$prefix/etc/openpkg/uuid"
142 # generate output
143 echo "X$opt_F" |\
144 sed -e 's/^X//' \
145 -e "s;%t;${tag};g" \
146 -e "s;%u;${url};g" \
147 -e "s;%r;${UUID_REGISTRY};g" \
148 -e "s;%i;${UUID_INSTANCE};g" \
149 -e "s;%p;${UUID_PLATFORM};g" \
150 -e 's/\\n/^/g' | tr '^' '\012'