3
# Copyright 2009 Canonical Ltd. This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
6
# This script munges the partner component into a commercial pocket arrangement
7
# for backwards compatibility with dapper, edgy and feisty.
9
# After running, <distroseries>-commercial will appear under dists.
11
# LPCONFIG will come from the environment so this script can run unaltered
15
# Written by Fabio M Di Nitto, amended by Julian Edwards for production
16
# and dogfood compatibility.
19
if [ -z $LPCONFIG ]; then
20
echo LPCONFIG must be set to run this script.
24
# Exit immediately on errors.
28
PRODUCTION_CONFIG=ftpmaster-publish
29
if [ "$LPCONFIG" = "$PRODUCTION_CONFIG" ]; then
30
archiveurl=/srv/launchpad.net/ubuntu-archive/ubuntu-partner
32
archiveurl=/srv/launchpad.net/ppa/ubuntu-partner
34
compatreleases="dapper edgy feisty"
36
# Fix up a release file so it refers to packages in the -commercial pocket.
41
descr=$(cat "$in" |grep ^Version: | sed -e 's#Version: ##g')
43
# Add -commercial suffix where required, force the component to main,
44
# and set Origin: and Label: to Canonical.
46
-e 's#^Archive:.*#&-commercial#g' \
47
-e 's#^Component:.*#Component: main#g' \
48
-e 's#^Origin:.*#Origin: Canonical#g' \
49
-e 's#^Label:.*#Label: Canonical#g' \
50
-e 's#^Suite:.*#&-commercial#g' \
51
-e 's#^Codename:.*#&-commercial#g' \
52
-e 's#^Components:.*#Components: main#g' \
53
-e 's#^Description:.*#Description: Ubuntu '"$descr"' Commercial Software#g' \
54
-e 's#partner/#main/#g' \
58
# Fix the topmost Release file so that its referenced Release file sizes and
59
# checksums are correct.
68
# Here we read in a line, see what type of hash is being used, and then
69
# the line ending in "Release" is re-written. Comments cannot go
70
# inside {} blocks so the four commands are explained here:
71
# filename= : this will get the filename relative to the top level.
72
# sum= : this will calculate the new checksum according to which
73
# one we're processing at the moment.
74
# size= : get the file's size.
75
# printf : output to the new Release file in the right format.
77
cat "$in" | { while read line; do
95
filename=$(echo $line | awk '{print $3}')
96
sum="$(echo $(gpg --print-md $hash $i-commercial/$filename | cut -d ":" -f 2 | tr [A-Z] [a-z]) | sed -e 's/ //g')"
97
size="$(ls -ls $i-commercial/$filename | awk '{print $6}')"
98
printf " %s %*d %s\n" "$sum" 16 "$size" "$filename"
107
# cd into the real archive or die.
108
cd "$archiveurl/dists/" || exit 1
110
# We do this only for distroseries that we need to process.
111
for i in $compatreleases; do
113
# Nuke the old commercial pocket.
114
rm -rf "$i-commercial"
115
# Clone with the new one to import all the Packages and dir structure.
116
cp -rp "$i" "$i-commercial"
117
# Nuke the old signature that would be invalid anyway.
118
rm -f "$i-commercial/Release.gpg"
119
# Rename section from partner to main.
120
mv $i-commercial/partner $i-commercial/main
121
# Fix all Release files.
122
find "$i-commercial" -name "Release" | { while read line; do
123
fixrelease $line $line.new
126
# Top level needs more love (*sums, file size)
127
fixtoprelease "$i-commercial/Release" "$i-commercial/Release.new" "$i"
128
mv "$i-commercial/Release.new" "$i-commercial/Release"
129
# Sign the Release file
130
gpg --armour --output "$i-commercial/Release.gpg" --detach-sign "$i-commercial/Release"