#!/bin/bash # This script is a wrapper for the git binary, which calls git within a coreos toolbox container # you can alias is e.g. as follows echo "alias git='bash ~/htdocs/ci/gitToolboxWrapper.sh'" >> ~/.bashrc # KNOWN ISSUES # # * Files are created using root, but su'ing is not possible inside the container, to one must chown at the end which is costly # container_mount_root=/media/root/ # the path where the webserver root is mounted inside the toolbox container GID=$(id -g) args="$@" #toolbox --setenv=SSH_AUTH_SOCK=${container_mount_root}$SSH_AUTH_SOCK sh -c "exec bash /dev/console 2>&1 < ~/.toolboxrc # set toolbox user to jetdev, instead of root tmpf=$(tempfile) cat > $tmpf < ~/.ssh/known_hosts git lfs install --local git $(printf ' %q' "$@") #run git with the passed commandline, preserving quotes gitexit=$? chown -R $UID.$GID ${container_mount_root}$PWD exit $gitexit EOF toolbox --setenv=SSH_AUTH_SOCK=${container_mount_root}$SSH_AUTH_SOCK bash --init-file ${container_mount_root}$tmpf rm -f $tmpf