#!/bin/bash

# Set Variables
LAB_ENV_DIR="C:/Documnents/LabEnvironments"
SCAVENGER_DIR="$LAB_ENV_DIR/linux-scavenger"
SCAVENGER_REMOTE="git@gitlab.com:cyberxsecurity/lab-definitions/linux-scavenger.git"

# Create Lab Environment Directory
mkdir -p $LAB_ENV_DIR && cd $_

# Download Environment
git clone $SCAVENGER_REMOTE $SCAVENGER_DIR
cd $SCAVENGER_DIR
git submodule --init --recurse

# Lift Machine and Install Reprovisioner
vagrant up
powershell reprovision/InstallReprovisioner.ps1

# Fix Line Endings and Ensure VM is Up-to-Date
dos2unix **/*
powershell reprovision/Reprovision.ps1

