blob: 32d07ad97e520c0e06d2a5554b2427d56893f480 (
plain)
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
152
153
154
155
156
157
158
159
160
161
162
163
164
|
#!/bin/sh
#
# Copyright 2008, Elirion, Inc. All rights reserved.
# This software is licensed under the same terms as Freeside itself.
#
# This script iterates through all the specified Freeside repositories, running
# both yum-arch and createrepo to update the yum repository meta-data.
# The script should be run after the repository contents are changed.
#
# TBD: Run yum-arch, createrepo, or both, as appropriate for the distro and version
# the repository is targetted for.
#
DISTROS='centos sles'
CENTOSVERS='4 5'
SLESVERS=10
WHICHVERS=
VERSIONS='1.7 1.9'
ARCHS='i386 x86_64'
REPOS='testing stable prerelease'
RPMS=
KEYID=rsiddall
SAVEDIR=$HOME
REPOBASEFOLDER=/var/www/html
QUIET_FLAG=
BUILDSYSDIR=`dirname $0`
if [ -f $BUILDSYSDIR/buildsysrc ]; then
#chmod a+x $BUILDSYSDIR/buildsysrc
#echo $BUILDSYSDIR/buildsysrc
. $BUILDSYSDIR/buildsysrc
fi
if [ -f $HOME/buildsysrc ]; then
#chmod a+x $HOME/buildsysrc
#echo $HOME/buildsysrc
. $HOME/buildsysrc
fi
usage() {
echo "refresh-repo: refresh yum metadata for all yum repositories"
echo "where:"
echo " -a <archs>: change architectures (currently: $ARCHS)"
echo " -d <distros>: change distributions (currently: $DISTROS)"
echo " -r <repos>: change repositories (currently: $REPOS)"
echo " -v <versions>: change versions (currently: $VERSIONS)"
echo " -w <distvers>: change distro version (currently: $WHICHVERS)"
exit 0
}
while getopts "a:d:hqr:v:w:" flag
do
case $flag in
a)
echo "Changing architectures from $ARCHS to $OPTARG"
ARCHS=$OPTARG;;
d)
echo "Changing distros from $DISTROS to $OPTARG"
DISTROS=$OPTARG;;
q)
echo "Quiet mode"
QUIET_FLAG=-q;;
r)
echo "Changing repository from $REPOS to $OPTARG"
REPOS=$OPTARG;;
v)
echo "Changing versions from $VERSIONS to $OPTARG"
VERSIONS=$OPTARG;;
w)
echo "Changing which distro versions from $WHICHVERS to $OPTARG"
WHICHVERS=$OPTARG;;
*)
usage;;
esac
done
#for DISTRO in ${DISTROS}; do
# for VERSION in ${VERSIONS}; do
# for REPO in ${REPOS}; do
# for ARCH in ${ARCHS}; do
# # Determine which RPMs need to be signed
# NEWRPMS=`rpm --checksig $REPOBASEFOLDER/repo/$DISTROS/$DISTVERS/freeside-${VERSION}/${REPO}/${ARCH}/*.rpm | grep -v ' gpg ' | cut -d ':' -f 1 | tr '\n' ' '`
# RPMS=`echo "$RPMS $NEWRPMS"`
# done
# done
# done
#done
##rpm --addsign $RPMS
#for RPM in $RPMS; do
# ./expect-addsign $RPM
#done
for DISTRO in ${DISTROS}; do
for VERSION in ${VERSIONS}; do
for REPO in ${REPOS}; do
for ARCH in ${ARCHS}; do
if [ "${WHICHVERS}x" = "x" ]; then
if [ "$DISTRO" = "centos" ]; then
DISTVERS=$CENTOSVERS
fi
if [ "$DISTRO" = "sles" ]; then
DISTVERS=$SLESVERS
fi
else
DISTVERS=$WHICHVERS
fi
for distver in $DISTVERS
do
# Update the repo information
echo "${DISTRO}-${distver}: $VERSION - $REPO - $ARCH"
DIR=$REPOBASEFOLDER/repo/$DISTRO/$distver/freeside-${VERSION}/${REPO}/${ARCH}
if [ -d $DIR ]
then
# SLES requires signed repodata. Save any existing files so we don't regenerate
for ext in asc key
do
if [ -e $DIR/repodata/repomd.xml.${ext} ]
then
mv $DIR/repodata/repomd.xml.${ext} $SAVEDIR
fi
done
if [ "$DISTRO" = "sles" ]
then
for file in $DIR/freeside-mysql-*.rpm
do
mv $file $file.old
done
for file in $DIR/freeside-selfservice-*.rpm
do
mv $file $DIR/../self-service/$ARCH
done
fi
if [ "$DISTRO-$distver" = "centos-4" ]
then
yum-arch $QUIET_FLAG $DIR/
fi
# createrepo $QUIET_FLAG --checkts $DIR/
createrepo $QUIET_FLAG $DIR/
if [ "$DISTRO" = "sles" ]
then
# SLES requires signed repodata...
if [ -e $SAVEDIR/repomd.xml.asc ]
then
mv $SAVEDIR/repomd.xml.asc $DIR/repodata
fi
# gpg -sab --yes -u "$KEYID" -o $DIR/repodata/repomd.xml.asc $DIR/repodata/repomd.xml
./expect-signrepo $KEYID $DIR/repodata/repomd.xml.asc $DIR/repodata/repomd.xml
if [ -e $SAVEDIR/repomd.xml.key ]
then
mv $SAVEDIR/repomd.xml.key $DIR/repodata
else
gpg -a --yes -u "$KEYID" --export -o $DIR/repodata/repomd.xml.key
fi
fi
else
echo "No such folder $DIR - skipping"
fi
done
done
done
done
done
|