install files to /home/l_samenv without sudo
This commit is contained in:
17
install.py
17
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():
|
||||
|
Reference in New Issue
Block a user