flatcar-scripts/boot_nspawn
Brandon Philips cf8be2c320 fix(*): use /media/state and overlays dir
/mnt/stateful_partition was already a little unruly with
/mnt/stateful_partition/home and /mnt/stateful_partition/var_overlay
serving similar functional purposes.

Then we needed to also add /opt and /srv overlays.

I also have wanted to get rid of the ugly and weird
/mnt/stateful_partition name so lets just have one big move.

/mnt/stateful_partition -> /media/state
/mnt/stateful_partition/var_overlay -> /media/overlays/var
/mnt/stateful_partition/home -> /media/overlays/home

From there we add /media/overlays/srv and /media/overlays/opt
2013-07-26 08:44:47 -07:00

32 lines
920 B
Bash
Executable File

#!/bin/bash
# Copyright (c) 2013 The CoreOS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
if [[ ! -d /sys/fs/cgroup/systemd ]] || ! systemctl >/dev/null; then
echo "This script must be run in a systemd based environment."
echo "Namely not inside the cros_sdk chroot and not on Ubuntu."
exit 1
fi
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || exit 1
DEFINE_string board "${DEFAULT_BOARD}" \
"The board to build root to boot."
FLAGS "$@" || exit 1
if [[ -z "${FLAGS_board}" ]]; then
echo "Error: --board is required."
exit 1
fi
BOARD="${FLAGS_board}"
ROOT="${DEFAULT_CHROOT_DIR}/build/${BOARD}"
STATE="${ROOT}-STATE"
[ -d "$STATE" ] || sudo mkdir -p "$STATE"
sudo systemd-nspawn --boot --read-only --machine="$HOSTNAME-$BOARD" \
--directory="$ROOT" --bind="$STATE:/media/state"