Browse Source

Merge pull request #1802 from TechEmpower/vagrant-fix

Quick fix for vagrant
Mike Smith 9 years ago
parent
commit
d08de623e8
1 changed files with 22 additions and 12 deletions
  1. 22 12
      deployment/vagrant-common/bootstrap.sh

+ 22 - 12
deployment/vagrant-common/bootstrap.sh

@@ -97,31 +97,31 @@ if [ ! -e "~/.firstboot" ]; then
 
 
   # Install prerequisite tools
   # Install prerequisite tools
   echo "Installing prerequisites"
   echo "Installing prerequisites"
-  sudo apt-get update
+  source toolset/setup/linux/prerequisites.sh
   sudo apt-get install -y git
   sudo apt-get install -y git
-  sudo apt-get install -y python-pip
+
 
 
   # Make project available
   # Make project available
   # If they synced it to /FwBm, just expose it at ~/FwBm
   # If they synced it to /FwBm, just expose it at ~/FwBm
   # If they didn't sync, we need to clone it
   # If they didn't sync, we need to clone it
-  if [ -d "/FrameworkBenchmarks" ]; then
-    ln -s /FrameworkBenchmarks $FWROOT
-    echo "Removing your current results folder to avoid interference"
-    rm -rf $FWROOT/installs $FWROOT/results
+  #if [ -d "/FrameworkBenchmarks" ]; then
+    #ln -s /FrameworkBenchmarks $FWROOT
+    #echo "Removing your current results folder to avoid interference"
+    #rm -rf $FWROOT/installs $FWROOT/results
 
 
     # vboxfs does not support chown or chmod, which we need. 
     # vboxfs does not support chown or chmod, which we need. 
     # We therefore bind-mount a normal linux directory so we can
     # We therefore bind-mount a normal linux directory so we can
     # use these operations. This enables us to 
     # use these operations. This enables us to 
     # use `chown -R testrunner:testrunner $FWROOT/installs` later
     # use `chown -R testrunner:testrunner $FWROOT/installs` later
-    echo "Mounting over your installs folder"
-    mkdir -p /tmp/TFB_installs
-    mkdir -p /FrameworkBenchmarks/installs
-    sudo mount -o bind /tmp/TFB_installs $FWROOT/installs
-  else
+    #echo "Mounting over your installs folder"
+    #mkdir -p /tmp/TFB_installs
+    #mkdir -p /FrameworkBenchmarks/installs
+    #sudo mount -o bind /tmp/TFB_installs $FWROOT/installs
+  #else
     # If there is no synced folder, clone the project
     # If there is no synced folder, clone the project
     echo "Cloning project from $GH_REPO $GH_BRANCH"
     echo "Cloning project from $GH_REPO $GH_BRANCH"
     git clone -b ${GH_BRANCH} https://github.com/${GH_REPO}.git $FWROOT
     git clone -b ${GH_BRANCH} https://github.com/${GH_REPO}.git $FWROOT
-  fi
+  #fi
 
 
   # Everyone gets SSH access to localhost
   # Everyone gets SSH access to localhost
   echo "Setting up SSH access to localhost"
   echo "Setting up SSH access to localhost"
@@ -133,6 +133,16 @@ if [ ! -e "~/.firstboot" ]; then
   sudo -u testrunner bash -c "cat /home/vagrant/.ssh/authorized_keys >> /home/testrunner/.ssh/authorized_keys"
   sudo -u testrunner bash -c "cat /home/vagrant/.ssh/authorized_keys >> /home/testrunner/.ssh/authorized_keys"
   chmod 600 ~/.ssh/authorized_keys
   chmod 600 ~/.ssh/authorized_keys
   sudo -u testrunner chmod 600 /home/testrunner/.ssh/authorized_keys
   sudo -u testrunner chmod 600 /home/testrunner/.ssh/authorized_keys
+  
+  export RUNNER=testrunner
+  export ME=$(id -u -n)
+  sudo chown $RUNNER:$RUNNER /home/$RUNNER
+  sudo sed -i 's|:'"$ME"'|:'"$ME"','"$RUNNER"'|g' /etc/group
+  sudo sed -i 's|'"$ME"':x:\(.*\):|'"$ME"':x:\1:'"$RUNNER"'|g' /etc/group
+  sudo sed -i 's|'"$RUNNER"':x:\(.*\):|'"$RUNNER"':x:\1:'"$ME"'|g' /etc/group
+  echo "$RUNNER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
+  sudo sed -i 's|/home/'"$RUNNER"':.*|/home/'"$RUNNER"':/bin/bash|g' /etc/passwd
+
   # Enable remote SSH access if we are running production environment
   # Enable remote SSH access if we are running production environment
   # Note : this are always copied from the local working copy using a
   # Note : this are always copied from the local working copy using a
   #        file provisioner. While they exist in the git clone we just 
   #        file provisioner. While they exist in the git clone we just