This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
catalyst_packages.sh
executable file
·151 lines (124 loc) · 3.89 KB
/
catalyst_packages.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/bash
#
# Builds and releases Mahara to the debian repo
#
# This script can release just one version (stable|unstable), or both at once
#
set -e
BUILDDIR="/tmp/mahara/release"
REPODIR="/tmp/mahara/repo"
ARCHLIST="i386 amd64"
DATE="`date`"
echo " *** STOP *** "
echo " Make sure you have merged master into pkg-catalyst, and the latest"
echo " stable branch into the appropriate pkg-catalyst-* branch. If you"
echo " have not done this, hit Ctrl-C now and do so."
read junk
RELEASE=$1
if [ "$RELEASE" = "" ]; then
echo -n "Building ALL versions: are you sure? (y/N) "
read ANS
if [ "$ANS" != "y" ] && [ "$ANS" != "Y" ]; then
echo "Abort."
exit 1
fi
RELEASELIST="stable unstable"
elif [ "$RELEASE" != "stable" ] && [ "$RELEASE" != "unstable" ]; then
echo "Invalid release: $RELEASE"
exit 1
else
RELEASELIST=$RELEASE
fi
if [ -d ${BUILDDIR} ]; then
rm -rf ${BUILDDIR}
fi
if [ -d ${REPODIR} ]; then
rm -rf ${REPODIR}
fi
mkdir -p ${BUILDDIR}
# Create repo dirs
for release in $RELEASELIST; do
mkdir -p ${REPODIR}/dists/${release}/mahara
pushd ${REPODIR}/dists/${release}/mahara
mkdir binary-all
for arch in ${ARCHLIST}; do mkdir binary-${arch}; done
popd
mkdir -p ${REPODIR}/pool/${release}
done
pushd ${BUILDDIR}
# Get a checkout of Mahara for working with, and find out what the stable
# release is currently
git clone -n "git+ssh://git.catalyst.net.nz/git/public/mahara.git" mahara
pushd mahara
STABLE_RELEASE="`ls -1 .git/refs/tags | egrep '[0-9]+\.[0-9]+\.[0-9]+_RELEASE$' | tail -n1`"
STABLE_DEBIAN_BRANCH=${STABLE_RELEASE:0:3}
popd
# Build Stable
if [ "$RELEASE" = "" ] || [ "$RELEASE" = "stable" ]; then
echo
echo "Building ${STABLE_RELEASE} ..."
pushd ${BUILDDIR}/mahara
git checkout -b "pkg-catalyst-${STABLE_DEBIAN_BRANCH}" "origin/pkg-catalyst-${STABLE_DEBIAN_BRANCH}"
make
popd
mv *.deb ${REPODIR}/pool/stable/
fi
# Build Unstable
if [ "$RELEASE" = "" ] || [ "$RELEASE" = "unstable" ]; then
echo
echo "Building Unstable ..."
pushd ${BUILDDIR}/mahara
git checkout -b pkg-catalyst origin/pkg-catalyst
make
popd
mv *.deb ${REPODIR}/pool/unstable/
fi
# Link other arches into all and build packages
for release in $RELEASELIST; do
pushd ${REPODIR}/pool
for arch in all ${ARCHLIST}; do
dpkg-scanpackages ${release} /dev/null /pool/ | /bin/gzip -9 > ${REPODIR}/dists/${release}/mahara/binary-${arch}/Packages.gz
dpkg-scanpackages ${release} /dev/null /pool/ > ${REPODIR}/dists/${release}/mahara/binary-${arch}/Packages
done
popd
pushd ${REPODIR}/dists/${release}
# Create Release file
cat <<EOHDR >Release
Origin: Mahara
Label: Mahara
Suite: ${release}
Date: ${DATE}
Architectures: ${ARCHLIST}
Components: mahara
Description: Mahara ${release} repository
MD5Sum:
EOHDR
for file in `find mahara -type f -name 'Packages*'`; do
MD5="`md5sum $file | cut -c1-32`"
SIZE="`cat $file | wc -c`"
printf " %s %16d %s\n" "${MD5}" "${SIZE}" "${file}" >>Release
done
gpg --yes --armour --sign-with 1D18A55D --detach-sign --output Release.gpg Release
popd
done
# Steal the latest index.html and dump into
pushd ${BUILDDIR}/mahara
git cat-file blob origin/pkg-catalyst:debian/index.html > ${REPODIR}/index.html
popd
popd
# Now (optionally) sync the repo to the git repository
echo " The repo has now been set up in ${REPODIR}. If you're really sure,"
echo " this script can rsync this to the git repository."
echo " rsync to git repository? [y/N] "
read ANS
if [ "$ANS" != "y" ] && [ "$ANS" != "Y" ]; then
echo "Abort."
exit 1
fi
if [ "$RELEASE" = "" ]; then
rsync -PIlvr --delete-after --no-p --no-g --chmod=Dg+ws,Fg+w ${REPODIR}/* locke.catalyst.net.nz:/home/ftp/pub/mahara/
else
rsync -PIlvr --no-p --no-g --chmod=Dg+ws,Fg+w ${REPODIR}/* locke.catalyst.net.nz:/home/ftp/pub/mahara/
fi
rm -rf ${BUILDDIR}
rm -rf ${REPODIR}