/usr/lib/fai/get-config-dir-git is in fai-client 4.0.8~deb7u1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #!/bin/bash
# (c) 2002-2006 Henning Glawe <glaweh@debian.org>
# (c) 2007 Holger Levsen <holger@layer-acht.org> for the modifications to use git
# (c) 2011 Michael Goetze <mgoetze@mgoetze.net>
### BEGIN SUBROUTINE INFO
# Provides-Var: $GIT_WORK_TREE $GIT_DIR
# Requires-Var: $FAI_CONFIG_SRC $FAI $LOGDIR
# Suggests-Var:
# Short-Description: get $FAI from a git repository.
### END SUBROUTINE INFO
# matched string: "git://gitpath"
protocol=$(expr match "$FAI_CONFIG_SRC" '\([^:]*\)://')
gitpath=$(expr match "$FAI_CONFIG_SRC" '[^:]*://\([^[:space:]#]\+\)')
gitbranch=$(expr match "$FAI_CONFIG_SRC" '[^#]*#\([^[:space:]]\+\)')
[ -n "$gitbranch" ] || gitbranch=master
case $protocol in
git)
giturl="git://$gitpath"
;;
git+*)
giturl="${protocol:4}://$gitpath"
;;
*)
echo "get-config-dir-git: protocol should be git or start with git+"
exit 1
;;
esac
export GIT_WORK_TREE="$FAI"
export GIT_DIR="$FAI/.git"
_git_checkout() {
git checkout -f "origin/$gitbranch"
task_error 882 $?
git clean -df
task_error 882 $?
}
if [ -d "$GIT_DIR" ]; then
if [ `git remote show -n origin | egrep -m1 -o '[^[:space:]]+://.+'` == "$giturl" ]; then
echo "Updating git copy in $FAI"
git fetch
task_error 881 $?
_git_checkout
else
echo "$FAI already contains a git repository, but it is not from $giturl!" >&2
echo "Please delete $FAI manually. Aborting..." >&2
task_error 883
fi
else
echo "Checking out from git"
# cloning into an existing directory is not allowed
[ -d $FAI ] && rm -rf $FAI
git clone --branch "$gitbranch" "$giturl" $FAI
task_error 882 $?
_git_checkout
fi
|