aboutsummaryrefslogtreecommitdiff
path: root/bin/provision
diff options
context:
space:
mode:
Diffstat (limited to 'bin/provision')
-rwxr-xr-xbin/provision26
1 files changed, 12 insertions, 14 deletions
diff --git a/bin/provision b/bin/provision
index 8473d53..16f102f 100755
--- a/bin/provision
+++ b/bin/provision
@@ -3,16 +3,14 @@
# Simple shell provisioner for Vagrant instances.
#
-# Set sudo config
-if [ "`whoami`" != 'root' ]; then
- sudo="sudo"
-fi
+# Parameters
+DIRNAME="`dirname $0`"
-# Ensure the system is updated.
-$sudo apt-get update && DEBIAN_FRONTEND=noninteractive $sudo apt-get dist-upgrade -y && $sudo apt-get autoremove -y && $sudo apt-get clean
+# Load dependencies
+source $DIRNAME/dependencies
-# Install dependencies
-source /vagrant/puppet/bin/dependencies
+# Ensure the system is updated.
+$SUDO apt-get update && DEBIAN_FRONTEND=noninteractive $SUDO apt-get dist-upgrade -y && $SUDO apt-get autoremove -y && $SUDO apt-get clean
# Ensure additional dependencies are installed.
for package in usbutils; do
@@ -24,14 +22,14 @@ for package in ruby-sqlite3 ruby-activerecord ruby-activerecord-deprecated-finde
provision_package $package
done
-# Link hiera configuration.
+# Link hiera configuration if needed.
if [ ! -h "/etc/puppet/hiera.yaml" ]; then
- $sudo rm -f /etc/puppet/hiera.yaml
- $sudo ln -s /vagrant/puppet/hiera/hiera.yaml /etc/puppet/hiera.yaml
+ $SUDO rm -f /etc/puppet/hiera.yaml
+ $SUDO ln -s $DIRNAME/../hiera/hiera.yaml /etc/puppet/hiera.yaml
fi
-# Link puppet configuration.
+# Link puppet configuration if needed.
if [ ! -h "/etc/puppet/puppet.conf" ]; then
- $sudo rm -f /etc/puppet/puppet.conf
- $sudo ln -s /vagrant/puppet/puppet.conf /etc/puppet/puppet.conf
+ $SUDO rm -f /etc/puppet/puppet.conf
+ $SUDO ln -s $DIRNAME/../puppet.conf /etc/puppet/puppet.conf
fi