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 $BUILDSYSDIR/buildsysrc ]; then
31 #chmod a+x $BUILDSYSDIR/buildsysrc
32 #echo $BUILDSYSDIR/buildsysrc
33 . $BUILDSYSDIR/buildsysrc
35 if [ -f $HOME/buildsysrc ]; then
36 #chmod a+x $HOME/buildsysrc
37 #echo $HOME/buildsysrc
43 echo "refresh-repo: refresh yum metadata for all yum repositories"
45 echo " -a <archs>: change architectures (currently: $ARCHS)"
46 echo " -d <distros>: change distributions (currently: $DISTROS)"
47 echo " -r <repos>: change repositories (currently: $REPOS)"
48 echo " -v <versions>: change versions (currently: $VERSIONS)"
49 echo " -w <distvers>: change distro version (currently: $WHICHVERS)"
53 while getopts "a:d:hqr:v:w:" flag
57 echo "Changing architectures from $ARCHS to $OPTARG"
60 echo "Changing distros from $DISTROS to $OPTARG"
66 echo "Changing repository from $REPOS to $OPTARG"
69 echo "Changing versions from $VERSIONS to $OPTARG"
72 echo "Changing which distro versions from $WHICHVERS to $OPTARG"
79 #for DISTRO in ${DISTROS}; do
80 # for VERSION in ${VERSIONS}; do
81 # for REPO in ${REPOS}; do
82 # for ARCH in ${ARCHS}; do
83 # # Determine which RPMs need to be signed
84 # NEWRPMS=`rpm --checksig $REPOBASEFOLDER/repo/$DISTROS/$DISTVERS/freeside-${VERSION}/${REPO}/${ARCH}/*.rpm | grep -v ' gpg ' | cut -d ':' -f 1 | tr '\n' ' '`
85 # RPMS=`echo "$RPMS $NEWRPMS"`
92 # ./expect-addsign $RPM
94 for DISTRO in ${DISTROS}; do
95 for VERSION in ${VERSIONS}; do
96 for REPO in ${REPOS}; do
97 for ARCH in ${ARCHS}; do
98 if [ "${WHICHVERS}x" = "x" ]; then
99 if [ "$DISTRO" = "centos" ]; then
102 if [ "$DISTRO" = "sles" ]; then
108 for distver in $DISTVERS
110 # Update the repo information
111 echo "${DISTRO}-${distver}: $VERSION - $REPO - $ARCH"
112 DIR=$REPOBASEFOLDER/repo/$DISTRO/$distver/freeside-${VERSION}/${REPO}/${ARCH}
115 # SLES requires signed repodata. Save any existing files so we don't regenerate
118 if [ -e $DIR/repodata/repomd.xml.${ext} ]
120 mv $DIR/repodata/repomd.xml.${ext} $SAVEDIR
123 if [ "$DISTRO" = "sles" ]
125 for file in $DIR/freeside-mysql-*.rpm
129 for file in $DIR/freeside-selfservice-*.rpm
131 mv $file $DIR/../self-service/$ARCH
134 if [ "$DISTRO-$distver" = "centos-4" ]
136 yum-arch $QUIET_FLAG $DIR/
138 # createrepo $QUIET_FLAG --checkts $DIR/
139 createrepo $QUIET_FLAG $DIR/
140 if [ "$DISTRO" = "sles" ]
142 # SLES requires signed repodata...
143 if [ -e $SAVEDIR/repomd.xml.asc ]
145 mv $SAVEDIR/repomd.xml.asc $DIR/repodata
148 # gpg -sab --yes -u "$KEYID" -o $DIR/repodata/repomd.xml.asc $DIR/repodata/repomd.xml
149 ./expect-signrepo $KEYID $DIR/repodata/repomd.xml.asc $DIR/repodata/repomd.xml
150 if [ -e $SAVEDIR/repomd.xml.key ]
152 mv $SAVEDIR/repomd.xml.key $DIR/repodata
154 gpg -a --yes -u "$KEYID" --export -o $DIR/repodata/repomd.xml.key
158 echo "No such folder $DIR - skipping"