# bubblewrap creates everything with a restricted mode so relax stuff as needed.
ops = []
- if not devices:
+ if not devices and not relaxed:
ops += ["chmod 1777 /dev/shm"]
- if not relaxed:
+ if relaxed and INVOKING_USER.home().exists() and len(INVOKING_USER.home().parents) > 1:
+ # We might mount a subdirectory of /home so /home will be created with the wrong permissions by bubblewrap so
+ # we need to fix up the permissions.
+ ops += [f"chmod 755 {list(INVOKING_USER.home().parents)[-1]}"]
+ else:
ops += ["chmod 755 /etc"]
ops += ["exec $0 \"$@\""]