Skip to content

Commit c833438

Browse files
mvo5thozza
authored andcommitted
ctl: only install dnf4 if it is missing
Tiny tweak, we only need to install dnf4 when its actually missing. This is also the only piece in the code that requires root right now (AFAICT) so dropping it has the extra benefit that we can run as non-root again.
1 parent 6ed4920 commit c833438

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ctl/pull.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import contextlib
1010
import errno
1111
import os
12+
import shutil
1213
import subprocess
1314
import sys
1415
import tempfile
@@ -71,7 +72,8 @@ def __exit__(self, exc_type, exc_value, exc_tb):
7172
self._exitstack = None
7273

7374
def _run_reposync(self):
74-
subprocess.run(["dnf", "install", "-y", "dnf4"], stdout=subprocess.PIPE, check=True)
75+
if not shutil.which("dnf4"):
76+
subprocess.run(["dnf", "install", "-y", "dnf4"], stdout=subprocess.PIPE, check=True)
7577

7678
cmd = [
7779
"dnf4", "reposync",

0 commit comments

Comments
 (0)