mirror of
https://github.com/rancher/os.git
synced 2025-09-25 20:52:58 +00:00
Add dynamic version string
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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
1
scripts/version
Normal file
@@ -0,0 +1 @@
|
||||
VERSION=v0.2.0
|
Reference in New Issue
Block a user