Skip to content

Commit

Permalink
bindmount /proc for setting selinux context
Browse files Browse the repository at this point in the history
it seems on el9 "setfiles" now needs /proc to work properly
  • Loading branch information
michalskrivanek authored and sandrobonazzola committed Jun 9, 2022
1 parent f771727 commit 9a1e68c
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/imgbased/plugins/osupdater.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,17 +1039,18 @@ def _relabel_selinux(newroot):
imgbase.hooks.emit("os-upgraded", previous_lv.lv_name, new_lv.lvm_name)

with mounted(new_lv.path) as newroot:
with utils.bindmounted("/var", target=newroot.target + "/var",
rbind=True):
_update_grub_cmdline(newroot.target)
_update_fstab(newroot.target)
_relabel_selinux(newroot.target)
BootSetupHandler(
root=newroot.target,
mkconfig=(imgbase.mode == constants.IMGBASED_MODE_INIT),
mkinitrd=(imgbase.mode == constants.IMGBASED_MODE_UPDATE)
).setup()
bootloader.BootConfiguration.validate()
with utils.bindmounted("/proc", target=newroot.target + "/proc"):
with utils.bindmounted("/var", target=newroot.target + "/var",
rbind=True):
_update_grub_cmdline(newroot.target)
_update_fstab(newroot.target)
_relabel_selinux(newroot.target)
BootSetupHandler(
root=newroot.target,
mkconfig=(imgbase.mode == constants.IMGBASED_MODE_INIT),
mkinitrd=(imgbase.mode == constants.IMGBASED_MODE_UPDATE)
).setup()
bootloader.BootConfiguration.validate()


def on_remove_layer(imgbase, lv_fullname):
Expand Down

0 comments on commit 9a1e68c

Please # to comment.