[Fai-commit] r6340 - trunk/lib
Michael Goetze
mgoetze-guest at alioth.debian.org
Thu Apr 14 14:05:22 UTC 2011
Author: mgoetze-guest
Date: 2011-04-14 14:05:05 +0000 (Thu, 14 Apr 2011)
New Revision: 6340
Modified:
trunk/lib/get-config-dir-git
trunk/lib/get-config-dir-hg
trunk/lib/get-config-dir-svn
Log:
get-config-dir-{svn,git}: check whether source is correct before update
Modified: trunk/lib/get-config-dir-git
===================================================================
--- trunk/lib/get-config-dir-git 2011-04-14 13:08:09 UTC (rev 6339)
+++ trunk/lib/get-config-dir-git 2011-04-14 14:05:05 UTC (rev 6340)
@@ -2,6 +2,7 @@
# (c) 2002-2006 Henning Glawe <glaweh at debian.org>
# (c) 2007 Holger Levsen <holger at layer-acht.org> for the modifications to use git
+# (c) 2011 Michael Goetze <mgoetze at mgoetze.net>
### BEGIN SUBROUTINE INFO
# Provides-Var:
@@ -28,12 +29,19 @@
exit 1
;;
esac
+
+export GIT_DIR="$FAI/.git"
if [ -d "$FAI/.git" ] ; then
- echo "Updating git copy in $FAI"
- cd $FAI
- git pull
- task_error 701 $?
+ if [ `git remote show -n origin | egrep -m1 -o '[^[:space:]]+://.+'` == "$giturl" ]; then
+ echo "Updating git copy in $FAI"
+ git pull
+ task_error 701 $?
+ else
+ echo "$FAI already contains a git repository, but it is not from $giturl!" >&2
+ echo "Please delete $FAI manually. Aborting..." >&2
+ task_error 703
+ fi
else
echo "Checking out from git"
# cloning into an existing directory is not allowed
Modified: trunk/lib/get-config-dir-hg
===================================================================
--- trunk/lib/get-config-dir-hg 2011-04-14 13:08:09 UTC (rev 6339)
+++ trunk/lib/get-config-dir-hg 2011-04-14 14:05:05 UTC (rev 6340)
@@ -27,6 +27,7 @@
esac
if [ -d "$FAI/.hg" ] ; then
+ #TODO: check whether the checkout is from $hgurl
echo "Updating hg copy in $FAI"
cd $FAI
hg pull
Modified: trunk/lib/get-config-dir-svn
===================================================================
--- trunk/lib/get-config-dir-svn 2011-04-14 13:08:09 UTC (rev 6339)
+++ trunk/lib/get-config-dir-svn 2011-04-14 14:05:05 UTC (rev 6340)
@@ -1,6 +1,7 @@
#!/bin/bash
# (c) 2002-2006 Henning Glawe <glaweh at debian.org>
+# (c) 2011 Michael Goetze <mgoetze at mgoetze.net>
### BEGIN SUBROUTINE INFO
# Provides-Var:
@@ -47,16 +48,24 @@
exit 1
;;
esac
-
+
+user=
[ -n "$username" ] && user="--username $username"
if [ -d "$FAI/.svn" ] ; then
- echo "Updating SVN in $FAI"
- cd $FAI
- svn up $user $pass | grep -v 'Updated to revision' > $LOGDIR/getconf.log
- task_error 701 ${PIPESTATUS[0]}
+ if [ `svn info $FAI | egrep -m1 -o '://.+'` == "://$svnpath" ]; then
+ echo "Updating SVN in $FAI"
+ cd $FAI
+ svn up $user $pass | grep -v 'Updated to revision' > $LOGDIR/getconf.log
+ task_error 701 ${PIPESTATUS[0]}
+ else
+ echo "$FAI already contains a svn repository, but it is not from $svnurl!" >&2
+ echo "Please delete $FAI manually. Aborting..." >&2
+ task_error 703
+ fi
else
echo "Checking out SVN"
svn co $user $pass $svnurl $FAI | grep -v 'Checked out revision' > $LOGDIR/getconf.log
task_error 702 ${PIPESTATUS[0]}
fi
+
More information about the Fai-commit
mailing list