Compare commits
8 Commits
v0.2.0-rc2
...
v0.2.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f1d8adf6c | ||
|
|
189e40ce26 | ||
|
|
a398f82403 | ||
|
|
0aeda8d1b0 | ||
|
|
2f36ddd814 | ||
|
|
4cde6dc934 | ||
|
|
bee6675b36 | ||
|
|
9ed1f075bb |
3
build.sh
3
build.sh
@@ -12,12 +12,11 @@ docker run --rm -it -e CHOWN_ID=$(id -u) -v $(pwd)/dist:/source/target $DOCKER_I
|
||||
# Stupidest argparse ever
|
||||
if echo "$@" | grep -q -- '--images'; then
|
||||
./scripts/build-extra-images
|
||||
echo 'docker push rancher/ubuntuconsole'
|
||||
fi
|
||||
|
||||
# And again
|
||||
if echo "$@" | grep -q -- '--push'; then
|
||||
docker push rancher/ubuntuconsole
|
||||
docker push rancher/ubuntuconsole:$(<./scripts/version)
|
||||
fi
|
||||
|
||||
ls -l dist/artifacts
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package control
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@@ -137,7 +138,19 @@ func osUpgrade(c *cli.Context) {
|
||||
startUpgradeContainer(image, c.Bool("stage"), c.Bool("force"))
|
||||
}
|
||||
|
||||
func yes(in *bufio.Reader, question string) bool {
|
||||
fmt.Printf("%s [y/N]: ", question)
|
||||
line, err := in.ReadString('\n')
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return strings.ToLower(line[0:1]) == "y"
|
||||
}
|
||||
|
||||
func startUpgradeContainer(image string, stage, force bool) {
|
||||
in := bufio.NewReader(os.Stdin)
|
||||
|
||||
container := docker.NewContainer(config.DOCKER_SYSTEM_HOST, &config.ContainerConfig{
|
||||
Cmd: "--name=os-upgrade " +
|
||||
"--rm " +
|
||||
@@ -152,17 +165,11 @@ func startUpgradeContainer(image string, stage, force bool) {
|
||||
log.Fatal(container.Err)
|
||||
}
|
||||
|
||||
if !stage {
|
||||
fmt.Printf("Upgrading to %s : %v\n", image, stage)
|
||||
if !force {
|
||||
fmt.Print("Continue [y/N] ")
|
||||
one := make([]byte, 1, 1)
|
||||
_, err := os.Stdin.Read(one)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Printf("Upgrading to %s\n", image)
|
||||
|
||||
if string(one) != "Y" && string(one) != "y" {
|
||||
if !stage {
|
||||
if !force {
|
||||
if !yes(in, "Continue") {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
@@ -198,9 +205,12 @@ func startUpgradeContainer(image string, stage, force bool) {
|
||||
}
|
||||
|
||||
if exit == 0 {
|
||||
log.Info("Rebooting")
|
||||
power.Reboot()
|
||||
if force || yes(in, "Continue with reboot") {
|
||||
log.Info("Rebooting")
|
||||
power.Reboot()
|
||||
}
|
||||
} else {
|
||||
log.Error("Upgrade failed")
|
||||
os.Exit(exit)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +71,17 @@ func NewConfig() *Config {
|
||||
},
|
||||
},
|
||||
SystemContainers: []ContainerConfig{
|
||||
{
|
||||
Id: "udev",
|
||||
Cmd: "--name=udev " +
|
||||
"--net=none " +
|
||||
"--privileged " +
|
||||
"--rm " +
|
||||
"-v=/dev:/host/dev " +
|
||||
"-v=/lib/modules:/lib/modules:ro " +
|
||||
"udev",
|
||||
CreateOnly: true,
|
||||
},
|
||||
{
|
||||
Id: "system-volumes",
|
||||
Cmd: "--name=system-volumes " +
|
||||
@@ -82,6 +93,7 @@ func NewConfig() *Config {
|
||||
"-v=/var/run:/var/run " +
|
||||
"-v=/var/log:/var/log " +
|
||||
"state",
|
||||
CreateOnly: true,
|
||||
},
|
||||
{
|
||||
Id: "command-volumes",
|
||||
@@ -100,6 +112,7 @@ func NewConfig() *Config {
|
||||
"-v=/lib/modules:/lib/modules:ro " +
|
||||
"-v=/usr/bin/docker:/usr/bin/docker:ro " +
|
||||
"state",
|
||||
CreateOnly: true,
|
||||
},
|
||||
{
|
||||
Id: "user-volumes",
|
||||
@@ -109,15 +122,18 @@ func NewConfig() *Config {
|
||||
"-v=/home:/home " +
|
||||
"-v=/opt:/opt " +
|
||||
"state",
|
||||
CreateOnly: true,
|
||||
},
|
||||
{
|
||||
Id: "docker-volumes",
|
||||
Cmd: "--name=docker-volumes " +
|
||||
"--net=none " +
|
||||
"--read-only " +
|
||||
"-v=/var/lib/rancher:/var/lib/rancher " +
|
||||
"-v=/var/lib/docker:/var/lib/docker " +
|
||||
"-v=/var/lib/system-docker:/var/lib/system-docker " +
|
||||
"state",
|
||||
CreateOnly: true,
|
||||
},
|
||||
{
|
||||
Id: "all-volumes",
|
||||
@@ -130,6 +146,7 @@ func NewConfig() *Config {
|
||||
"--volumes-from=user-volumes " +
|
||||
"--volumes-from=system-volumes " +
|
||||
"state",
|
||||
CreateOnly: true,
|
||||
},
|
||||
{
|
||||
Id: "cloud-init-pre",
|
||||
@@ -227,7 +244,7 @@ func NewConfig() *Config {
|
||||
"--ipc=host " +
|
||||
"--net=host " +
|
||||
"--pid=host " +
|
||||
"rancher/ubuntuconsole:v0.0.2",
|
||||
"rancher/ubuntuconsole:" + VERSION,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -7,7 +7,7 @@ source scripts/build-common
|
||||
|
||||
>${BUILD}/tags
|
||||
for i in scripts/extraimages/[0-9]*; do
|
||||
tag=$(echo $i | cut -f2 -d-)
|
||||
tag=$(echo $i | cut -f2 -d-):$(<scripts/version)
|
||||
echo Building $tag
|
||||
docker build -t rancher/$tag -f $i .
|
||||
echo $tag >> ${BUILD}/tags
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -14,4 +14,4 @@ fi
|
||||
|
||||
rancherctl config get cloud_init
|
||||
|
||||
cloud-init -save -network ${CLOUD_INIT_NETWORK:-true}
|
||||
cloud-init -save -network=${CLOUD_INIT_NETWORK:-true}
|
||||
|
||||
@@ -13,7 +13,7 @@ Options:
|
||||
-d device
|
||||
-f [ DANGEROUS! Data loss can happen ] partition/format without prompting
|
||||
-t install-type:
|
||||
generic: Creates 1 ext4 partition and installs RancherOS
|
||||
generic: (Default) Creates 1 ext4 partition and installs RancherOS
|
||||
amazon-ebs: Installs RancherOS and sets up PV-GRUB
|
||||
-v os-installer version.
|
||||
-h print this
|
||||
@@ -21,17 +21,24 @@ EOF
|
||||
}
|
||||
|
||||
PARTITION_FLAG="false"
|
||||
INSTALLER_VERSION="latest"
|
||||
EXTRA_ARGS=
|
||||
INSTALL_CONTAINER_IMAGE="rancher/os"
|
||||
|
||||
if [ -x /usr/bin/rancherctl ]; then
|
||||
INSTALL_CONTAINER_IMAGE="$(rancherctl config get upgrade.image)"
|
||||
fi
|
||||
|
||||
if [ -n "$(grep RancherOS /etc/lsb-release)" ]; then
|
||||
INSTALLER_VERSION=$(grep DISTRIB_RELEASE /etc/lsb-release|cut -d'=' -f2)
|
||||
fi
|
||||
|
||||
EXTRA_ARGS=
|
||||
|
||||
while getopts "c:d:ft:v:h" OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
c) CLOUD_CONFIG="$OPTARG" ;;
|
||||
d) DEVICE="$OPTARG" ;;
|
||||
f) FORCE_INSTALL="true" ;;
|
||||
# p) PARTITION_FLAG="true" ;;
|
||||
t) INSTALL_TYPE="${OPTARG}" ;;
|
||||
v) INSTALLER_VERSION="$OPTARG" ;;
|
||||
h) usage; exit ;;
|
||||
@@ -45,8 +52,8 @@ if [ "$(whoami)" != "root" ]; then
|
||||
fi
|
||||
|
||||
if [[ -z "${INSTALL_TYPE}" ]]; then
|
||||
echo "$0: No install type specified, -t required to install" 1>&2
|
||||
exit 1
|
||||
echo "No install type specified...defaulting to generic"
|
||||
INSTALL_TYPE="generic"
|
||||
fi
|
||||
|
||||
if [ -z "${CLOUD_CONFIG}" ] && [ "${INSTALL_TYPE}" != "amazon-ebs" ]; then
|
||||
@@ -54,6 +61,11 @@ if [ -z "${CLOUD_CONFIG}" ] && [ "${INSTALL_TYPE}" != "amazon-ebs" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${DEVICE}" ]]; then
|
||||
echo "$0: No device defined. Can not proceed without -d <dev> specified" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${INSTALL_TYPE}" == "generic" ]; then
|
||||
PARTITION_FLAG="true"
|
||||
fi
|
||||
|
||||
@@ -4,5 +4,5 @@ cd $(dirname $0)/..
|
||||
|
||||
source scripts/build-common
|
||||
|
||||
download d39f85b5c3ca59be9936627b2c3138bc2868fdfd https://github.com/rancherio/os-base/releases/download/v0.1.0/os-base.tar.xz
|
||||
download 229f3d43369982b6a7b410795c9762814ade0f56 https://github.com/rancherio/os-base/releases/download/v0.1.1/os-base.tar.xz
|
||||
download 1acbe869b32869bca5788373e8624a2957cbb380 https://github.com/ibuildthecloud/docker/releases/download/v1.5.0-rancher-2/docker-1.5.0
|
||||
|
||||
1
scripts/version
Normal file
1
scripts/version
Normal file
@@ -0,0 +1 @@
|
||||
VERSION=v0.2.1
|
||||
Reference in New Issue
Block a user