From e6f41a3fd3957ec6c2bdba139c6776d8819d0f21 Mon Sep 17 00:00:00 2001 From: 89luca89 Date: Mon, 4 Apr 2022 21:46:23 +0200 Subject: [PATCH] create/enter: print error messages only when not in dry-run --- distrobox-create | 12 ++++++------ distrobox-enter | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/distrobox-create b/distrobox-create index 5a0daf9b..96e8d364 100755 --- a/distrobox-create +++ b/distrobox-create @@ -290,13 +290,13 @@ esac # Be sure we have a container manager to work with. if ! command -v "${container_manager}" > /dev/null; then # Error: we need at least one between docker or podman. - printf >&2 "Missing dependency: we need a container manager.\n" - printf >&2 "Please install one of podman or docker.\n" - printf >&2 "You can follow the documentation on:\n" - printf >&2 "\tman distrobox-compatibility\n" - printf >&2 "or:\n" - printf >&2 "\thttps://github.com/89luca89/distrobox/blob/main/docs/compatibility.md\n" if [ "${dryrun}" -eq 0 ]; then + printf >&2 "Missing dependency: we need a container manager.\n" + printf >&2 "Please install one of podman or docker.\n" + printf >&2 "You can follow the documentation on:\n" + printf >&2 "\tman distrobox-compatibility\n" + printf >&2 "or:\n" + printf >&2 "\thttps://github.com/89luca89/distrobox/blob/main/docs/compatibility.md\n" exit 127 fi fi diff --git a/distrobox-enter b/distrobox-enter index 1df83b51..0da13e18 100755 --- a/distrobox-enter +++ b/distrobox-enter @@ -196,13 +196,13 @@ esac # Be sure we have a container manager to work with. if ! command -v "${container_manager}" > /dev/null; then # Error: we need at least one between docker or podman. - printf >&2 "Missing dependency: we need a container manager.\n" - printf >&2 "Please install one of podman or docker.\n" - printf >&2 "You can follow the documentation on:\n" - printf >&2 "\tman distrobox-compatibility\n" - printf >&2 "or:\n" - printf >&2 "\thttps://github.com/89luca89/distrobox/blob/main/docs/compatibility.md\n" if [ "${dryrun}" -eq 0 ]; then + printf >&2 "Missing dependency: we need a container manager.\n" + printf >&2 "Please install one of podman or docker.\n" + printf >&2 "You can follow the documentation on:\n" + printf >&2 "\tman distrobox-compatibility\n" + printf >&2 "or:\n" + printf >&2 "\thttps://github.com/89luca89/distrobox/blob/main/docs/compatibility.md\n" exit 127 fi fi @@ -276,7 +276,7 @@ generate_command() { done # Start with the $PATH set in the container's config - container_paths="${container_PATH}" + container_paths="${container_PATH:-""}" # Ensure the standard FHS program paths are in PATH environment standard_paths="/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin" # add to the PATH after the existing paths, and only if not already present