3 # This code is licensed under the GPL version 2 or later. See
4 # the COPYING file in the top-level directory.
6 substat
=".git-submodule-status"
12 test -z "$GIT" && GIT
=git
17 echo "Unable to automatically checkout GIT submodules '$modules'."
18 echo "If you require use of an alternative GIT binary (for example to"
19 echo "enable use of a transparent proxy), then please specify it by"
20 echo "running configure by with the '--with-git' argument. e.g."
22 echo " $ ./configure --with-git='tsocks git'"
24 echo "Alternatively you may disable automatic GIT submodule checkout"
27 echo " $ ./configure --disable-git-update"
29 echo "and then manually update submodules prior to running make, with:"
31 echo " $ scripts/git-submodule.sh update $modules"
37 for m
in $maybe_modules
39 $GIT submodule status
$m 1> /dev
/null
2>&1
44 echo "warn: ignoring non-existent submodule $m"
48 if test -n "$maybe_modules" && ! test -e ".git"
50 echo "$0: unexpectedly called with submodules but no git checkout exists"
56 if test -z "$maybe_modules"
58 test -s ${substat} && exit 1 ||
exit 0
61 test -f "$substat" ||
exit 1
62 for module
in $modules; do
63 CURSTATUS
=$
($GIT submodule status
$module)
64 OLDSTATUS
=$
(cat $substat |
grep $module)
65 if test "$CURSTATUS" != "$OLDSTATUS"; then
72 if test -z "$maybe_modules"
74 test -e $substat ||
touch $substat
78 $GIT submodule update
--init $modules 1>/dev
/null
79 test $?
-ne 0 && error
"failed to update modules"
81 $GIT submodule status
$modules > "${substat}"
82 test $?
-ne 0 && error
"failed to save git submodule status" >&2