Files
yait/bootstrap
2025-11-04 13:58:37 -05:00

45 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: BSD-3-Clause
me=$0
scriptversion="1.0.0"
version="$me $scriptversion
Copyright (C) 2025 GCK.
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law."
usage="\
Usage: $me [OPTION]...
Prepares the build enviroment
Options:
--help print this help and exit
--version output version information"
while [ $# -gt 0 ]; do
case $1 in
--help) echo "$usage"; exit 0 ;;
--version) echo "$version"; exit 0 ;;
-*)
echo "$0: Unknown option '$1'." >&2
echo "$0: Try '--help' for more information." >&2
exit 1 ;;
esac
shift
done
echo "$0: Bootstrapping from checked-out $(basename "$(git rev-parse --show-toplevel)") sources"
if [ ! -f .gitmodules ]; then
echo "$0: No .gitmodules file found. Skipping submodule initialization."
exit 0
fi
git config -f .gitmodules --get-regexp path | while read -r key path; do
echo "$0: initializing submodule '$path'..."
git submodule update --init --recursive "$path"
done