2022-12-16 18:45:54 +00:00
|
|
|
#!/bin/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
|
|
|
|
clean
|
|
|
|
fi
|
|
|
|
else
|
2023-05-18 08:41:00 +00:00
|
|
|
set_placeholders
|
|
|
|
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
|
|
|
|
cd "${x}"
|
|
|
|
set_git_credentials
|
|
|
|
cd -
|
|
|
|
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()
|
|
|
|
{
|
|
|
|
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:35:26 +00:00
|
|
|
main $@
|