diff --git a/README.md b/README.md index c84f44b..ac43d74 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/refresh-toolboxes.sh b/refresh-toolboxes.sh index 84824f5..6c09b81 100755 --- a/refresh-toolboxes.sh +++ b/refresh-toolboxes.sh @@ -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%:*}"