3 # Copyright 2008, Elirion, Inc. All rights reserved.
4 # This software is licensed under the same terms as Freeside itself.
6 # This script iterates through all the specified Freeside repositories, running
7 # both yum-arch and createrepo to update the yum repository meta-data.
8 # The script should be run after the repository contents are changed.
10 # TBD: Run yum-arch, createrepo, or both, as appropriate for the distro and version
11 # the repository is targetted for.
19 REPOS='testing stable prerelease'
24 REPOBASEFOLDER=/var/www/html
28 BUILDSYSDIR=`dirname $0`
30 if [ -f $HOME/buildsysrc ]; then
35 echo "refresh-repo: refresh yum metadata for all yum repositories"
37 echo " -a <archs>: change architectures (currently: $ARCHS)"
38 echo " -d <distros>: change distributions (currently: $DISTROS)"
39 echo " -r <repos>: change repositories (currently: $REPOS)"
40 echo " -v <versions>: change versions (currently: $VERSIONS)"
41 echo " -w <distvers>: change distro version (currently: $WHICHVERS)"
45 while getopts "a:d:hqr:v:w:" flag
49 echo "Changing architectures from $ARCHS to $OPTARG"
52 echo "Changing distros from $DISTROS to $OPTARG"
58 echo "Changing repository from $REPOS to $OPTARG"
61 echo "Changing versions from $VERSIONS to $OPTARG"
64 echo "Changing which distro versions from $WHICHVERS to $OPTARG"
71 #for DISTRO in ${DISTROS}; do
72 # for VERSION in ${VERSIONS}; do
73 # for REPO in ${REPOS}; do
74 # for ARCH in ${ARCHS}; do
75 # # Determine which RPMs need to be signed
76 # NEWRPMS=`rpm --checksig $REPOBASEFOLDER/repo/$DISTROS/$DISTVERS/freeside-${VERSION}/${REPO}/${ARCH}/*.rpm | grep -v ' gpg ' | cut -d ':' -f 1 | tr '\n' ' '`
77 # RPMS=`echo "$RPMS $NEWRPMS"`
84 # ./expect-addsign $RPM
86 for DISTRO in ${DISTROS}; do
87 for VERSION in ${VERSIONS}; do
88 for REPO in ${REPOS}; do
89 for ARCH in ${ARCHS}; do
90 if [ "${WHICHVERS}x" = "x" ]; then
91 if [ "$DISTRO" = "centos" ]; then
94 if [ "$DISTRO" = "sles" ]; then
100 for distver in $DISTVERS
102 # Update the repo information
103 echo "${DISTRO}-${distver}: $VERSION - $REPO - $ARCH"
104 DIR=$REPOBASEFOLDER/repo/$DISTRO/$distver/freeside-${VERSION}/${REPO}/${ARCH}
107 # SLES requires signed repodata. Save any existing files so we don't regenerate
110 if [ -e $DIR/repodata/repomd.xml.${ext} ]
112 mv $DIR/repodata/repomd.xml.${ext} $SAVEDIR
115 if [ "$DISTRO" = "sles" ]
117 for file in $DIR/freeside-mysql-*.rpm
121 for file in $DIR/freeside-selfservice-*.rpm
123 mv $file $DIR/../self-service/$ARCH
126 if [ "$DISTRO-$distver" = "centos-4" ]
128 yum-arch $QUIET_FLAG $DIR/
130 # createrepo $QUIET_FLAG --checkts $DIR/
131 createrepo $QUIET_FLAG $DIR/
132 if [ "$DISTRO" = "sles" ]
134 # SLES requires signed repodata...
135 if [ -e $SAVEDIR/repomd.xml.asc ]
137 mv $SAVEDIR/repomd.xml.asc $DIR/repodata
140 # gpg -sab --yes -u "$KEYID" -o $DIR/repodata/repomd.xml.asc $DIR/repodata/repomd.xml
141 ./expect-signrepo $KEYID $DIR/repodata/repomd.xml.asc $DIR/repodata/repomd.xml
142 if [ -e $SAVEDIR/repomd.xml.key ]
144 mv $SAVEDIR/repomd.xml.key $DIR/repodata
146 gpg -a --yes -u "$KEYID" --export -o $DIR/repodata/repomd.xml.key
150 echo "No such folder $DIR - skipping"