Merged PR #680 - improved installation.arch_chroot()
Improved run_as for installation.arch_chroot()
This commit is contained in:
commit
e411ff0abb
|
|
@ -2,6 +2,7 @@ import time
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import shlex
|
||||||
import pathlib
|
import pathlib
|
||||||
import subprocess
|
import subprocess
|
||||||
import glob
|
import glob
|
||||||
|
|
@ -285,9 +286,9 @@ class Installer:
|
||||||
def run_command(self, cmd, *args, **kwargs):
|
def run_command(self, cmd, *args, **kwargs):
|
||||||
return SysCommand(f'/usr/bin/arch-chroot {self.target} {cmd}')
|
return SysCommand(f'/usr/bin/arch-chroot {self.target} {cmd}')
|
||||||
|
|
||||||
def arch_chroot(self, cmd, *args, **kwargs):
|
def arch_chroot(self, cmd, run_as=None):
|
||||||
if 'runas' in kwargs:
|
if run_as:
|
||||||
cmd = f"su - {kwargs['runas']} -c \"{cmd}\""
|
cmd = f"su - {run_as} -c {shlex.quote(cmd)}"
|
||||||
|
|
||||||
return self.run_command(cmd)
|
return self.run_command(cmd)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue