@@ -6,17 +6,18 @@ export TOOL_DIR=${TOOL_DIR:-/opt/tools/git}
66
77mkdir -p $TOOL_DIR $TOOL_DIR /bin $TOOL_DIR /lib $TOOL_DIR /libexec $TOOL_DIR /share
88
9- cp -r ./bin $TOOL_DIR /bin
10- cp -r ./lib $TOOL_DIR /lib
11- cp -r ./libexec $TOOL_DIR /libexec
12- cp -r ./share $TOOL_DIR /share
9+ if [ " $( pwd -P) " != " $TOOL_DIR " ]; then
10+ cp -r ./bin " $TOOL_DIR /bin"
11+ cp -r ./lib " $TOOL_DIR /lib"
12+ cp -r ./libexec " $TOOL_DIR /libexec"
13+ cp -r ./share " $TOOL_DIR /share"
14+ else
15+ printf ' Skipping copy: current directory is %s\n' " $TOOL_DIR " >&2
16+ fi
1317
14- ln -s $TOOL_DIR /bin/git /usr/local/bin/git
15- ln -s $TOOL_DIR /bin/git-cvsserver /usr/local/bin/git-cvsserver
16- ln -s $TOOL_DIR /bin/git-remote-http /usr/local/bin/git-remote-http
17- ln -s $TOOL_DIR /bin/git-remote-https /usr/local/bin/git-remote-https
18- ln -s $TOOL_DIR /bin/git-shell /usr/local/bin/git-shell
19- ln -s $TOOL_DIR /bin/git-upload-archive /usr/local/bin/git-upload-archive
20- ln -s $TOOL_DIR /bin/git-upload-pack /usr/local/bin/git-upload-pack
21- ln -s $TOOL_DIR /bin/gitk /usr/local/bin/gitk
22- ln -s $TOOL_DIR /bin/scalar /usr/local/bin/scalar
18+ for f in " $TOOL_DIR /bin" /* ; do
19+ [ -e " $f " ] || continue # skip if glob didn't match
20+ [ -d " $f " ] && continue # skip directories
21+ name=" ${f##*/ } "
22+ ln -sf " $f " " /usr/local/bin/$name "
23+ done
0 commit comments