Skip to content

Commit

Permalink
rpm-ostree-bisect: support read-only /sysroot/
Browse files Browse the repository at this point in the history
On newer rpm-ostree systems /sysroot can be mounted read-only [1]
which means we can't pull commit metadata into the repo. Let's
remount it read-write if that's the case.

[1] ostreedev/ostree#1767
  • Loading branch information
dustymabe committed Nov 6, 2020
1 parent 295dd7b commit 1f7107c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions rpm-ostree-bisect
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@ def get_deployed_base_commit(deployment, repo):
commitid = OSTree.commit_get_parent(commit)
return commitid

"""
On newer rpm-ostree systems /sysroot has been mounted read-only
which means we can't pull commit metadata into the repo. Let's
remount it read-write if that's the case.
"""
def make_sysroot_readwrite():
stat = os.statvfs('/sysroot')
readonly = bool(stat.f_flag & os.ST_RDONLY)
if readonly:
cmd = ['/usr/bin/mount', '-o', 'remount,rw', '/sysroot']
subprocess.call(cmd)


"""
Initialize commit info ordered dict. The array will be a list of
Expand Down Expand Up @@ -433,6 +445,8 @@ def main():
fatal("Not in a booted OSTree system!")
_, repo = sysroot.get_repo(None)

make_sysroot_readwrite()

log("Using data file at: %s" % args.datafile)

if args.resume:
Expand Down

0 comments on commit 1f7107c

Please sign in to comment.