Skip to content

Commit

Permalink
Creates a sync folder for the web root
Browse files Browse the repository at this point in the history
Rather than relying on flaky symlinking
Fixes #7
  • Loading branch information
goodguyry committed Jun 1, 2016
1 parent 53d999f commit 33e955a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 7 additions & 5 deletions files/user_setup
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,13 @@ function trim_extra_slashes {
# Adds/Deletes user
function user_do {
# Add the user
adduser --disabled-password --gecos "" "$@" >/dev/null
adduser --disabled-password --no-create-home --gecos "" "$@" >/dev/null
e_catch $? "Add user '$USER_NAME'"
# Set permissions for the home folder since it's not owned by the new user
# due to having been created by Vagrant as a sync folder
if [[ "$(stat -c '%U' /home/${USER_NAME})" != "${USER_NAME}" ]]; then
chown "${USER_NAME}":"${USER_NAME}" "/home/${USER_NAME}"
fi
}


Expand Down Expand Up @@ -213,13 +218,10 @@ fi

if [[ $status -eq 4 ]]; then
echo

# Add the user
user_do "$USER_NAME"

# Link up the user directory
ln -s "$CLEANED_PROJECT_ROOT" "$SITE_ROOT";
e_catch $? "Symlink web root" --clean

# Backup httpd-vhosts.conf
conf_do -b

Expand Down
3 changes: 3 additions & 0 deletions templates/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ Vagrant.configure(2) do |config|
# Start bash as a non-login shell
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"

config.vm.synced_folder "#{$user_vars['DREAMBOX_PROJECT_DIR']}",
"/home/#{$user_vars['DREAMBOX_USER_NAME']}/#{$user_vars['DREAMBOX_SITE_ROOT']}"

# Run user_setup
config.vm.provision 'shell',
inline: '/bin/bash /usr/local/bin/user_setup',
Expand Down

0 comments on commit 33e955a

Please sign in to comment.