distrobox/0003-distrobox-if-no-command-is-specified-default-to-ente.patch
Dario Faggioli ba14e7419d Accepting request 991532 from home:dfaggioli:microos-desktop
-------------------------------------------------------------------
Thu Jul 28 09:48:32 UTC 2022 - Dario Faggioli <dfaggioli@suse.com>

- Fix a (potential0 problem with man and manpages
  * Patch added:
    0002-distrobox-handle-situations-with-weird-manpages-setu.patch
- Default to distrobox-enter when only typing distrobox
  * Patch added:
    0003-distrobox-if-no-command-is-specified-default-to-ente.patch
- Reordered the patchqueue:
  * Patch removed:
    0002-opensuse-check-for-the-config-file-in-usr-etc-too.patch
  * Patch added:
    0004-opensuse-check-for-the-config-file-in-usr-etc-too.patch

-------------------------------------------------------------------
Wed Jul 27 11:31:23 UTC 2022 - Dario Faggioli <dfaggioli@suse.com>

- enable non-interactive mode by default
- Fix a but with automatic cretion of rootful containers
  * Patch added:
    0001-enter-fix-automatic-container-creation-when-r-is-use.patch
- Rework the /usr/etc config file patch (better changelog)
  * Patch removed:
    0001-Read-config-in-usr-etc-too.patch
  * Patch added:
    0002-opensuse-check-for-the-config-file-in-usr-etc-too.patch
- Switched to %autosetup in the spec file

OBS-URL: https://build.opensuse.org/request/show/991532
OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/distrobox?expand=0&rev=13
2022-07-28 11:35:04 +00:00

74 lines
1.9 KiB
Diff

From 0f1a928d310ea35465f892ff0bda563d110a4ce7 Mon Sep 17 00:00:00 2001
From: Dario Faggioli <dfaggioli@suse.com>
Date: Thu, 28 Jul 2022 10:10:28 +0200
Subject: [PATCH 3/4] distrobox: if no command is specified, default to enter
If just `distrobox` is invoked, without any command, assume
`distrobox enter`.
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
---
distrobox | 19 ++++++++++++-------
docs/README.md | 1 +
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/distrobox b/distrobox
index 4e37031..ce0469c 100755
--- a/distrobox
+++ b/distrobox
@@ -19,6 +19,11 @@
# along with distrobox; if not, see <http://www.gnu.org/licenses/>.
# POSIX
+# Optional env variables:
+# DBX_DEFAULT_COMMAND
+
+default_command="enter"
+[ -n "${DBX_DEFAULT_COMMAND}" ] && default_command="${DBX_DEFAULT_COMMAND}"
trap '[ "$?" -ne 0 ] && printf "\nAn error occurred\n"' EXIT
@@ -43,11 +48,6 @@ Choose one of the available commands:
EOF
}
-if [ $# -eq 0 ]; then
- show_help
- exit
-fi
-
# Handle 'help' here, before setting 'errexit', so we have a chance
# to show our help if the man command is there but fails.
if [ "$1" = "help" ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
@@ -62,8 +62,13 @@ set -o errexit
set -o nounset
distrobox_path="$(dirname "${0}")"
-distrobox_command="${1}"
-shift
+if [ $# -eq 0 ]; then
+ printf "No command specified. Assuming: distrobox-%s\n" "${default_command}"
+ distrobox_command="${default_command}"
+else
+ distrobox_command="${1}"
+ shift
+fi
# Simple wrapper to the distrobox utilities.
# We just detect the 1st argument and launch the matching distrobox utility.
diff --git a/docs/README.md b/docs/README.md
index df00785..64e4c0d 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -268,6 +268,7 @@ Alternatively it is possible to specify preferences using ENV variables:
- DBX_CONTAINER_NAME
- DBX_NON_INTERACTIVE
- DBX_SKIP_WORKDIR
+- DBX_DEFAULT_COMMAND
---
--
2.37.1