Created
June 20, 2015 11:47
-
-
Save virifi/b0fbb35418ddca47665d to your computer and use it in GitHub Desktop.
htpasswd environment
This file contains hidden or 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 | |
| set -e | |
| SCRIPT_DIR=$(cd $(dirname "$0"); pwd) | |
| HOST_OUT_DIR="$SCRIPT_DIR/out" | |
| GUEST_OUT_DIR="/vagrant/out" | |
| HOST_OUT_PATH="$HOST_OUT_DIR/.htpasswd" | |
| GUEST_OUT_PATH="$GUEST_OUT_DIR/.htpasswd" | |
| if [ $# -ne 1 ]; then | |
| echo "Usage: run_htpasswd.sh <username>" | |
| exit 1 | |
| fi | |
| USERNAME=$1 | |
| if [ ! -d "$HOST_OUT_DIR" ]; then | |
| mkdir -p "$HOST_OUT_DIR" | |
| fi | |
| vagrant up | |
| vagrant ssh -c "htpasswd -c ${GUEST_OUT_PATH} ${USERNAME}" | |
| vagrant destroy | |
| echo "Generated htpasswd file : ${HOST_OUT_PATH}" |
This file contains hidden or 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
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
| VAGRANTFILE_API_VERSION = "2" | |
| Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
| config.vm.box = "ubuntu/trusty64" | |
| config.vm.provision :shell, :inline => <<-EOT | |
| apt-get update | |
| apt-get install -y apache2-utils --no-install-recommends | |
| EOT | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment