Skip to content

Instantly share code, notes, and snippets.

@hunterloftis
Created January 5, 2012 05:54
Show Gist options
  • Save hunterloftis/1563925 to your computer and use it in GitHub Desktop.
Save hunterloftis/1563925 to your computer and use it in GitHub Desktop.
Templating some config files
# --- setup.sh:
...
deployer=`config_get user`
{ echo "cat <<EOFNOREALLY"
cat "$SCRIPTS/template.sh"
echo "EOFNOREALLY"
} | sh > "/tmp/templated.sh"
cat /tmp/templated.sh
...
# --- template.sh:
# setup a deploy user
useradd -U -s /bin/bash -m $deployer
## ssh directory
mkdir -p /home/$deployer/.ssh
touch /home/$deployer/.ssh/authorized_keys
touch /home/$deployer/.ssh/known_hosts
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment