forked from coreos/fedora-coreos-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
overlay/15fcos: ensure valid aleph file
Due to an ordering mishap, some builds have both a `version` and a `build` field. This causes bootupctl to fail while parsing the file. Detect this case, and fix the aleph if necessary by removing the `build` field. This should be removed after the next barrier release. Fixes: coreos/fedora-coreos-tracker#1724
- Loading branch information
1 parent
dfb0b16
commit 3036af6
Showing
3 changed files
with
45 additions
and
0 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
14 changes: 14 additions & 0 deletions
14
overlay.d/15fcos/usr/lib/systemd/system/coreos-fix-aleph-file.service
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,14 @@ | ||
# Remove after the next barrier release | ||
|
||
[Unit] | ||
Description=Fix CoreOS Aleph File | ||
Documentation=https://github.com/coreos/fedora-coreos-tracker/issues/1724 | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/libexec/coreos-fix-aleph-file | ||
RemainAfterExit=yes | ||
MountFlags=slave | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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,28 @@ | ||
#!/usr/bin/bash | ||
|
||
# This script removes the extra `version` field | ||
# which was shipped in a couple of builds | ||
# when switching to the `build` field | ||
# To be removed after the next barrier release. | ||
# see https://github.com/coreos/fedora-coreos-tracker/issues/1724 for more details | ||
|
||
set -euo pipefail | ||
|
||
ALEPH_FILE=/sysroot/.coreos-aleph-version.json | ||
|
||
if ! jq -e 'has("build") and has("version")' ${ALEPH_FILE}; then | ||
echo "Aleph file does not require fixing" | ||
exit | ||
fi | ||
|
||
echo "Aleph file is invalid; fixing" | ||
|
||
# remount /sysroot as writable | ||
mount -o rw,remount /sysroot | ||
|
||
# remove field "build" | ||
fixed_aleph=$(jq 'del(.build)' ${ALEPH_FILE}) | ||
|
||
echo "$fixed_aleph" > ${ALEPH_FILE} | ||
|
||
echo "Aleph file is fixed" |