-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instead of merging kargs from the previous deployment, by default regenerate kargs from the following config files: /etc/ostree/kargs (host config) /usr/lib/ostree-boot/kargs (base config) The base config is sourced from the repo at the commit (revision) being deployed, so that newly committed kargs will take effect immediately after upgrading. The host config is sourced from the previous deployment (merge deployment), so that host edits are reflected. Kernel arguments present in the base config are appended to kernel arguments in the base config. Using the commands that modify kargs (of the form `ostree admin deploy --karg*" will cause kargs in later deployments to be copied from the merge deployment, rather than regenerate from the config files.
- Loading branch information
Robert Fairley
committed
Apr 10, 2019
1 parent
15d18b6
commit cc3abc3
Showing
7 changed files
with
294 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (C) 2019 Robert Fairley <[email protected]> | ||
# | ||
# SPDX-License-Identifier: LGPL-2.0+ | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
# License as published by the Free Software Foundation; either | ||
# version 2 of the License, or (at your option) any later version. | ||
# | ||
# This library is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with this library; if not, write to the | ||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
# Boston, MA 02111-1307, USA. | ||
|
||
set -euo pipefail | ||
|
||
. $(dirname $0)/libtest.sh | ||
|
||
# Exports OSTREE_SYSROOT so --sysroot not needed. | ||
setup_os_repository "archive" "syslinux" | ||
|
||
echo "1..1" | ||
|
||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime | ||
|
||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime | ||
assert_has_dir sysroot/boot/ostree/testos-${bootcsum} | ||
|
||
# Configure kargs stored in the ostree commit. | ||
mkdir -p osdata/usr/lib/ostree-boot | ||
os_tree_write_file "usr/lib/ostree-boot/kargs" "FOO=USR_1 MOO=USR_2 WOO=USR_3" | ||
os_repository_commit "testos-repo" | ||
|
||
# Upgrade to tree with newly-committed kargs file. | ||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo testos/buildmaster/x86_64-runtime | ||
${CMD_PREFIX} ostree admin upgrade --os=testos | ||
# Sanity check a new boot directory was created after upgrading. | ||
assert_has_dir sysroot/boot/ostree/testos-${bootcsum} | ||
|
||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'FOO=USR_1' | ||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'MOO=USR_2' | ||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'WOO=USR_3' | ||
assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'ostree-kargs-override' | ||
|
||
# Configure kargs through the host config file. | ||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) | ||
export rev | ||
echo "rev=${rev}" | ||
etc=sysroot/ostree/deploy/testos/deploy/${rev}.0/etc | ||
assert_has_dir ${etc} | ||
mkdir -p ${etc}/ostree | ||
echo "HELLO=ETC_1 MELLO=ETC_2 BELLO=ETC_3" > ${etc}/ostree/kargs | ||
|
||
# Re-deploy with host-configured kernel args. | ||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime | ||
|
||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'HELLO=ETC_1' | ||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'MELLO=ETC_2' | ||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'BELLO=ETC_3' | ||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'FOO=USR_1' | ||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'MOO=USR_2' | ||
assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'WOO=USR_3' | ||
assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'ostree-kargs-override' | ||
|
||
echo "ok default kargs" | ||
|
||
# Tests needed: | ||
# - downgrading | ||
# - staging a deployment |