improve help outputs

This commit is contained in:
89luca89
2021-12-10 09:28:16 +01:00
parent da70f3b653
commit 3a561e5400
5 changed files with 48 additions and 16 deletions
+11 -8
View File
@@ -33,6 +33,11 @@ show_help() {
cat <<EOF
distrobox version: ${version}
distrobox-create takes care of creating the container with input name and image.
Created container will be tightly integrated with the host, allowing to share
the HOME folder of the user, external storage, external usb devices and
graphical apps (X11/Wayland) and audio.
Usage:
distrobox-create --image registry.fedoraproject.org/fedora-toolbox:35 --name fedora-toolbox-35
@@ -42,7 +47,6 @@ Options:
--help/-h: show this message
--verbose/-v: show more verbosity
--version/-V: show version
"
EOF
}
@@ -101,6 +105,7 @@ generate_command() {
# Set the container hostname the same as the container name.
# use the host's namespace for ipc, network, pid, ulimit
result_command="podman create"
# add podman verbose if -v is specified
if [ "${verbose}" -ne 0 ]; then
result_command="${result_command} --log-level debug"
fi
@@ -141,9 +146,10 @@ generate_command() {
result_command="${result_command} --volume ${host_directory}:/run/host${host_directory}:rslave"
fi
done
# those are dynamic configs needed by the container to function properly
# and integrate with the host
host_links="/etc/host.conf /etc/hosts /etc/resolv.conf /etc/localtime /etc/timezone"
host_links="/etc/host.conf /etc/hosts /etc/resolv.conf /etc/localtime"
for host_link in ${host_links}; do
# Check if the file exists first
if [ -f "${host_link}" ]; then
@@ -152,10 +158,6 @@ generate_command() {
fi
done
if [ -d /run/media ]; then
result_command="${result_command} --volume /run/media:/run/media:rslave"
fi
# mount also the XDG_RUNTIME_DIR to ensure functionality of the apps
if [ -d /run/user/"${container_user_uid}" ]; then
result_command="${result_command} --volume /run/user/${container_user_uid}:/run/user/${container_user_uid}"
@@ -211,5 +213,6 @@ if ! podman image exists "${container_image}"; then
fi
# Generate the command and execute
# shellcheck disable=SC2046
eval $(generate_command)
cmd="$(generate_command)"
# shellcheck disable=SC2086
eval ${cmd}
+8 -3
View File
@@ -28,6 +28,10 @@ show_help() {
cat <<EOF
distrobox version: ${version}
distrobox-enter takes care of entering the container with the name specified.
Default command executed is your SHELL, buf you can specify different shells or
entire commands to execute.
Usage:
distrobox-enter --name fedora-toolbox-35 -- bash -l
@@ -37,7 +41,6 @@ Options:
--help/-h: show this message
--verbose/-v: show more verbosity
--version/-V: show version
"
EOF
}
@@ -117,6 +120,7 @@ podman logs -f ${container_name}"
# entering container using our user and workdir
result_command="podman exec"
# add podman verbose if -v is specified
if [ "${verbose}" -ne 0 ]; then
result_command="${result_command} --log-level debug"
fi
@@ -134,5 +138,6 @@ podman logs -f ${container_name}"
}
# Generate the command and execute
# shellcheck disable=SC2046
eval $(generate_command)
cmd="$(generate_command)"
# shellcheck disable=SC2086
eval ${cmd}
+20 -2
View File
@@ -33,11 +33,30 @@ show_help() {
cat <<EOF
distrobox version: ${version}
distrobox-export takes care of exporting an app or a service from the container
to the host.
Exported app will be easily available in your normal launcher and it will
automatically be launched from the container it is exported from.
Exported servicess will be available in the host's user's systemd session, so
systemctl --user status exported_service_name
will show the status of the service exported.
You can specifi additional flags to add to the command, for example if you want
to export an electron app, you could add the "--foreground" flag to the command:
distrobox-export --app atom --extra-flags "--foreground"
This works for both services and apps.
Note you can use --app OR --service but not together.
Usage:
distrobox-export --app mpv
distrobox-export --service syncthing
Note you can use --app OR --service but not together.
Options:
--app/-a: name of the application to export
@@ -47,7 +66,6 @@ Options:
--extra-flags/-ef: extra flags to add to the command
--verbose/-v: show more verbosity
--version/-V: show version
"
EOF
}
+9 -2
View File
@@ -20,6 +20,14 @@ show_help() {
cat <<EOF
distrobox version: ${version}
distrobox-init is the entrypoint of a created distrobox.
Note that this HAS to run from inside a distrobox, will not work if you run it
from your host.
distrobox-init will take care of installing missing dependencies (eg. sudo), set
up the user and groups, mount folders from the host to ensure the tight
integration.
Usage:
distrobox-init --name ${USER} --user $(id -ru) --group $(id -rg) --home ${HOME}
@@ -32,7 +40,6 @@ Options:
--help/-h: show this message
--verbose/-v: show more verbosity
--version/-V: show version
"
EOF
}
@@ -208,7 +215,7 @@ done
# We'll also bind mount READ-WRITE useful mountpoints to pass external drives and libvirt from
# the host to the container
HOST_MOUNTS="/media /mnt /run/systemd/journal /run/libvirt /var/mnt /var/lib/libvirt"
HOST_MOUNTS="/media /run/media /mnt /run/systemd/journal /run/libvirt /var/mnt /var/lib/libvirt"
for host_mount in ${HOST_MOUNTS}; do
mount_bind /run/host"${host_mount}" "${host_mount}" rw
done
-1
View File
@@ -17,7 +17,6 @@ Options:
--path/-p: path where to deploy the files (default /usr/local/bin)
--help/-h: show this message
-v: show more verbosity
"
EOF
}