Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stages/ostree.preptree: fix machine-id detection #600

Merged
merged 1 commit into from Mar 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions stages/org.osbuild.ostree.preptree
Expand Up @@ -108,6 +108,13 @@ def main(tree, options):
initramfs = options.get("initramfs-args", [])
tmp_is_dir = options.get("tmp-is-dir", True)

# rpm-ostree will either ensure that machine-id is empty
# when machineid-compat is 'true' is or will remove it
# otherwise. Since we have to decide, detect the current
# state and make rpm-ostree follow suit
machineid_compat = os.path.exists(f"{tree}/etc/machine-id")
print(f"ostree: machineid-compat: {machineid_compat}")

# Move /etc to /usr
os.rename(f"{tree}/etc", f"{tree}/usr/etc")

Expand Down Expand Up @@ -137,13 +144,6 @@ def main(tree, options):
if os.path.lexists(f"{root}/{name}"):
move(name, root, tree)

# rpm-ostree will either ensure that machine-id is empty
# when machineid-compat is 'true' is or will remove it
# otherwise. Since we have to decide, detect the current
# state and make rpm-ostree follow suit
machineid_compat = os.path.exists(f"{tree}/etc/machine-id")
print(f"ostree: machineid-compat: {machineid_compat}")

treefile = ostree.Treefile()
treefile["boot-location"] = "new"
treefile["machineid-compat"] = machineid_compat
Expand Down