Skip to content

Commit

Permalink
Fix manifest command (and other minor bugfix relating to overlayfs)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaruni96 committed Nov 21, 2024
1 parent c216990 commit 9a9e765
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project tries to adhere to [Semantic Versioning](https://semver.org/spe

### Added

### Fixed
- Fixed a regression (because of native overlayfs' other implications) which broke command defined
in manifest

### Changed

### Removed
Expand Down
14 changes: 8 additions & 6 deletions src/maps
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,14 @@ def mode_run(args):
else:
opts = '-p'
subprocess.run(f"mkdir {opts} {os.getenv('HOME')}/Public".split(), check=True)
subprocess.run(f"mkdir {opts} {DATADIR}/live/home/runtime/Public".split(), check=True)

# check for manifest file
if os.path.isfile(f"{DATADIR}/live/manifest.toml"):
with open(f"{DATADIR}/live/manifest.toml", 'rb') as manifest_file:
if os.path.isfile(f"{DATADIR}/rwfs/manifest.toml"):
with open(f"{DATADIR}/rwfs/manifest.toml", 'rb') as manifest_file:
command = tomli.load(manifest_file)
command = command['Core']["command"]
elif os.path.isfile(f"{DATADIR}/rofs/manifest.toml"):
with open(f"{DATADIR}/rofs/manifest.toml", 'rb') as manifest_file:
command = tomli.load(manifest_file)
command = command['Core']["command"]
else:
Expand All @@ -294,7 +297,7 @@ def mode_run(args):
f"--overlay-src {DATADIR}/rofs --overlay {DATADIR}/rwfs "
f"{DATADIR}/tmpfs / --bind {HOME}/Public {senv['HOME']}/Public "
f"--ro-bind /sys /sys --die-with-parent --proc /proc --dev /dev "
f"--uid 0 --gid 0 {command} --verbose").split(), env=senv,
f"--uid 0 --gid 0 {command}").split(), env=senv,
check=False)
if rstatus.returncode != 0:
print(f"Sandbox exited with return code {rstatus.returncode}")
Expand Down Expand Up @@ -482,7 +485,6 @@ def checkout(repo, runtime):
subprocess.run(f"mkdir {opts1} {DATADIR}", shell=True, check=True)
subprocess.run(f"mkdir {opts1} {DATADIR}/rwfs".split(), check=True)
subprocess.run(f"mkdir {opts1} {DATADIR}/tmpfs".split(), check=True)
subprocess.run(f"mkdir {opts1} {DATADIR}/live".split(), check=True)

# checkout from local repo
tfd = os.open(DATADIR, os.O_RDONLY)
Expand Down Expand Up @@ -672,7 +674,7 @@ def reset(runtime):
opts = '-rvf'
else:
opts = '-rf'
subprocess.run(f"rm {opts} {DATADIR}/live/*".split(), check=True)
subprocess.run(f"rm {opts} {DATADIR}/rwfs/*".split(), check=True)
print(f"{runtime} reset successfully!")


Expand Down

0 comments on commit 9a9e765

Please sign in to comment.