Skip to content

Instantly share code, notes, and snippets.

@joshbirk
Created October 3, 2011 21:15
Show Gist options
  • Save joshbirk/1260274 to your computer and use it in GitHub Desktop.
Save joshbirk/1260274 to your computer and use it in GitHub Desktop.
This is one way to swap out the password with the one in keychain, build, then swap back.
. build.properties
if [ ${usekeychainaccess} == 'enabled' ]
then
shellpassword=$(~/bin/keychain.sh ${password})
sed "s/${password}/${shellpassword}/" build.properties > new.properties
cp new.properties build.back
cp new.properties build.properties
fi
ant build-all
if [ ${usekeychainaccess} == 'enabled' ]
then
sed "s/${shellpassword}/${password}/" build.properties > new.properties
cp new.properties build.back
cp new.properties build.properties
rm new.properties
rm build.back
fi
@joshbirk
Copy link
Author

joshbirk commented Oct 3, 2011

The shell script referenced as "keychain.sh"

security 2>&1 >/dev/null find-generic-password -ga $1
|ruby -e 'print $1 if STDIN.gets =~ /^password: "(.*)"$/'

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