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.

<code bash> #!/bin/bash # # Regenerate index for all High level folders in Repository. # You can specify Location for repository in array. # # Developed by k2patel ([email protected]) # 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.1374691826.txt.gz · Last modified: 2013/07/24 14:50 by k2patel