This shows you the differences between two versions of the page.
re-build_repository_index [2013/07/25 22:46] k2patel |
re-build_repository_index [2020/08/10 02:35] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== 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 (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 | ||
- | </code> | ||
- | |||
- | <note warning>If you are using mix versions of OS Version it is advisable to add switch "**-s sha**" or "**-s md5**". As from EL6 to EL5 it could cause error "//[Errno -3] Error performing checksum//" </note> |