Clean up scripts and migrate to detectionlab.network

This commit is contained in:
Chris Long
2018-02-15 01:05:17 -08:00
parent 2b7da41841
commit 4c3a6b91e7
3 changed files with 29 additions and 21 deletions

View File

@@ -60,10 +60,10 @@ There are two build scripts:
Provider | Box | URL | MD5 | Size Provider | Box | URL | MD5 | Size
------------|-----|-----|----|---- ------------|-----|-----|----|----
Virtualbox |Windows 2016 | https://www.dropbox.com/s/u2hbtv0ynf1pei8/windows_2016_virtualbox.box?dl=1 | 614f984c82b51471b5bb753940b59d38 | 6.4GB Virtualbox |Windows 2016 | https://www.detectionlab.network/windows_2016_virtualbox.box | 614f984c82b51471b5bb753940b59d38 | 6.4GB
Virtualbox | Windows 10 | https://www.dropbox.com/s/zt30zod4e0etug7/windows_10_virtualbox.box?dl=1 | 30b06e30b36b02ccf1dc5c04017654aa | 5.8GB Virtualbox | Windows 10 | https://www.detectionlab.network/windows_10_virtualbox.box | 30b06e30b36b02ccf1dc5c04017654aa | 5.8GB
VMware | Windows 2016 | https://www.dropbox.com/s/tvtl2r71amngnjs/windows_2016_vmware.box?dl=1 | 1511b9dc942c69c2cc5a8dc471fa8865 | 6.7GB VMware | Windows 2016 | https://www.detectionlab.network/windows_2016_vmware.box | 1511b9dc942c69c2cc5a8dc471fa8865 | 6.7GB
VMware | Windows 10 | https://www.dropbox.com/s/9zqxn6lrryzow4v/windows_10_vmware.box?dl=1 | 174ad0f0fd2089ff74a880c6dadac74c | 6.0GB VMware | Windows 10 | https://www.detectionlab.network/windows_10_vmware.box | 174ad0f0fd2089ff74a880c6dadac74c | 6.0GB
If you choose to download the boxes, you may skip steps 2 and 3. If you don't trust pre-built boxes, I recommend following steps 2 and 3 to build them on your machine. If you choose to download the boxes, you may skip steps 2 and 3. If you don't trust pre-built boxes, I recommend following steps 2 and 3 to build them on your machine.

View File

@@ -15,18 +15,23 @@ print_usage() {
} }
check_packer_and_vagrant() { check_packer_and_vagrant() {
# Check for existence of Vagrant and Packer in PATH # Check for existence of Vagrant in PATH
which vagrant > /dev/null which vagrant > /dev/null
if [ "$?" -ne 0 ]; then if [ "$?" -ne 0 ]; then
echo "Vagrant was not found in your PATH." (>&2 echo "Vagrant was not found in your PATH.")
echo "Please correct this before continuing. Quitting." (>&2 echo "Please correct this before continuing. Quitting.")
exit 1 exit 1
fi fi
# Ensure Vagrant >= 2.0.0
if [ "$(vagrant --version | grep -o "[0-9]" | head -1)" -lt 2 ]; then
(>&2 echo "WARNING: It is highly recommended to use Vagrant 2.0.0 or above before continuing")
fi
# Check for existence of Packer in PATH
which packer > /dev/null which packer > /dev/null
if [ "$?" -ne 0 ]; then if [ "$?" -ne 0 ]; then
echo "Packer was not found in your PATH." (>&2 echo "Packer was not found in your PATH.")
echo "Please correct this before continuing. Quitting." (>&2 echo "Please correct this before continuing. Quitting.")
echo "Hint: sudo cp ./packer /usr/local/bin/packer; sudo chmod +x /usr/local/bin/packer" (>&2 echo "Hint: sudo cp ./packer /usr/local/bin/packer; sudo chmod +x /usr/local/bin/packer")
exit 1 exit 1
fi fi
} }
@@ -129,7 +134,7 @@ preflight_checks() {
(>&2 echo "") (>&2 echo "")
fi fi
# Check Packer version against known bad # Check Packer version against known bad
if [ $(packer --version) == '1.1.2' ]; then if [ "$(packer --version)" == '1.1.2' ]; then
(>&2 echo "Packer 1.1.2 is not supported. Please upgrade to a newer version and see https://github.com/hashicorp/packer/issues/5622 for more information.") (>&2 echo "Packer 1.1.2 is not supported. Please upgrade to a newer version and see https://github.com/hashicorp/packer/issues/5622 for more information.")
exit 1 exit 1
fi fi

View File

@@ -15,13 +15,17 @@ print_usage() {
} }
check_vagrant() { check_vagrant() {
# Check for existence of Vagrant and Packer in PATH # Check for existence of Vagrant in PATH
which vagrant > /dev/null which vagrant > /dev/null
if [ "$?" -ne 0 ]; then if [ "$?" -ne 0 ]; then
echo "Vagrant was not found in your PATH." (>&2 echo "Vagrant was not found in your PATH.")
echo "Please correct this before continuing. Quitting." (>&2 echo "Please correct this before continuing. Quitting.")
exit 1 exit 1
fi fi
# Ensure Vagrant >= 2.0.0
if [ "$(vagrant --version | grep -o "[0-9]" | head -1)" -lt 2 ]; then
(>&2 echo "WARNING: It is highly recommended to use Vagrant 2.0.0 or above before continuing")
fi
} }
# Returns 0 if not installed or 1 if installed # Returns 0 if not installed or 1 if installed
@@ -110,8 +114,7 @@ preflight_checks() {
# Check to see if boxes exist already # Check to see if boxes exist already
BOXES_BUILT=$(ls -al "$DL_DIR"/Boxes/*.box 2> /dev/null | wc -l) BOXES_BUILT=$(ls -al "$DL_DIR"/Boxes/*.box 2> /dev/null | wc -l)
if [ $BOXES_BUILT -gt 0 ]; then if [ $BOXES_BUILT -gt 0 ]; then
(>&2 echo "You appear to have already built at least one box using Packer. This script automatically downloads them for you. Please either delete the existing boxes or follow the build steps in the README to continue.") (>&2 echo "WARNING: You seem to have boxes present in the Boxes/ directory already. If you would like fresh boxes downloaded, please remove all files from the Boxes/ directory and re-run this script.")
exit 1
fi fi
# Check to see if any Vagrant instances exist already # Check to see if any Vagrant instances exist already
cd "$DL_DIR"/Vagrant/ cd "$DL_DIR"/Vagrant/
@@ -139,17 +142,17 @@ preflight_checks() {
fi fi
} }
# Downloads pre-build Packer boxes from S3 to save time during CI builds # Downloads pre-built Packer boxes from detectionlab.network to save time during CI builds
download_boxes() { download_boxes() {
DL_DIR="$1" DL_DIR="$1"
PROVIDER="$2" PROVIDER="$2"
if [ "$PROVIDER" == "virtualbox" ]; then if [ "$PROVIDER" == "virtualbox" ]; then
wget "https://www.dropbox.com/s/u2hbtv0ynf1pei8/windows_2016_virtualbox.box?dl=1" -O "$DL_DIR"/Boxes/windows_2016_virtualbox.box wget "https://www.detectionlab.network/windows_2016_virtualbox.box" -O "$DL_DIR"/Boxes/windows_2016_virtualbox.box
wget "https://www.dropbox.com/s/zt30zod4e0etug7/windows_10_virtualbox.box?dl=1" -O "$DL_DIR"/Boxes/windows_10_virtualbox.box wget "https://www.detectionlab.network/windows_10_virtualbox.box" -O "$DL_DIR"/Boxes/windows_10_virtualbox.box
elif [ "$PROVIDER" == "vmware_fusion" ]; then elif [ "$PROVIDER" == "vmware_fusion" ]; then
wget "https://www.dropbox.com/s/tvtl2r71amngnjs/windows_2016_vmware.box?dl=1" -O "$DL_DIR"/Boxes/windows_2016_vmware.box wget "https://www.detectionlab.network/windows_2016_vmware.box" -O "$DL_DIR"/Boxes/windows_2016_vmware.box
wget "https://www.dropbox.com/s/9zqxn6lrryzow4v/windows_10_vmware.box?dl=1" -O "$DL_DIR"/Boxes/windows_10_vmware.box wget "https://www.detectionlab.network/windows_10_vmware.box" -O "$DL_DIR"/Boxes/windows_10_vmware.box
fi fi
# Hacky workaround # Hacky workaround