From 570923497d58c2d4456868b87b1507d86c6fe7ff Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Mon, 7 Apr 2025 15:32:51 +0200 Subject: [PATCH] install files to /home/l_samenv without sudo --- install.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/install.py b/install.py index 16a2467..352d86f 100755 --- a/install.py +++ b/install.py @@ -158,22 +158,14 @@ box = BoxInfo() box.hostname_changed = False dhcp_server_cfg = [] -TO_SYSTEM = [TOOLS / 'to_system', TOOLS / f'{box.typ}_system'] +TO_SYSTEM = TOOLS / 'to_system', TOOLS / f'{box.typ}_system'] def do_cmd(*command): - unix_cmd(*command, execute=doit) # with sudo + unix_cmd(*command, execute=doit) # sudo=True by default show.dirty = True -def copyfiles(srcdir, dstdir, files): - unix_cmd('cp', *(str(srcdir / f) for f in files), str(dstdir)) - - -def deletefiles(srcdir, files): - unix_cmd('rm', '-f', *(str(srcdir / f) for f in files)) - - def frappy(cfg=None, port=None, requirements='', **kwds): if not cfg: return None @@ -472,14 +464,15 @@ class Show(Walker): class Do(Walker): def newer(self, files): - copyfiles(self.syspath, self.dirpath, files) + unix_cmd('cp', *(str(srcdir / f) for f in files), str(dstdir), + sudo=not dstdir.is_relative_to('/home/l_samenv')) older = newer missing = newer def delete(self, files): - deletefiles(self.syspath, files) + unix_cmd('rm', '-f', *(str(srcdir / f) for f in files)) def handle_config():