lib/devenv_build/files/provision.rb in devenv_build-1.0.2 vs lib/devenv_build/files/provision.rb in devenv_build-1.1.0
- old
+ new
@@ -24,17 +24,20 @@
echo "Setting up locales..."
/usr/sbin/update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
echo "Setting up APT mirrors..."
`cat >/etc/apt/sources.list <<\\EOF
-deb mirror://mirrors.ubuntu.com/mirrors.txt trusty main restricted universe multiverse
-deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main restricted universe multiverse
-deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-backports main restricted universe multiverse
-deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main restricted universe multiverse
+deb mirror://mirrors.ubuntu.com/mirrors.txt xenial main restricted universe multiverse
+deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-updates main restricted universe multiverse
+deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-backports main restricted universe multiverse
+deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-security main restricted universe multiverse
EOF
`
+USER=`tail -n 1 /etc/passwd | sed s/:.*//g`
+HOME="/home/$USER"
+
export DEBIAN_FRONTEND=noninteractive
apt-get -y update
apt-get -y upgrade
@@ -58,18 +61,18 @@
echo "127.0.0.1 devenv" >> /etc/hosts
hostname devenv
# Setup environment
echo "Setup environment..."
-`cat >/home/vagrant/.environment.sh <<\\EOF
+`cat >$HOME/.environment.sh <<\\EOF
# Environment variables
export PS1="[\\[\\033[1;34m\\]\\u\\[\\033[0m\\]@\\h:\\[\\033[1;37m\\]\\w\\[\\033[0m\\]]$ "
EOF
`
-echo 'source ~/.environment.sh' >> /home/vagrant/.bash_profile
-touch /home/vagrant/.secret_keys.sh
-chown vagrant:vagrant /home/vagrant/.environment.sh
-chown vagrant:vagrant /home/vagrant/.secret_keys.sh
+echo 'source ~/.environment.sh' >> $HOME/.bash_profile
+touch $HOME/.secret_keys.sh
+chown $USER:$USER $HOME/.environment.sh
+chown $USER:$USER $HOME/.secret_keys.sh
## AFTER ##############################################################################################
#{after}
########################################################################################################