#!/bin/bash if [[ "$1" != "" ]];then override=true; else override=false; fi; root="$(dirname $BASH_SOURCE)/.."; . $root/etc/packages.conf for val in "${packages[@]}"; do unset package; declare -A package; eval "package=($val)"; name=${package[name]}; echo "Checking $name"; echo -e "\tChecking for updates"; cd $root/src/$name/src; case ${package[type]} in git) git reset --hard > /dev/null; expect -c " set timeout 1 log_user 0 spawn git pull expect \"Already up-to-date.\" { exit 1 } log_user 1 expect eof { exit 0 } }"; rc=$?; if [[ $rc == 0 ]];then build=true; else build=false; fi; ;; svn) svn revert . -R; if [[ "$(svn info -r HEAD | grep -i "Last Changed Rev")" != "$(svn info | grep -i "Last Changed Rev")" ]];then svn update; build=true; else build=false; fi; ;; *) echo -e "\tType '${package[type]}' not implemented."; build=false; esac; if $build;then echo -e "\tUpdated"; else echo -e "\tUp to Date"; fi; cd $root/src/$name; if ! ls $name-*-i686.pkg.tar.xz &> /dev/null || $build || $override;then echo -e "\tBuilding"; ./build.sh fi; echo -e "\tDone" done;