#!/bin/bash # (c) 2002-2006 Henning Glawe # (c) 2007 Holger Levsen for the modifications to use git ### BEGIN SUBROUTINE INFO # Provides-Var: # 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:]]\+\)') case $protocol in git) giturl="git://$gitpath" ;; git+http) echo git+http giturl="http://$gitpath" ;; git+ssh) echo git+ssh giturl=$gitpath ;; *) echo "get-config-dir-git: protocol $protocol not implemented" exit 1 ;; esac if [ -d "$FAI/.git" ] ; then echo "Updating git copy in $FAI" cd $FAI git pull task_error 701 $? else echo "Checking out from git" # cloning into an existing directory is not allowed if [ -d $FAI ]; then rmdir $FAI; fi git clone $giturl $FAI task_error 702 $? fi