38 lines
1.4 KiB
Plaintext
38 lines
1.4 KiB
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
#set -eo pipefail
|
||
|
set -o pipefail
|
||
|
|
||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
|
||
|
|
||
|
sparsify=$(which virt-sparsify)
|
||
|
if [ $? -ne 0 ]
|
||
|
then
|
||
|
echo "!!!"
|
||
|
echo "!!! Warning : virt-sparsify is not present, you may encounter build issues with cadoles recipes !"
|
||
|
echo "!!! Please install libguestfs if you want to build cadoles production images"
|
||
|
echo "!!!"
|
||
|
fi
|
||
|
|
||
|
# Install a local copy of packer
|
||
|
PACKER_VERSION=1.6.6
|
||
|
PACKER_ARCH=amd64
|
||
|
#PACKER_ARCHIVE_SHA256SUM=30da8dab9c526a6d15b037e2234f6f12cf3accfad77eb2c130738ec1a54cab6d
|
||
|
#PACKER_ARCHIVE_SHA256SUM=a678c995cb8dc232db3353881723793da5acc15857a807d96c52e96e671309d9
|
||
|
PACKER_ARCHIVE_SHA256SUM=721d119fd70e38d6f2b4ccd8a39daf6b4d36bf5f7640036acafcaaa967b00c3b
|
||
|
|
||
|
wget -O- https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_${PACKER_ARCH}.zip > packer.zip
|
||
|
echo "${PACKER_ARCHIVE_SHA256SUM} packer.zip" | sha256sum -c
|
||
|
|
||
|
mkdir -p "${DIR}/../.bin"
|
||
|
unzip -o -d "${DIR}/../.bin" packer.zip
|
||
|
rm -f packer.zip
|
||
|
|
||
|
# Cadoles Packer plugins
|
||
|
|
||
|
# OpenNebula - Post-Processor Image Template
|
||
|
PLUGIN_ARCHIVE=https://forge.cadoles.com/Cadoles/packer-opennebula/releases/download/4fa5cbc782/packer-post-processor-opennebula-image-template-rev.4fa5cbc-linux-amd64.tar.gz
|
||
|
wget -O- "$PLUGIN_ARCHIVE" > plugin.tar.gz
|
||
|
tar -C "$DIR/../.bin" --strip=1 --wildcards -xzf plugin.tar.gz --wildcards packer-*/packer-post-processor-opennebula-image-template
|
||
|
rm -f plugin.tar.gz
|