Skip to content

Commit

Permalink
Reinstate chdir in Chroot
Browse files Browse the repository at this point in the history
  • Loading branch information
Lockszmith-GH committed Jul 1, 2024
1 parent 79fb4b1 commit 217cf61
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions jlmkr.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,14 @@ def __init__(self, new_root):
def __enter__(self):
self.old_root = os.open("/", os.O_PATH)
self.initial_cwd = os.path.abspath(os.getcwd())
# os.chdir(self.new_root)
os.chdir(self.new_root)
os.chroot(".")

def __exit__(self, exc_type, exc_value, traceback):
# os.chdir(self.old_root)
os.chdir(self.old_root)
os.chroot(".")
os.close(self.old_root)
# os.chdir(self.initial_cwd)
os.chdir(self.initial_cwd)


def eprint(*args, **kwargs):
Expand Down Expand Up @@ -591,7 +591,8 @@ def start_jail(jail_name):

systemd_run_additional_args = [
f"--unit={SHORTNAME}-{jail_name}",
f"--working-directory=./{jail_path}",
#f"--working-directory=./{jail_path}",
f"--working-directory={jail_path}",
f"--description=My nspawn jail {jail_name} [created with jailmaker]",
]

Expand Down

0 comments on commit 217cf61

Please sign in to comment.