GIT="git --no-pager" GITPARAM="--color=always" RSYNC="rsync -a --info=NAME --delete --exclude=.git --exclude=.gitignore" export LC_ALL="C" declare -a git_repositories echo $git_repositories function in_git_repositories { for entry in "${git_repositories[@]}"; do [[ "$entry" == "$1" ]] && echo "found"; done } function mod_install { group=$1 shift #echo $group declare excluded excluded_string="" while (( "$#" )); do if [ ${1:0:10} == '--exclude=' ]; then excluded=(${excluded[@]} ${1#--exclude=*}) excluded_string="$excluded_string $1" shift else break fi done #echo "excluded files:" ${excluded[@]} function in_excluded { for entry in "${excluded[@]}"; do [[ "$entry" == "$1" ]] && echo "found"; done } declare sync_list if [ "$#" == "0" ]; then sync_list=("$group"/*) else sync_list=(${@}) fi #echo "sync_list:" ${sync_list[@]} for mod in ${sync_list[@]}; do #echo "mod:" $mod if [ -d "$mod" ] && [ -z "$(in_excluded "$(basename $mod)")" ]; then echo "Process repo $mod" cd "$mod" GIT_REPO="$(git remote -v | grep '\(fetch\)' )" #echo "GIT REPO: $GIT_REPO" if [ -z "$(in_git_repositories "$GIT_REPO")" ]; then echo '' >> "$LOG" echo "$GIT_REPO" >> "$LOG" git branch -vv | grep '^[*]' >> "$LOG" git_repositories=(${git_repositories[@]} "$GIT_REPO") fi echo "Mod: $mod" >> "$LOG" cd - >/dev/null $RSYNC $excluded_string "$SRC"/"$mod" "$DST"/"$group"/ fi done } function set_package { LOG="$DST"/"$1"/mod_sources.txt cp "$DST"/build.sh "$DST"/"$1"/ rm "$LOG" 2>/dev/null git_repositories=( ) } rm "$LOG" 2>/dev/null