summaryrefslogtreecommitdiff
path: root/bin/yum-rep-new
blob: 19b17616141b46e0113d5eeeee35a8d8e8be40fb (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
#!/bin/bash

# update redhat/fedora yum repositories
# run this from the toplevel www directory that contains data/
# specify
# - nothing to rebuild all
# - a directory containing yum dirs to rebuild for those dirs
# the argument is treated as an argument to find, so all dirs in the tree
# below your argument will trigger a regeneration

BASEDIR=data/pkg

if test ! -d $BASEDIR;
then
  echo "Please run this script from the www directory, containing $BASEDIR"
  exit 1
fi

if test  ! -z $1; then BASEDIR=$1; fi
cd $BASEDIR
# get absolute
ABSBASEDIR=`pwd`

# relative paths to repodata dirs
REPODATAS=`find * -type d -name "repodata" | sort -r`
for repodata in $REPODATAS;
do
  yum=`dirname $repodata`
  absyum=$ABSBASEDIR/$yum
  cd $absyum
  if test $absyum -nt $ABSBASEDIR/$repodata
  then
    mkdir -p /tmp/yum/gst
    echo "yum repository $BASEDIR/$yum out of date, regenerating"
    createrepo --cachedir /tmp/yum/gst .
  else
    echo "yum repository $BASEDIR/$yum is up to date"
  fi
done