Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions misc/tools.func
Original file line number Diff line number Diff line change
Expand Up @@ -758,8 +758,7 @@ import_local_ip() {
}

function setup_uv() {
msg_info "Checking uv installation..."

$STD msg_info "Checking uv installation..."
UV_BIN="/usr/local/bin/uv"
TMP_DIR=$(mktemp -d)
ARCH=$(uname -m)
Expand All @@ -786,18 +785,18 @@ function setup_uv() {
if [[ -x "$UV_BIN" ]]; then
INSTALLED_VERSION=$($UV_BIN -V | awk '{print $2}')
if [[ "$INSTALLED_VERSION" == "$LATEST_VERSION" ]]; then
msg_ok "uv is already at the latest version ($INSTALLED_VERSION)"
$STD msg_ok "uv is already at the latest version ($INSTALLED_VERSION)"
rm -rf "$TMP_DIR"
# set path
if [[ ":$PATH:" != *":/usr/local/bin:"* ]]; then
export PATH="/usr/local/bin:$PATH"
fi
return 0
else
msg_info "Updating uv from $INSTALLED_VERSION to $LATEST_VERSION"
$STD msg_info "Updating uv from $INSTALLED_VERSION to $LATEST_VERSION"
fi
else
msg_info "uv not found. Installing version $LATEST_VERSION"
$STD msg_info "uv not found. Installing version $LATEST_VERSION"
fi

# install or update uv
Expand All @@ -807,9 +806,15 @@ function setup_uv() {
rm -rf "$TMP_DIR"

# set path
if [[ ":$PATH:" != *":/usr/local/bin:"* ]]; then
export PATH="/usr/local/bin:$PATH"
fi

ensure_usr_local_bin_persist
msg_ok "uv installed/updated to $LATEST_VERSION"
}

function ensure_usr_local_bin_persist() {
local PROFILE_FILE="/etc/profile.d/custom_path.sh"

if [[ ! -f "$PROFILE_FILE" ]] && ! command -v pveversion &>/dev/null; then
echo 'export PATH="/usr/local/bin:$PATH"' >"$PROFILE_FILE"
chmod +x "$PROFILE_FILE"
fi
}