File: distrobox

package info (click to toggle)
distrobox 1.8.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,528 kB
  • sloc: sh: 5,992; makefile: 4
file content (108 lines) | stat: -rwxr-xr-x 2,271 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-only
#
# This file is part of the distrobox project:
#    https://github.com/89luca89/distrobox
#
# Copyright (C) 2021 distrobox contributors
#
# distrobox is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3
# as published by the Free Software Foundation.
#
# distrobox is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with distrobox; if not, see <http://www.gnu.org/licenses/>.

# POSIX
set -o errexit
set -o nounset

version="1.8.2.4"

# show_help will print usage to stdout.
# Arguments:
#   None
# Expected global variables:
#   version: distrobox version
# Expected env variables:
#   None
# Outputs:
#   print usage with examples.
show_help()
{
	cat << EOF
distrobox version: ${version}

Choose one of the available commands:
	assemble
	create
	enter
	list | ls
	rm
	stop
	upgrade
	ephemeral
	generate-entry
	version
	help
EOF
}

if [ $# -eq 0 ]; then
	show_help
	exit
fi

distrobox_path="$(dirname "${0}")"
distrobox_command="${1}"
shift

# Simple wrapper to the distrobox utilities.
# We just detect the 1st argument and launch the matching distrobox utility.
case "${distrobox_command}" in
	assemble)
		"${distrobox_path}"/distrobox-assemble "$@"
		;;
	create)
		"${distrobox_path}"/distrobox-create "$@"
		;;
	enter)
		"${distrobox_path}"/distrobox-enter "$@"
		;;
	ls | list)
		"${distrobox_path}"/distrobox-list "$@"
		;;
	stop)
		"${distrobox_path}"/distrobox-stop "$@"
		;;
	rm)
		"${distrobox_path}"/distrobox-rm "$@"
		;;
	upgrade)
		"${distrobox_path}"/distrobox-upgrade "$@"
		;;
	generate-entry)
		"${distrobox_path}"/distrobox-generate-entry "$@"
		;;
	ephemeral)
		"${distrobox_path}"/distrobox-ephemeral "$@"
		;;
	-V | --version | version)
		printf "distrobox: %s\n" "${version}"
		exit 0
		;;
	help | --help | -h)
		show_help
		exit 0
		;;
	*) # Default case: If no more options then break out of the loop.
		printf >&2 "Error: invalid command\n"
		show_help
		exit 1
		;;
esac