Support Debian in toolbox/distrobox command check (#88)
* Support Debian in toolbox command check Debian requires distrobox, like Ubuntu. This is a simple change to add support for it. * Consolidation of logic copilot complained, so used this as an opportunity to collapse unnecessary evals.
This commit is contained in:
+6
-11
@@ -21,26 +21,21 @@ function usage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check OS and set appropriate toolbox command
|
# Check OS and set appropriate toolbox command
|
||||||
IS_UBUNTU=false
|
|
||||||
if [ -f /etc/os-release ]; then
|
if [ -f /etc/os-release ]; then
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
if [ "$ID" = "ubuntu" ]; then
|
if [ "$ID" = "ubuntu" ] || [ "$ID" = "debian" ]; then
|
||||||
IS_UBUNTU=true
|
TOOLBOX_CMD="distrobox"
|
||||||
|
else
|
||||||
|
TOOLBOX_CMD="toolbox"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$IS_UBUNTU" = true ]; then
|
|
||||||
TOOLBOX_CMD="distrobox"
|
|
||||||
else
|
|
||||||
TOOLBOX_CMD="toolbox"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check dependencies
|
# Check dependencies
|
||||||
DEPENDENCIES=("podman" "$TOOLBOX_CMD")
|
DEPENDENCIES=("podman" "$TOOLBOX_CMD")
|
||||||
for cmd in "${DEPENDENCIES[@]}"; do
|
for cmd in "${DEPENDENCIES[@]}"; do
|
||||||
if ! command -v "$cmd" > /dev/null; then
|
if ! command -v "$cmd" > /dev/null; then
|
||||||
if [ "$cmd" = "distrobox" ] && [ "$IS_UBUNTU" = true ]; then
|
if [ "$cmd" = "distrobox" ]; then
|
||||||
echo "Error: 'distrobox' is not installed. Ubuntu users must use distrobox instead of toolbox." >&2
|
echo "Error: 'distrobox' is not installed. Debian-based distributions (like Ubuntu) must use distrobox instead of toolbox." >&2
|
||||||
echo "Please install distrobox (e.g., sudo apt install distrobox) and try again." >&2
|
echo "Please install distrobox (e.g., sudo apt install distrobox) and try again." >&2
|
||||||
else
|
else
|
||||||
echo "Error: '$cmd' is not installed." >&2
|
echo "Error: '$cmd' is not installed." >&2
|
||||||
|
|||||||
Reference in New Issue
Block a user