Improved run_as for installation.arch_chroot()
This commit is contained in:
parent
b880849193
commit
b3aba8d855
|
|
@ -1,4 +1,5 @@
|
||||||
import time
|
import time
|
||||||
|
import shlex
|
||||||
from .disk import *
|
from .disk import *
|
||||||
from .hardware import *
|
from .hardware import *
|
||||||
from .locale_helpers import verify_keyboard_layout, verify_x11_keyboard_layout
|
from .locale_helpers import verify_keyboard_layout, verify_x11_keyboard_layout
|
||||||
|
|
@ -265,9 +266,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