change pip to uv
This commit is contained in:
@ -33,25 +33,12 @@ function update_script() {
|
|||||||
|
|
||||||
# Crawling the new version and checking whether an update is required
|
# Crawling the new version and checking whether an update is required
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/plexguide/Huntarr.io/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')
|
RELEASE=$(curl -fsSL https://api.github.com/repos/plexguide/Huntarr.io/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')
|
||||||
if [[ "${RELEASE}" != "$(cat /opt/huntarr_version.txt 2>/dev/null)" ]] || [[ ! -f /opt/huntarr_version.txt ]]; then
|
if [[ "${RELEASE}" != "$(cat /opt/huntarr_version.txt)" ]] || [[ ! -f /opt/huntarr_version.txt ]]; then
|
||||||
# Stopping Services
|
# Stopping Services
|
||||||
msg_info "Stopping $APP"
|
msg_info "Stopping $APP"
|
||||||
systemctl stop huntarr
|
systemctl stop huntarr
|
||||||
msg_ok "Stopped $APP"
|
msg_ok "Stopped $APP"
|
||||||
|
|
||||||
# Update system dependencies
|
|
||||||
msg_info "Checking system dependencies"
|
|
||||||
$STD apt-get update
|
|
||||||
$STD apt-get install -y \
|
|
||||||
curl \
|
|
||||||
tar \
|
|
||||||
unzip \
|
|
||||||
jq \
|
|
||||||
python3 \
|
|
||||||
python3-pip \
|
|
||||||
python3-venv
|
|
||||||
msg_ok "System dependencies updated"
|
|
||||||
|
|
||||||
# Creating Backup - maintain only one backup file
|
# Creating Backup - maintain only one backup file
|
||||||
msg_info "Creating Backup"
|
msg_info "Creating Backup"
|
||||||
# Remove any existing backups
|
# Remove any existing backups
|
||||||
@ -79,14 +66,19 @@ function update_script() {
|
|||||||
|
|
||||||
if [[ "$CURRENT_CHECKSUM" != "$STORED_CHECKSUM" ]]; then
|
if [[ "$CURRENT_CHECKSUM" != "$STORED_CHECKSUM" ]]; then
|
||||||
msg_info "Requirements have changed. Performing full upgrade."
|
msg_info "Requirements have changed. Performing full upgrade."
|
||||||
/opt/huntarr/venv/bin/pip install --upgrade -r requirements.txt
|
uv pip install -r requirements.txt --virtual-env /opt/huntarr/venv
|
||||||
else
|
else
|
||||||
msg_info "Requirements unchanged. Verifying installation."
|
msg_info "Requirements unchanged. Verifying installation."
|
||||||
/opt/huntarr/venv/bin/pip install -r requirements.txt
|
uv pip install -r requirements.txt --virtual-env /opt/huntarr/venv
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# First time update
|
# First time update - ensure UV is installed
|
||||||
/opt/huntarr/venv/bin/pip install --upgrade -r requirements.txt
|
if ! command -v uv &> /dev/null; then
|
||||||
|
msg_info "Installing UV package manager"
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
msg_ok "UV package manager installed"
|
||||||
|
fi
|
||||||
|
uv pip install -r requirements.txt --virtual-env /opt/huntarr/venv
|
||||||
fi
|
fi
|
||||||
# Store new checksum
|
# Store new checksum
|
||||||
md5sum requirements.txt | awk '{print $1}' >.requirements_checksum
|
md5sum requirements.txt | awk '{print $1}' >.requirements_checksum
|
||||||
|
|||||||
@ -19,15 +19,15 @@ REPO_NAME="Huntarr.io"
|
|||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt-get install -y \
|
$STD apt-get install -y \
|
||||||
curl \
|
|
||||||
tar \
|
|
||||||
unzip \
|
|
||||||
jq \
|
jq \
|
||||||
python3 \
|
python3 \
|
||||||
python3-pip \
|
|
||||||
python3-venv
|
python3-venv
|
||||||
msg_ok "Installed System Dependencies"
|
msg_ok "Installed System Dependencies"
|
||||||
|
|
||||||
|
msg_info "Setting up UV package installer"
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
msg_ok "UV package installer set up"
|
||||||
|
|
||||||
msg_info "Setup ${APPLICATION}"
|
msg_info "Setup ${APPLICATION}"
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/plexguide/Huntarr.io/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
RELEASE=$(curl -fsSL https://api.github.com/repos/plexguide/Huntarr.io/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
curl -fsSL -o "${RELEASE}.zip" "https://github.com/plexguide/Huntarr.io/archive/refs/tags/${RELEASE}.zip"
|
curl -fsSL -o "${RELEASE}.zip" "https://github.com/plexguide/Huntarr.io/archive/refs/tags/${RELEASE}.zip"
|
||||||
@ -38,12 +38,11 @@ echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
|||||||
msg_ok "Setup ${APPLICATION}"
|
msg_ok "Setup ${APPLICATION}"
|
||||||
|
|
||||||
msg_info "Setting up Python Environment"
|
msg_info "Setting up Python Environment"
|
||||||
$STD python3 -m venv /opt/${APPLICATION}/venv
|
$STD uv venv /opt/${APPLICATION}/venv
|
||||||
msg_ok "Created Python Virtual Environment"
|
msg_ok "Created Python Virtual Environment"
|
||||||
|
|
||||||
msg_info "Installing Python Dependencies"
|
msg_info "Installing Python Dependencies"
|
||||||
$STD /opt/${APPLICATION}/venv/bin/pip install --upgrade pip
|
$STD uv pip install -r /opt/${APPLICATION}/requirements.txt --virtual-env /opt/${APPLICATION}/venv
|
||||||
$STD /opt/${APPLICATION}/venv/bin/pip install -r /opt/${APPLICATION}/requirements.txt
|
|
||||||
msg_ok "Installed Python Dependencies"
|
msg_ok "Installed Python Dependencies"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
|
|||||||
Reference in New Issue
Block a user