feat: Implement OS-aware toolbox command selection (toolbox vs distrobox) in the script and clarify usage in the README.
This commit is contained in:
@@ -66,7 +66,7 @@ You can check the containers on DockerHub: [kyuz0/amd-strix-halo-toolboxes](http
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Create & Enter Toolbox
|
||||
Create and enter your toolbox of choice. **(Ubuntu users: remember to use `distrobox` instead of `toolbox` in the commands below).**
|
||||
|
||||
**Option A: Vulkan (RADV/AMDVLK)** - best for compatibility
|
||||
```sh
|
||||
@@ -86,7 +86,6 @@ toolbox create llama-rocm-7.2 \
|
||||
|
||||
toolbox enter llama-rocm-7.2
|
||||
```
|
||||
*(Ubuntu users: use [Distrobox](https://github.com/89luca89/distrobox) as `toolbox` may break GPU access).*
|
||||
|
||||
### 2. Check GPU Access
|
||||
Inside the toolbox:
|
||||
|
||||
+29
-5
@@ -20,9 +20,33 @@ function usage() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check OS and set appropriate toolbox command
|
||||
IS_UBUNTU=false
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
if [ "$ID" = "ubuntu" ]; then
|
||||
IS_UBUNTU=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$IS_UBUNTU" = true ]; then
|
||||
TOOLBOX_CMD="distrobox"
|
||||
else
|
||||
TOOLBOX_CMD="toolbox"
|
||||
fi
|
||||
|
||||
# Check dependencies
|
||||
for cmd in podman toolbox; do
|
||||
command -v "$cmd" > /dev/null || { echo "Error: '$cmd' is not installed." >&2; exit 1; }
|
||||
DEPENDENCIES=("podman" "$TOOLBOX_CMD")
|
||||
for cmd in "${DEPENDENCIES[@]}"; do
|
||||
if ! command -v "$cmd" > /dev/null; then
|
||||
if [ "$cmd" = "distrobox" ] && [ "$IS_UBUNTU" = true ]; then
|
||||
echo "Error: 'distrobox' is not installed. Ubuntu users must use distrobox instead of toolbox." >&2
|
||||
echo "Please install distrobox (e.g., sudo apt install distrobox) and try again." >&2
|
||||
else
|
||||
echo "Error: '$cmd' is not installed." >&2
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$#" -lt 1 ]; then
|
||||
@@ -53,9 +77,9 @@ for name in "${SELECTED_TOOLBOXES[@]}"; do
|
||||
echo "🔄 Refreshing $name (image: $image)"
|
||||
|
||||
# Remove the toolbox if it exists
|
||||
if toolbox list | grep -q "$name"; then
|
||||
if $TOOLBOX_CMD list | grep -q "$name"; then
|
||||
echo "🧹 Removing existing toolbox: $name"
|
||||
toolbox rm -f "$name"
|
||||
$TOOLBOX_CMD rm -f "$name"
|
||||
fi
|
||||
|
||||
echo "⬇️ Pulling latest image: $image"
|
||||
@@ -64,7 +88,7 @@ for name in "${SELECTED_TOOLBOXES[@]}"; do
|
||||
|
||||
|
||||
echo "📦 Recreating toolbox: $name"
|
||||
toolbox create "$name" --image "$image" -- $options
|
||||
$TOOLBOX_CMD create "$name" --image "$image" -- $options
|
||||
|
||||
# --- Cleanup: remove dangling images ---
|
||||
repo="${image%:*}"
|
||||
|
||||
Reference in New Issue
Block a user