mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
700a0d702d
The -n flag is a non-standard flag and should not be used in scripts. See https://man.openbsd.org/FreeBSD-11.1/mv#COMPATIBILITY.
30 lines
646 B
Bash
Executable File
30 lines
646 B
Bash
Executable File
#! /bin/sh
|
|
|
|
if [ $# = 0 ]; then
|
|
echo "Usage: $0 <submoduledir1>..." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# git submodule can't run in parallel. Really.
|
|
if ! mkdir .refresh-submodules 2>/dev/null ; then
|
|
exit 0
|
|
fi
|
|
|
|
trap "rmdir .refresh-submodules" EXIT
|
|
|
|
# Be a little careful here, since we do rm -rf!
|
|
for m in "$@"; do
|
|
if ! grep -q "path = $m\$" .gitmodules; then
|
|
echo "$m is not a submodule!" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
# git submodule can segfault. Really.
|
|
if [ "$(git submodule status "$@" | grep -c '^ ')" != $# ]; then
|
|
echo Reinitializing submodules "$@" ...
|
|
git submodule sync "$@"
|
|
rm -rf "$@"
|
|
git submodule update --init "$@"
|
|
fi
|