repo-build 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/bash
  2. if [[ "$1" != "" ]];then
  3. override=true;
  4. else
  5. override=false;
  6. fi;
  7. root="$(dirname $BASH_SOURCE)/..";
  8. . $root/etc/packages.conf
  9. for val in "${packages[@]}"; do
  10. unset package;
  11. declare -A package;
  12. eval "package=($val)";
  13. name=${package[name]};
  14. echo "Checking $name";
  15. echo -e "\tChecking for updates";
  16. cd $root/src/$name/src;
  17. case ${package[type]} in
  18. git)
  19. git reset --hard > /dev/null;
  20. expect -c "
  21. set timeout 1
  22. log_user 0
  23. spawn git pull
  24. expect \"Already up-to-date.\" {
  25. exit 1
  26. }
  27. log_user 1
  28. expect eof {
  29. exit 0
  30. }
  31. }";
  32. rc=$?;
  33. if [[ $rc == 0 ]];then
  34. build=true;
  35. else
  36. build=false;
  37. fi;
  38. ;;
  39. svn)
  40. svn revert . -R;
  41. if [[ "$(svn info -r HEAD | grep -i "Last Changed Rev")" != "$(svn info | grep -i "Last Changed Rev")" ]];then
  42. svn update;
  43. build=true;
  44. else
  45. build=false;
  46. fi;
  47. ;;
  48. *)
  49. echo -e "\tType '${package[type]}' not implemented.";
  50. build=false;
  51. esac;
  52. if $build;then
  53. echo -e "\tUpdated";
  54. else
  55. echo -e "\tUp to Date";
  56. fi;
  57. cd $root/src/$name;
  58. if ! ls $name-*-i686.pkg.tar.xz &> /dev/null || $build || $override;then
  59. echo -e "\tBuilding";
  60. ./build.sh
  61. fi;
  62. echo -e "\tDone"
  63. done;