mirror of https://github.com/MISP/misp-packer
chg: [sh] Various deploy.sh updates
parent
09f9f052d6
commit
c9bdb8e78d
|
@ -1,5 +1,8 @@
|
||||||
packer_cache/
|
packer_cache/
|
||||||
output-virtualbox-iso/
|
output-virtualbox-iso/
|
||||||
|
output-vmware-iso/
|
||||||
scripts/INSTALL.sh*
|
scripts/INSTALL.sh*
|
||||||
*.checksum
|
*.checksum
|
||||||
misp-deploy.json
|
misp-deploy.json
|
||||||
|
packerlog-vbox.txt
|
||||||
|
packerlog-vmware.txt
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Name of the packer
|
||||||
|
PACKER_NAME="misp"
|
||||||
|
PACKER_VM="MISP"
|
||||||
|
NAME="${PACKER_NAME}-packer"
|
||||||
|
|
||||||
|
# Configure your user and remote server
|
||||||
|
REMOTE=1
|
||||||
|
REL_USER="${PACKER_NAME}-release"
|
||||||
|
REL_SERVER="cpab"
|
||||||
|
|
||||||
|
# GPG Sign
|
||||||
|
GPG_ENABLED=1
|
||||||
|
GPG_KEY="0x34F20B13"
|
||||||
|
|
||||||
|
# Enable debug for packer, omit -debug to disable
|
||||||
|
##PACKER_DEBUG="-debug"
|
||||||
|
|
||||||
|
# Enable logging and debug for packer
|
||||||
|
export PACKER_LOG=1
|
||||||
|
|
||||||
|
REPO="MISP/MISP"
|
||||||
|
BRANCH="2.4"
|
||||||
|
|
||||||
|
# SHAsums to be computed, note the -- notatiation is for ease of use with rhash
|
||||||
|
SHA_SUMS="--sha1 --sha256 --sha384 --sha512"
|
||||||
|
|
||||||
|
NAME_OF_INSTALLER="INSTALL.sh"
|
||||||
|
PATH_TO_INSTALLER="scripts/${NAME_OF_INSTALLER}"
|
||||||
|
URL_TO_INSTALLER="https://raw.githubusercontent.com/${REPO}/${BRANCH}/INSTALL/${NAME_OF_INSTALLER}"
|
||||||
|
URL_TO_LICENSE="https://raw.githubusercontent.com/${REPO}/${BRANCH}/LICENSE"
|
45
deploy.sh
45
deploy.sh
|
@ -9,38 +9,10 @@
|
||||||
# Timing creation
|
# Timing creation
|
||||||
TIME_START=$(date +%s)
|
TIME_START=$(date +%s)
|
||||||
|
|
||||||
# Name of the packer
|
# Please adjust config.sh accordingly
|
||||||
PACKER_NAME="misp"
|
source config.sh
|
||||||
PACKER_VM="MISP"
|
|
||||||
NAME="${PACKER_NAME}-packer"
|
|
||||||
|
|
||||||
# Configure your user and remote server
|
### ---- NO TOUCHY BEYOND THIS POINT, PLEASE --- ###
|
||||||
REMOTE=1
|
|
||||||
REL_USER="${PACKER_NAME}-release"
|
|
||||||
REL_SERVER="cpab"
|
|
||||||
|
|
||||||
# GPG Sign
|
|
||||||
GPG_ENABLED=1
|
|
||||||
GPG_KEY="0x34F20B13"
|
|
||||||
|
|
||||||
# Enable debug for packer, omit -debug to disable
|
|
||||||
##PACKER_DEBUG="-debug"
|
|
||||||
|
|
||||||
# Enable logging and debug for packer
|
|
||||||
export PACKER_LOG=0
|
|
||||||
|
|
||||||
REPO="MISP/MISP"
|
|
||||||
BRANCH="2.4"
|
|
||||||
|
|
||||||
# SHAsums to be computed, note the -- notatiation is for ease of use with rhash
|
|
||||||
SHA_SUMS="--sha1 --sha256 --sha384 --sha512"
|
|
||||||
|
|
||||||
NAME_OF_INSTALLER="INSTALL.sh"
|
|
||||||
PATH_TO_INSTALLER="scripts/${NAME_OF_INSTALLER}"
|
|
||||||
URL_TO_INSTALLER="https://raw.githubusercontent.com/${REPO}/${BRANCH}/INSTALL/${NAME_OF_INSTALLER}"
|
|
||||||
URL_TO_LICENSE="https://raw.githubusercontent.com/${REPO}/${BRANCH}/LICENSE"
|
|
||||||
|
|
||||||
### ---- NOT TOUCHY BEOYND THIS POINT, PLEASE --- ###
|
|
||||||
|
|
||||||
# TODO: Move into seprate file
|
# TODO: Move into seprate file
|
||||||
GOT_PACKER=$(which packer > /dev/null 2>&1; echo $?)
|
GOT_PACKER=$(which packer > /dev/null 2>&1; echo $?)
|
||||||
|
@ -166,7 +138,8 @@ checkInstaller () {
|
||||||
if [[ ${chsum} == ${INSTsum} ]] && [[ ${rhash_chk} == 0 ]]; then
|
if [[ ${chsum} == ${INSTsum} ]] && [[ ${rhash_chk} == 0 ]]; then
|
||||||
echo "sha${sum} matches"
|
echo "sha${sum} matches"
|
||||||
else
|
else
|
||||||
echo "sha${sum}: ${chsum} does not match the installer sum of: ${INSTsum}"
|
echo "Either: sha${sum}: ${chsum} does not match the installer sum of: ${INSTsum}"
|
||||||
|
echo "Or: rhash failed on non Zero: ${rhash_chk}"
|
||||||
echo "Deleting installer, please run again."
|
echo "Deleting installer, please run again."
|
||||||
rm ${PATH_TO_INSTALLER}
|
rm ${PATH_TO_INSTALLER}
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -214,17 +187,17 @@ if [[ "${LATEST_COMMIT}" != "$(cat /tmp/${PACKER_NAME}-latest.sha)" ]]; then
|
||||||
cat ${PACKER_NAME}.json| sed "s|\"vm_name\": \"${PACKER_VM}_demo\",|\"vm_name\": \"${PACKER_VM}_${VER}@${LATEST_COMMIT_SHORT}\",|" > ${PACKER_NAME}-deploy.json
|
cat ${PACKER_NAME}.json| sed "s|\"vm_name\": \"${PACKER_VM}_demo\",|\"vm_name\": \"${PACKER_VM}_${VER}@${LATEST_COMMIT_SHORT}\",|" > ${PACKER_NAME}-deploy.json
|
||||||
|
|
||||||
# Build virtualbox VM set
|
# Build virtualbox VM set
|
||||||
PACKER_LOG_PATH="${PWD}/packerlog-vbox.txt"
|
export PACKER_LOG_PATH="${PWD}/packerlog-vbox.txt"
|
||||||
($PACKER_RUN build --on-error=cleanup -only=virtualbox-iso ${PACKER_NAME}-deploy.json > /dev/null 2>&1 ; echo $? > /tmp/${PACKER_NAME}-vbox.done) &
|
($PACKER_RUN build --on-error=cleanup -only=virtualbox-iso ${PACKER_NAME}-deploy.json ; echo $? > /tmp/${PACKER_NAME}-vbox.done) &
|
||||||
|
|
||||||
# Build vmware VM set
|
# Build vmware VM set
|
||||||
PACKER_LOG_PATH="${PWD}/packerlog-vmware.txt"
|
export PACKER_LOG_PATH="${PWD}/packerlog-vmware.txt"
|
||||||
($PACKER_RUN build --on-error=cleanup -only=vmware-iso ${PACKER_NAME}-deploy.json ; echo $? > /tmp/${PACKER_NAME}-vmware.done) &
|
($PACKER_RUN build --on-error=cleanup -only=vmware-iso ${PACKER_NAME}-deploy.json ; echo $? > /tmp/${PACKER_NAME}-vmware.done) &
|
||||||
|
|
||||||
# The below waits for the above 2 parallel packer builds to finish
|
# The below waits for the above 2 parallel packer builds to finish
|
||||||
while [[ ! -f /tmp/${PACKER_NAME}-vmware.done ]]; do :; done
|
while [[ ! -f /tmp/${PACKER_NAME}-vmware.done ]]; do :; done
|
||||||
while [[ ! -f /tmp/${PACKER_NAME}-vbox.done ]]; do :; done
|
while [[ ! -f /tmp/${PACKER_NAME}-vbox.done ]]; do :; done
|
||||||
|
#exit -1
|
||||||
# Prevent uploading only half a build
|
# Prevent uploading only half a build
|
||||||
if [[ "$(cat /tmp/${PACKER_NAME}-vbox.done)" == "0" ]] && [[ "$(cat /tmp/${PACKER_NAME}-vmware.done)" == "0" ]]; then
|
if [[ "$(cat /tmp/${PACKER_NAME}-vbox.done)" == "0" ]] && [[ "$(cat /tmp/${PACKER_NAME}-vmware.done)" == "0" ]]; then
|
||||||
# ZIPup all the vmware stuff
|
# ZIPup all the vmware stuff
|
||||||
|
|
|
@ -22,7 +22,7 @@ cd /var/www/MISP/PyMISP
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
echo "Damage, terrible terrible damage!!!!" >> /tmp/tests-output.txt
|
echo "Damage, terrible terrible damage!!!!" >> /tmp/tests-output.txt
|
||||||
# TODO: Move the smtp server and e-mail address to a config file
|
# TODO: Move the smtp server and e-mail address to a config file
|
||||||
set smtp=smtp://149.13.33.5 ; cat /tmp/tests-output.txt |mail -s "tests/testlive_comprehensive.py failed on autogen-VM" steve.clement@circl.lu
|
##set smtp=smtp://149.13.33.5 ; cat /tmp/tests-output.txt |mail -s "tests/testlive_comprehensive.py failed on autogen-VM" steve.clement@circl.lu
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf tests/viper-test-files
|
rm -rf tests/viper-test-files
|
||||||
|
|
Loading…
Reference in New Issue