mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-25 09:35:54 +02:00
jw.pkg.cmds.distro.backend.suse.Util.zypper(): Add sudo
Add boolean parameter sudo to zypper(), doing the obvious. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
0b3f12866c
commit
fc1431ec48
1 changed files with 6 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from .....lib.util import run_cmd
|
||||
from ...Cmd import Cmd
|
||||
from ..Util import Util as Base
|
||||
|
||||
|
|
@ -10,13 +11,15 @@ class Util(Base):
|
|||
def __init__(self, parent: Cmd):
|
||||
super().__init__(parent)
|
||||
|
||||
async def zypper(self, args: list[str]):
|
||||
async def zypper(self, args: list[str], sudo: bool=True):
|
||||
cmd = ['/usr/bin/zypper']
|
||||
if not self.interactive:
|
||||
cmd.extend(['--non-interactive', '--gpg-auto-import-keys', '--no-gpg-checks'])
|
||||
cmd.extend(args)
|
||||
# Run sudo --login in case /etc/profile modifies ZYPP_CONF
|
||||
return await self._sudo(cmd, opts=['--login'])
|
||||
if sudo:
|
||||
# Run sudo --login in case /etc/profile modifies ZYPP_CONF
|
||||
return await self._sudo(cmd, opts=['--login'])
|
||||
return await run_cmd(cmd)
|
||||
|
||||
async def rpm(self, args: list[str], sudo=False):
|
||||
return await run_rpm(args, sudo=sudo)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue