Begin work on the dist.sh script to create the distribution
This commit is contained in:
parent
d1c69048ed
commit
b37c171676
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Get the directory where this script is. This will also resolve
|
||||
# any symlinks in the directory/script, so it will be the fully
|
||||
# resolved path.
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
|
||||
# Determine the version that we're building based on the contents
|
||||
# of packer/version.go.
|
||||
VERSION=$(grep "const Version " packer/version.go | sed -E 's/.*"(.+)"$/\1/')
|
||||
PREVERSION=$(grep "const VersionPrerelease " packer/version.go | sed -E 's/.*"(.+)"$/\1/')
|
||||
if [ ! -z $PREVERSION ]; then
|
||||
PREVERSION="${PREVERSION}.$(date -u +%s)"
|
||||
fi
|
||||
|
||||
echo "Version: ${VERSION} ${PREVERSION}"
|
||||
|
||||
# This function builds whatever directory we're in...
|
||||
xc() {
|
||||
goxc \
|
||||
-arch="386 amd64 arm" \
|
||||
-os="linux darwin windows freebsd openbsd" \
|
||||
-d="${DIR}/pkg" \
|
||||
-pv="${VERSION}" \
|
||||
-pr="${PREVERSION}" \
|
||||
go-install \
|
||||
xc
|
||||
}
|
||||
|
||||
# Build our root project
|
||||
xc
|
||||
|
||||
# Build all the plugins
|
||||
for PLUGIN in $(find ./plugin -mindepth 1 -maxdepth 1 -type d); do
|
||||
PLUGIN_NAME=$(basename ${PLUGIN})
|
||||
pushd ${PLUGIN}
|
||||
xc
|
||||
popd
|
||||
find ./pkg -type f -name ${PLUGIN_NAME} -execdir mv ${PLUGIN_NAME} packer-${PLUGIN_NAME} ';'
|
||||
done
|
|
@ -1,9 +1,17 @@
|
|||
package packer
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// The version of packer.
|
||||
const Version = "0.1.0.dev"
|
||||
const Version = "0.1.0"
|
||||
|
||||
// Any pre-release marker for the version. If this is "" (empty string),
|
||||
// then it means that it is a final release. Otherwise, this is the
|
||||
// pre-release marker.
|
||||
const VersionPrerelease = "dev"
|
||||
|
||||
type versionCommand byte
|
||||
|
||||
|
@ -15,7 +23,13 @@ command-line flags for this command.`
|
|||
}
|
||||
|
||||
func (versionCommand) Run(env Environment, args []string) int {
|
||||
env.Ui().Say(fmt.Sprintf("Packer v%v", Version))
|
||||
var versionString bytes.Buffer
|
||||
fmt.Fprintf(&versionString, "Packer v%s", Version)
|
||||
if VersionPrerelease != "" {
|
||||
fmt.Fprintf(&versionString, ".%s", VersionPrerelease)
|
||||
}
|
||||
|
||||
env.Ui().Say(versionString.String())
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue