From 0679d55df661086d8fb3edc908334eef62f5c8df Mon Sep 17 00:00:00 2001 From: Pavin Joseph Date: Wed, 10 Apr 2024 20:08:56 +0530 Subject: [PATCH] Improve running command in chroot --- atomic-update | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/atomic-update b/atomic-update index aa968b6..8150963 100644 --- a/atomic-update +++ b/atomic-update @@ -28,7 +28,7 @@ from shlex import quote import xml.etree.ElementTree as ET # Constants -VERSION = "0.1.7" +VERSION = "0.1.8" ZYPPER_PID_FILE = "/run/zypp.pid" VALID_CMD = ["dup", "run", "rollback"] VALID_OPT = ["--reboot", "--apply", "--shell", "--continue", "--no-verify", \ @@ -425,8 +425,8 @@ chroot {TMP_MOUNT_DIR} mount -a; else: logging.info(f"Distribution upgrade completed successfully") elif COMMAND == "run": - exec_cmd = ' '.join(ARG) - logging.info(f"Running command {exec_cmd!r} within chroot...") + exec_cmd = " ".join( [quote(part) for part in ARG] ) + logging.info(f"Running command >>> {exec_cmd} <<< within chroot...") ret = os.system(f"chroot {TMP_MOUNT_DIR} {exec_cmd}") if ret != 0: logging.error(f"Command returned exit code {ret}")