2 if [ "$(id -u)" != "0" -o $HOME != "/root" ]; then
3 echo "This script must be run as root (not sudo) to perform package singning." 1>&2
7 if test ! -f ~/.rpmmacros; then
8 echo "$0: Make sure ~/.rpmmacros file exsits and contains macros from git-tools/update-archive/root-rpmmacros"
12 if test ! -x /usr/bin/createrepo; then
13 echo "$0: /usr/bin/createrepo missing. Install createrepo"
17 if test ! -x /usr/bin/gpg; then
18 echo "$0: /usr/bin/gpg missing. Install gpg"
22 #check if root has rpm macros
25 architectures="i386 x86_64"
26 for vdist in centos/5.5 rhel/5.5; do
27 dist=`basename $vdist`
28 vendor=`dirname $vdist`
29 ftpdir=/home/ftp/pub/yum/$vendor/$dist
30 if test ! -d $ftpdir; then
31 echo "$ftpdir does not exist"
36 for section in main restricted; do
39 if test ! -d $d; then mkdir -p $d; fi
40 if test ! -d $d/SRPMS; then mkdir -p $d/SRPMS; fi
41 # Remove invalid symlinks (SRPMS, i386, x86_64,..)
42 for l in $d/SRPMS/*; do
44 if test ! -f "$l"; then
49 for arch in $architectures; do
50 for l in $d/$arch/Packages/*; do
52 if test ! -f "$l"; then
58 # Make symlinks from the regular FTP archive
60 for pdir in /home/ftp/pub/*; do
62 if test -f $pdir/.htaccess -a $section != "main"; then
65 if test ! -f $pdir/.htaccess -a $section = "main"; then
69 distdir=$pdir/redhat/$vendor/$dist
70 if test -d $distdir; then
71 if test -d $distdir/SRPMS; then
72 for f in $distdir/SRPMS/*.src.rpm; do
78 for arch in $architectures; do
79 mkdir -p $d/${arch}/Packages
80 for f in $distdir/RPMS/${arch}/*.rpm $distdir/RPMS/noarch/*.rpm; do
83 ln -sf $f $d/${arch}/Packages/
87 createrepo --update $d/${arch}
88 if test -f $d/${arch}/repodata/repomd.xml.asc; then
89 rm $d/${arch}/repodata/repomd.xml.asc
91 gpg --detach-sign -u "Index Data" --armor $d/${arch}/repodata/repomd.xml