1
0
mirror of https://github.com/rancher/os.git synced 2025-09-25 12:47:20 +00:00

Add dynamic version string

This commit is contained in:
Darren Shepherd
2015-03-20 11:35:21 -07:00
parent 0aeda8d1b0
commit a398f82403
4 changed files with 12 additions and 3 deletions

View File

@@ -1,7 +1,6 @@
package config
const (
VERSION = "0.2.0"
CONSOLE_CONTAINER = "console"
DOCKER_BIN = "/usr/bin/docker"
DOCKER_SYSTEM_HOME = "/var/lib/system-docker"
@@ -16,6 +15,7 @@ const (
)
var (
VERSION string
CloudConfigFile = "/var/lib/rancher/conf/cloud-config-rancher.yml"
ConfigFile = "/var/lib/rancher/conf/rancher.yml"
PrivateConfigFile = "/var/lib/rancher/conf/rancher-private.yml"
@@ -103,3 +103,9 @@ type StateConfig struct {
type CloudInit struct {
Datasources []string `yaml:"datasources,omitempty"`
}
func init() {
if VERSION == "" {
VERSION = "v0.0.0-dev"
}
}

View File

@@ -3,6 +3,8 @@ set -x
cd $(dirname $0)/..
source scripts/version
if [ "$IN_DOCKER" != "true" ]; then
cat > .dockerfile << "EOF"
FROM rancher/dind:v0.1.0
@@ -39,5 +41,5 @@ fi
echo export GOPATH=$GOPATH
mkdir -p bin
go build -tags netgo -ldflags "-linkmode external -extldflags -static" -o bin/rancheros
go build -tags netgo -ldflags "-X github.com/rancherio/os/config.VERSION ${VERSION:-v0.0.0-dev} -linkmode external -extldflags -static" -o bin/rancheros
strip --strip-all bin/rancheros

View File

@@ -54,6 +54,6 @@ for i in $(ls -d * .* | sort -u | grep -Ev '(\.|\.\.|\.dockerfile|build|dist|.gi
ARGS="${ARGS} $i"
fi
done
run --assets "${ARGS}" ./scripts/build
run --assets ./scripts/version --assets "${ARGS}" ./scripts/build
run --assets ./scripts/install ./scripts/package "$@"
finish

1
scripts/version Normal file
View File

@@ -0,0 +1 @@
VERSION=v0.2.0