.gitcheck 841 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. # SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
  3. # SPDX-License-Identifier: GPL-3.0-only
  4. Set_placeholder(){
  5. # Check if username and or email is set.
  6. if ! git config user.name || git config user.email ; then
  7. git config user.name || git config user.name 'lbmkplaceholder'
  8. git config user.email || git config user.email 'placeholder@lbmkplaceholder.com'
  9. fi
  10. }
  11. Clean(){
  12. if [ "$(git config user.name)" = "lbmkplaceholder" ]; then
  13. git config --unset user.name
  14. fi
  15. if [ "$(git config user.email)" = "placeholder@lbmkplaceholder.com" ]; then
  16. git config --unset user.email
  17. fi
  18. }
  19. Run(){
  20. if [ "${1}" = "clean" ]; then
  21. Clean
  22. else
  23. Set_placeholder
  24. # Check coreboot as well to prevent errors during building
  25. if [ -d coreboot ]; then
  26. cd coreboot
  27. Set_placeholder
  28. cd -
  29. fi
  30. fi
  31. }
  32. Run >/dev/null