Last active
July 24, 2019 13:47
-
-
Save dominickp/97496d6cb8921ddc9d4a to your computer and use it in GitHub Desktop.
Switch scripting .sscript inflating pre-commit hook
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 | |
# Create a file with these contents in your repo at | |
# .git/hooks/pre-commit | |
# Place any .sscript files in a folder called Packed/ | |
# Extract any .sscript files from a Packed/ directory | |
for i in `find . -name "*.sscript" -type f -exec echo \{\} \;`; do | |
# Only act if within a Packed directory | |
act='No'; | |
case "$i" in | |
*/Packed/*) act='Yes' ; | |
esac | |
# Unpack | |
if [ $act = 'Yes' ]; | |
then | |
# Say something | |
echo "Found ${i}" | |
# Get the unpacked destination | |
unpacked_temp_destination="${i/Packed/Unpacked}" | |
unpacked_final_destination="${unpacked_temp_destination%.sscript}" | |
# Unzip | |
echo "Making '$unpacked_final_destination'" | |
unzip -o -q "$i" -d "$unpacked_final_destination" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this stopped working with Switch 13 update 1, now the unpacked scripts are all gibberish