Skip to content

Instantly share code, notes, and snippets.

@dominickp
Last active July 24, 2019 13:47
Show Gist options
  • Save dominickp/97496d6cb8921ddc9d4a to your computer and use it in GitHub Desktop.
Save dominickp/97496d6cb8921ddc9d4a to your computer and use it in GitHub Desktop.
Switch scripting .sscript inflating pre-commit hook
#!/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
@tz8
Copy link

tz8 commented Sep 26, 2016

this stopped working with Switch 13 update 1, now the unpacked scripts are all gibberish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment