-
- # Go back to the starting directory.
- cd "$pwd"
- unset pwd
-}
-
-# Run setup.sh in each project.
-if [ "$#" -eq "0" ]; then
- for path in `find . -name setup.sh -type f`; do
- # Skip this directory to prevent an infinite loop.
- [ "$path" = "./setup.sh" ] && continue
- # Skip non executable setup.sh files as an easy way to deactivate one.
- [ ! -x "$path" ] && continue
-
- project=`echo "$path" | sed 's|/setup.sh$||'`
-
- echo "running setup.sh in '$project'"
- ( cd "$project"; ./setup.sh > /dev/null )
- done
-# Create git repository if necessary and/or additional remotes and fetch them.
-elif [ "$#" -ge "2" ]; then
- # Get name of the remote and the remote location.
- name="$1"
- remote="$2"
- # Remove $1 and $2 to get the possible subdirectories in $@.
- shift
- shift
-
- # Create the git repository if necessary and add the remotes.
- git_remote_init_update . "$name" "$remote"
- for project in $@; do
- git_remote_init_update "$project" "$name" "$remote"
- done
-# Usage message.
-else
- echo "Usage: ./setup.sh <remote-name> <git-repository> [subdirectories]*
-
-Example:
-./setup.sh nightwish ssh://user@nightwish/home/user/dotfiles shell vcs
-
-This will add the remote nightwish given by the ssh URL and fetch the master
-for dotfiles, dotfiles/shell and dotfiles/vcs if they don't exist already. If
-the remotes exist already nothing happens. This also sets up fetching/pushing
-settings so only the master is fetched and pushed."
-fi