X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=setup.sh;h=8ef33df7544f137ea83635f302d480be02a078a8;hb=16b3c2e4f69bd40528175bd2949f98ff65c7adbd;hp=da3e9bde524c231dd235db7befd895062c324088;hpb=5a511574188e52137e66a73d1562ad0a1eac8067;p=config%2Fdotfiles.git diff --git a/setup.sh b/setup.sh index da3e9bd..8ef33df 100755 --- a/setup.sh +++ b/setup.sh @@ -7,7 +7,7 @@ # Creates a new git repository in $1, adds a new remote named $2 and fetches # the master on $3. If the git repository already exists a new remote $2 for # $3 is added. If the remote already exists nothing happens. -function git_remote_init_update() { +git_remote_init_update() { # Make sure the requested directory exists. mkdir -p "$1" # Go to the target directory. @@ -57,12 +57,16 @@ function git_remote_init_update() { # Run setup.sh in each project. if [ "$#" -eq "0" ]; then - for project in `find . -name .git -type d`; do + for path in `find . -name setup.sh -type f`; do # Skip this directory to prevent an infinite loop. - [ "$project" = "./.git" ] && continue + [ "$path" = "./setup.sh" ] && continue + # Skip non executable setup.sh files as an easy way to deactivate one. + [ ! -x "$path" ] && continue - [ -d "$project" ] && (echo "running setup.sh in '$project'"; - cd "$project/.."; ./setup.sh > /dev/null) + 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