Last active
September 13, 2020 15:59
-
-
Save tspng/1629f2bdfe511329086bc47888fcac1c to your computer and use it in GitHub Desktop.
git hooks & examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
OC_CONFIG="EFI/OC/config.plist" | |
HIDDEN_VALUE="__GENERATE_YOUR_OWN__" | |
MODIFIED=0 | |
hide_value() { | |
key=$1 | |
found=`grep -A1 "<key>${key}</key>" ${OC_CONFIG} | grep ${HIDDEN_VALUE} | wc -l` | |
if [ $found -eq 0 ]; then | |
# Value of $key is not hidden yet. Let's replace it inline. | |
echo "Will hide value of <key>${key}</key> in ${OC_CONFIG}." | |
sed -i '' -e "/<key>${key}<\/key>/{" -e "n;s/<\(.*\)>.*<\/\(.*\)>/<\1>${HIDDEN_VALUE}<\/\2>/" -e "}" ${OC_CONFIG} | |
MODIFIED=1 | |
fi | |
} | |
hide_value "SystemUUID" | |
hide_value "SystemSerialNumber" | |
hide_value "ROM" | |
hide_value "MLB" | |
if [ $MODIFIED -eq 1 ]; then | |
echo "Please add ${OC_CONFIG} again if you want to commit it." | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment