summaryrefslogtreecommitdiff
path: root/release/scripts
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-09-12 11:41:31 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-09-12 11:41:31 +0000
commitb5ff185e19f6013ca565b2a15bc2d6abce933f46 (patch)
tree60c693416bb4f18491c1fcc6b486930fcd9f4ef1 /release/scripts
parent2fbd60ec4724bc5eebc0870e28620e75ae447922 (diff)
parentd36c6176161e31d945d8adbb2aae1ccffb632bd7 (diff)
downloadsrc-test-b5ff185e19f6013ca565b2a15bc2d6abce933f46.tar.gz
src-test-b5ff185e19f6013ca565b2a15bc2d6abce933f46.zip
Merge from head
Notes
Notes: svn path=/projects/release-pkg/; revision=287708
Diffstat (limited to 'release/scripts')
-rwxr-xr-xrelease/scripts/atlas-upload.sh159
-rw-r--r--release/scripts/box.ovf226
2 files changed, 385 insertions, 0 deletions
diff --git a/release/scripts/atlas-upload.sh b/release/scripts/atlas-upload.sh
new file mode 100755
index 0000000000000..bf1dbf116dbc9
--- /dev/null
+++ b/release/scripts/atlas-upload.sh
@@ -0,0 +1,159 @@
+#!/bin/sh
+#-
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# Upload a Vagrant image to Hashicorp's Atlas service
+#
+# $FreeBSD$
+#
+
+ATLAS_API_URL=''
+ATLAS_UPLOAD_URL='https://binstore.hashicorp.com'
+DESCRIPTION="FreeBSD Snapshot Build"
+
+usage() {
+ echo "${0} usage:"
+ echo "-b box-name -d 'box description' -f box-to-upload -k api-key -p provider -u user -v version"
+ return 1
+}
+
+main () {
+ while getopts "b:d:f:k:p:u:v:" arg; do
+ case "${arg}" in
+ b)
+ BOX="${OPTARG}"
+ ;;
+ d)
+ DESCRIPTION="${OPTARG}"
+ ;;
+ f)
+ FILE="${OPTARG}"
+ ;;
+ k)
+ KEY="${OPTARG}"
+ ;;
+ p)
+ PROVIDER="${OPTARG}"
+ ;;
+ u)
+ USERNAME="${OPTARG}"
+ ;;
+ v)
+ VERSION="${OPTARG}"
+ ;;
+ *)
+ ;;
+ esac
+ done
+
+ if [ -z "${BOX}" -o \
+ -z "${FILE}" -o \
+ -z "${KEY}" -o \
+ -z "${PROVIDER}" -o \
+ -z "${USERNAME}" -o \
+ -z "${VERSION}" ];
+ then
+ usage || exit 0
+ fi
+
+ # Check to see if the box exists or create it
+ BOXRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}?access_token=${KEY}")
+ if [ $? != 0 ]; then
+ echo "Failed to connect to the API"
+ exit 2;
+ fi
+ echo $BOXRESULT | grep "\"name\":\"${BOX}\"" > /dev/null
+ if [ $? != 0 ]; then
+ echo "Creating box: ${BOX}"
+ /usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/boxes -X POST -d "box[name]=${BOX}" -d "access_token=${KEY}" > /dev/null
+ /usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX} -X PUT -d "box[is_private]=false" -d "access_token=${KEY}" > /dev/null
+ /usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX} -X PUT -d "box[description]='${DESCRIPTION}'" -d "access_token=${KEY}" > /dev/null
+ else
+ echo "Box already exists"
+ fi
+
+ # Check to see if the version exists or create it
+ VERSIONRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}?access_token=${KEY}")
+ if [ $? != 0 ]; then
+ echo "Failed to connect to the API"
+ exit 2;
+ fi
+ echo $VERSIONRESULT | grep "\"version\":\"${VERSION}\"" > /dev/null
+ if [ $? != 0 ]; then
+ echo "Creating version: ${VERSION}"
+ /usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/versions -X POST -d "version[version]=${VERSION}" -d "access_token=${KEY}" > /dev/null
+ /usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION} -X PUT -d "version[description]=${DESCRIPTION}" -d "access_token=${KEY}" > /dev/null
+ VERSIONRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}?access_token=${KEY}")
+ echo $VERSIONRESULT | grep "\"version\":\"${VERSION}\"" > /dev/null
+ if [ $? != 0 ]; then
+ echo "Failed to create version"
+ exit 2
+ fi
+ else
+ echo "Version already exists"
+ fi
+
+ # Check to see if the provider exists or create it
+ PROVIDERRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/provider/${PROVIDER}?access_token=${KEY}")
+ if [ $? != 0 ]; then
+ echo "Failed to connect to the API"
+ exit 2;
+ fi
+ echo $PROVIDERRESULT | grep "\"name\":\"${PROVIDER}\"" > /dev/null
+ if [ $? != 0 ]; then
+ echo "Creating provider: ${PROVIDER}"
+ /usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/providers -X POST -d "provider[name]=${PROVIDER}" -d "access_token=${KEY}" > /dev/null
+ else
+ echo "Provider already exists"
+ fi
+
+ # Request an upload token
+ TOKENRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/provider/${PROVIDER}/upload?access_token=${KEY}")
+ if [ $? != 0 ]; then
+ echo "Failed to get the token from the API"
+ exit 2;
+ fi
+ echo ${TOKENRESULT} | grep "\"token\":" > /dev/null
+ if [ $? != 0 ]; then
+ echo "No token found from the API"
+ exit 2
+ else
+ TOKEN=$(echo $TOKENRESULT | sed -e 's/.*token":"//' -e 's/".*//')
+ echo "Uploading to Atlas"
+ UPLOADRESULT=$(/usr/local/bin/curl -s -X PUT --upload-file ${FILE} ${ATLAS_UPLOAD_URL}/${TOKEN})
+
+ # Validate the Upload
+ echo "Validating"
+ VALIDRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/provider/${PROVIDER}?access_token=${KEY}")
+ HOSTED_TOKEN=$(echo $VALIDRESULT | sed -e 's/.*hosted_token":"//' -e 's/".*//')
+ if [ ! -z ${HOSTED_TOKEN} -a ! -z ${TOKEN} -a ${HOSTED_TOKEN} != ${TOKEN} ]; then
+ echo "Upload failed, try again."
+ exit 2
+ fi
+
+ # Release the version
+ echo "Releasing ${VERSION} of ${BOX} in Atlas"
+ /usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/release -X PUT -d "access_token=${KEY}" > /dev/null
+ fi
+}
+
+main "$@"
diff --git a/release/scripts/box.ovf b/release/scripts/box.ovf
new file mode 100644
index 0000000000000..571e36fb6ab5f
--- /dev/null
+++ b/release/scripts/box.ovf
@@ -0,0 +1,226 @@
+<?xml version="1.0"?>
+<Envelope ovf:version="1.0" xml:lang="en-US" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vbox="http://www.virtualbox.org/ovf/machine">
+ <References>
+ <File ovf:href="vagrant.vmdk" ovf:id="file1"/>
+ </References>
+ <DiskSection>
+ <Info>List of the virtual disks used in the package</Info>
+ <Disk ovf:capacity="10632560640" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" vbox:uuid="e349f8b6-c400-4e7a-9825-598becab2f94"/>
+ </DiskSection>
+ <NetworkSection>
+ <Info>Logical networks used in the package</Info>
+ <Network ovf:name="NAT">
+ <Description>Logical network used by this appliance.</Description>
+ </Network>
+ </NetworkSection>
+ <VirtualSystem ovf:id="freebsd">
+ <Info>A virtual machine</Info>
+ <OperatingSystemSection ovf:id="78">
+ <Info>The kind of installed guest operating system</Info>
+ <Description>FreeBSD_64</Description>
+ <vbox:OSType ovf:required="false">FreeBSD_64</vbox:OSType>
+ </OperatingSystemSection>
+ <VirtualHardwareSection>
+ <Info>Virtual hardware requirements for a virtual machine</Info>
+ <System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>freebsd</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>virtualbox-2.2</vssd:VirtualSystemType>
+ </System>
+ <Item>
+ <rasd:Caption>1 virtual CPU</rasd:Caption>
+ <rasd:Description>Number of virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ </Item>
+ <Item>
+ <rasd:AllocationUnits>MegaBytes</rasd:AllocationUnits>
+ <rasd:Caption>512 MB of memory</rasd:Caption>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>512 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>512</rasd:VirtualQuantity>
+ </Item>
+ <Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Caption>ideController0</rasd:Caption>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>ideController0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceSubType>PIIX4</rasd:ResourceSubType>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </Item>
+ <Item>
+ <rasd:Address>1</rasd:Address>
+ <rasd:Caption>ideController1</rasd:Caption>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>ideController1</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:ResourceSubType>PIIX4</rasd:ResourceSubType>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </Item>
+ <Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Caption>disk1</rasd:Caption>
+ <rasd:Description>Disk Image</rasd:Description>
+ <rasd:ElementName>disk1</rasd:ElementName>
+ <rasd:HostResource>/disk/vmdisk1</rasd:HostResource>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </Item>
+ <Item>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Caption>Ethernet adapter on 'NAT'</rasd:Caption>
+ <rasd:Connection>NAT</rasd:Connection>
+ <rasd:ElementName>Ethernet adapter on 'NAT'</rasd:ElementName>
+ <rasd:InstanceID>6</rasd:InstanceID>
+ <rasd:ResourceSubType>E1000</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </Item>
+ </VirtualHardwareSection>
+ <vbox:Machine ovf:required="false" version="1.12-macosx" uuid="{8b837be7-fa96-48fc-b119-e90cfa144456}" name="freebsd" OSType="FreeBSD_64" snapshotFolder="Snapshots" lastStateChange="2014-03-13T13:50:05Z">
+ <ovf:Info>Complete VirtualBox machine configuration in VirtualBox format</ovf:Info>
+ <ExtraData>
+ <ExtraDataItem name="GUI/LastGuestSizeHint" value="720,400"/>
+ <ExtraDataItem name="GUI/LastNormalWindowPosition" value="400,183,720,421"/>
+ </ExtraData>
+ <Hardware version="2">
+ <CPU count="1" hotplug="false">
+ <HardwareVirtEx enabled="true"/>
+ <HardwareVirtExNestedPaging enabled="true"/>
+ <HardwareVirtExVPID enabled="true"/>
+ <HardwareVirtExUX enabled="true"/>
+ <PAE enabled="true"/>
+ <HardwareVirtExLargePages enabled="true"/>
+ <HardwareVirtForce enabled="false"/>
+ </CPU>
+ <Memory RAMSize="512" PageFusion="false"/>
+ <HID Pointing="PS2Mouse" Keyboard="PS2Keyboard"/>
+ <HPET enabled="false"/>
+ <Chipset type="PIIX3"/>
+ <Boot>
+ <Order position="1" device="HardDisk"/>
+ <Order position="2" device="DVD"/>
+ <Order position="3" device="None"/>
+ <Order position="4" device="None"/>
+ </Boot>
+ <Display VRAMSize="8" monitorCount="1" accelerate3D="false" accelerate2DVideo="false"/>
+ <VideoCapture/>
+ <RemoteDisplay enabled="false" authType="Null"/>
+ <BIOS>
+ <ACPI enabled="true"/>
+ <IOAPIC enabled="true"/>
+ <Logo fadeIn="true" fadeOut="true" displayTime="0"/>
+ <BootMenu mode="MessageAndMenu"/>
+ <TimeOffset value="0"/>
+ <PXEDebug enabled="false"/>
+ </BIOS>
+ <USBController enabled="false" enabledEhci="false"/>
+ <Network>
+ <Adapter slot="0" enabled="true" MACAddress="080027D14C66" cable="true" speed="0" type="82540EM">
+ <DisabledModes/>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </Adapter>
+ <Adapter slot="1" enabled="false" MACAddress="080027058FF2" cable="true" speed="0" type="82540EM">
+ <DisabledModes>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </DisabledModes>
+ </Adapter>
+ <Adapter slot="2" enabled="false" MACAddress="08002763A181" cable="true" speed="0" type="82540EM">
+ <DisabledModes>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </DisabledModes>
+ </Adapter>
+ <Adapter slot="3" enabled="false" MACAddress="0800279C6D17" cable="true" speed="0" type="82540EM">
+ <DisabledModes>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </DisabledModes>
+ </Adapter>
+ <Adapter slot="4" enabled="false" MACAddress="08002760C885" cable="true" speed="0" type="82540EM">
+ <DisabledModes>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </DisabledModes>
+ </Adapter>
+ <Adapter slot="5" enabled="false" MACAddress="0800279ECE95" cable="true" speed="0" type="82540EM">
+ <DisabledModes>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </DisabledModes>
+ </Adapter>
+ <Adapter slot="6" enabled="false" MACAddress="08002730E8BE" cable="true" speed="0" type="82540EM">
+ <DisabledModes>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </DisabledModes>
+ </Adapter>
+ <Adapter slot="7" enabled="false" MACAddress="080027AD8EF8" cable="true" speed="0" type="82540EM">
+ <DisabledModes>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </DisabledModes>
+ </Adapter>
+ </Network>
+ <UART>
+ <Port slot="0" enabled="false" IOBase="0x3f8" IRQ="4" hostMode="Disconnected"/>
+ <Port slot="1" enabled="false" IOBase="0x2f8" IRQ="3" hostMode="Disconnected"/>
+ </UART>
+ <LPT>
+ <Port slot="0" enabled="false" IOBase="0x378" IRQ="7"/>
+ <Port slot="1" enabled="false" IOBase="0x378" IRQ="7"/>
+ </LPT>
+ <AudioAdapter controller="AC97" driver="CoreAudio" enabled="false"/>
+ <RTC localOrUTC="local"/>
+ <SharedFolders/>
+ <Clipboard mode="Disabled"/>
+ <DragAndDrop mode="Disabled"/>
+ <IO>
+ <IoCache enabled="true" size="5"/>
+ <BandwidthGroups/>
+ </IO>
+ <HostPci>
+ <Devices/>
+ </HostPci>
+ <EmulatedUSB>
+ <CardReader enabled="false"/>
+ </EmulatedUSB>
+ <Guest memoryBalloonSize="0"/>
+ <GuestProperties>
+ <GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="en_US" timestamp="1394718154090069000" flags=""/>
+ </GuestProperties>
+ </Hardware>
+ <StorageControllers>
+ <StorageController name="IDE Controller" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
+ <AttachedDevice type="HardDisk" port="0" device="0">
+ <Image uuid="{e349f8b6-c400-4e7a-9825-598becab2f94}"/>
+ </AttachedDevice>
+ </StorageController>
+ </StorageControllers>
+ </vbox:Machine>
+ </VirtualSystem>
+</Envelope>