User Tools

Site Tools


re-build_repository_index

This is an old revision of the document!


Rebuild repository index (YUM)

this script will regenerate repository index.

#!/bin/bash
#
# Regenerate index for all High level folders in Repository.
# You can specify Location for repository in array.
#
# Developed by k2patel (k2patel@hotmail.com)
# For rpm.k2patel.in
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 
# Add all location for repository.
 
Location=(/var/www/html/RHEL/6 /var/www/html/EPEL/5 /var/www/html/EPEL/6 /var/www/html/puppet/el6)
 
## Do not modify further ##
 
for index in ${!Location[*]}
do
    for dir in `ls ${Location[$index]}`
        do
          if [ -d ${Location[$index]}/$dir ]; then
            echo -n "Rebuilding index for ${Location[$index]}/$dir....."
            createrepo --update ${Location[$index]}/$dir
            echo "Done"
          else
            echo "Not a valid folder : ${Location[$index]}/$dir"
          fi
        done
done
re-build_repository_index.1374691841.txt.gz · Last modified: 2020/08/10 02:29 (external edit)