首次提交
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#!/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 >/dev/console 2>&1 <<EOF
|
||||
#echo 'TOOLBOX_BIND=${TOOLBOX_BIND} --private-users-chown' | sort -u - ~/.toolboxrc > ~/.toolboxrc # set toolbox user to jetdev, instead of root
|
||||
|
||||
tmpf=$(tempfile)
|
||||
cat > $tmpf <<EOF
|
||||
cd ${container_mount_root}$PWD # change to mounted dir where wrapper script was called at
|
||||
|
||||
ln -sf ${container_mount_root}/home/jetdev/.gitconfig ~
|
||||
# add ssh key to container's known hosts (suppressing duplicate keys)
|
||||
echo '[mlat.jetvision.de]:22000 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICxkgXuLxErBKbGPlAEk4UiTdoZECclKG8W83NuvO39Y' | sort -u - ~/.ssh/known_hosts > ~/.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
|
||||
Reference in New Issue
Block a user