2023-05-18 12:17:28 +00:00
|
|
|
#!/usr/bin/env sh
|
2022-03-15 18:02:04 +00:00
|
|
|
# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
2023-05-18 08:35:26 +00:00
|
|
|
# SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org>
|
2022-03-15 18:02:04 +00:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
|
2023-05-18 08:35:26 +00:00
|
|
|
git_name="lbmkplaceholder"
|
|
|
|
git_email="placeholder@lbmkplaceholder.com"
|
|
|
|
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
if [ $# -gt 0 ]; then
|
|
|
|
if [ "${1}" = "clean" ]; then
|
2023-05-18 08:55:40 +00:00
|
|
|
clean > /dev/null 2> /dev/null
|
|
|
|
else
|
|
|
|
printf "%s: Unsupported argument\n" $0
|
|
|
|
exit 1
|
2023-05-18 08:35:26 +00:00
|
|
|
fi
|
|
|
|
else
|
2023-05-18 08:55:40 +00:00
|
|
|
set_placeholders > /dev/null 2> /dev/null
|
2023-05-18 08:41:00 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
set_placeholders()
|
|
|
|
{
|
|
|
|
set_git_credentials
|
|
|
|
|
|
|
|
# Check coreboot as well to prevent errors during building
|
2023-05-18 08:42:06 +00:00
|
|
|
if [ ! -d coreboot ]; then
|
|
|
|
return
|
2023-05-18 08:35:26 +00:00
|
|
|
fi
|
2023-05-18 08:42:06 +00:00
|
|
|
for x in coreboot/*; do
|
|
|
|
if [ ! -d "${x}" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2023-05-18 08:49:26 +00:00
|
|
|
(
|
2023-05-18 08:42:06 +00:00
|
|
|
cd "${x}"
|
|
|
|
set_git_credentials
|
2023-05-18 08:49:26 +00:00
|
|
|
)
|
2023-05-18 08:42:06 +00:00
|
|
|
done
|
2023-05-18 08:35:26 +00:00
|
|
|
}
|
|
|
|
|
2023-05-18 08:41:00 +00:00
|
|
|
set_git_credentials()
|
2023-05-18 08:35:26 +00:00
|
|
|
{
|
2022-11-21 02:42:31 +00:00
|
|
|
# Check if username and or email is set.
|
|
|
|
if ! git config user.name || git config user.email ; then
|
2023-05-18 08:35:26 +00:00
|
|
|
git config user.name \
|
|
|
|
|| git config user.name "${git_name}"
|
|
|
|
git config user.email \
|
|
|
|
|| git config user.email "${git_email}"
|
2022-11-21 02:42:31 +00:00
|
|
|
fi
|
2022-03-15 18:02:04 +00:00
|
|
|
}
|
|
|
|
|
2023-05-18 08:35:26 +00:00
|
|
|
clean()
|
2023-05-18 08:44:11 +00:00
|
|
|
{
|
|
|
|
unset_placeholders
|
|
|
|
|
|
|
|
if [ ! -d coreboot ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
for x in coreboot/*; do
|
|
|
|
if [ ! -d "${x}" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2023-05-18 08:49:26 +00:00
|
|
|
(
|
2023-05-18 08:44:11 +00:00
|
|
|
cd "${x}"
|
|
|
|
unset_placeholders
|
2023-05-18 08:49:26 +00:00
|
|
|
)
|
2023-05-18 08:44:11 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
unset_placeholders()
|
2023-05-18 08:35:26 +00:00
|
|
|
{
|
|
|
|
if [ "$(git config user.name)" = "${git_name}" ]; then
|
2022-03-15 18:02:04 +00:00
|
|
|
git config --unset user.name
|
|
|
|
fi
|
|
|
|
|
2023-05-18 08:35:26 +00:00
|
|
|
if [ "$(git config user.email)" = "${git_email}" ]; then
|
2022-03-15 18:02:04 +00:00
|
|
|
git config --unset user.email
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-05-18 08:55:40 +00:00
|
|
|
main $@
|