CRUX REPO Script

Following bash script generates the REPO file for httpup ports tree.

Usage:

Place this script on the root of the ports tree directory (where REPO file suppose to be) and execute it.

build-repo
  1. #!/bin/bash
  2. #
  3. # build-repo: Build the REPO file
  4. # Copyright Sudaraka Wijesinghe <sudaraka dot wijesinghe at gmail dot com>
  5. #
  6. #  This program is free software: you can redistribute it and/or modify
  7. #  it under the terms of the GNU General Public License as published by
  8. #  the Free Software Foundation, either version 3 of the License, or
  9. #  (at your option) any later version.
  10. #
  11. #  This program is distributed in the hope that it will be useful,
  12. #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. #  GNU General Public License for more details.
  15. #
  16. #  You should have received a copy of the GNU General Public License
  17. #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. #
  20. #  USAGE: build-repo
  21. #
  22.  
  23. [ -f REPO ] && rm REPO
  24.  
  25. for dir in `find . -type d -regex "\..+" -printf "%f\n"`; do
  26. 	if [[ -f $dir/Pkgfile ]]; then
  27. 		if [[ ! -z `grep -e "^# Group:" $dir/Pkgfile` || -f $dir/.md5sum ]]; then
  28. 			echo "d:$dir" >> REPO
  29. 		else
  30. 			echo "Make sure $dir contains .md5sum";
  31. 		fi
  32. 	else
  33. 		echo "Make sure $dir contains Pkgfile";
  34. 	fi
  35. done
  36.  
  37. find . -type f -regex "\.\/.+\/.+" -exec md5sum {} \;|sed -e 's/\(.*\)\s\s\.\//f:\1:/' >> REPO