Compare commits

...

2 Commits

Author SHA1 Message Date
aa6bf06cd7 Merge pull request 'fix mv path' (#11) from profilarr-script into dev
Reviewed-on: #11
2025-07-21 14:45:45 +02:00
aed40090ef fix mv path 2025-07-21 14:45:06 +02:00
2 changed files with 32 additions and 8 deletions

View File

@ -32,7 +32,11 @@ function update_script() {
fi
setup_uv
# Crawling the new version and checking whether an update is required
RELEASE=$(curl -fsSL https://api.github.com/repos/Dictionarry-Hub/profilarr/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')
RELEASE=$(curl -fsSL https://api.github.com/repos/Dictionarry-Hub/profilarr/releases/latest | grep "tag_name" | cut -d'"' -f4)
if [[ -z "$RELEASE" ]]; then
msg_error "Failed to fetch latest release version"
exit 1
fi
if [[ -f /opt/${APP}_version.txt ]] && [[ "${RELEASE}" == "$(cat /opt/${APP}_version.txt)" ]]; then
msg_ok "No update required. ${APP} is already at ${RELEASE}"
exit
@ -57,9 +61,17 @@ function update_script() {
temp_file=$(mktemp)
curl -fsSL -o "$temp_file" "https://github.com/Dictionarry-Hub/profilarr/archive/refs/tags/${RELEASE}.zip"
unzip -q -o "$temp_file" -d /tmp
# Find the actual extracted directory name
EXTRACTED_DIR=$(find /tmp -maxdepth 1 -name "profilarr-*" -type d | head -n1)
if [[ -z "$EXTRACTED_DIR" ]]; then
msg_error "Failed to find extracted directory"
exit 1
fi
rm -rf /opt/${APP}/backend /opt/${APP}/frontend
mv "/tmp/profilarr-${RELEASE}/backend" /opt/${APP}/
mv "/tmp/profilarr-${RELEASE}/frontend" /opt/${APP}/
mv "${EXTRACTED_DIR}/backend" /opt/${APP}/
mv "${EXTRACTED_DIR}/frontend" /opt/${APP}/
# Update Python dependencies
msg_info "Updating Python dependencies"
@ -96,7 +108,7 @@ function update_script() {
# Cleaning up
msg_info "Cleaning Up"
rm -f "$temp_file"
rm -rf "/tmp/profilarr-${RELEASE}"
rm -rf "$EXTRACTED_DIR"
msg_ok "Cleanup Completed"
# Last Action

View File

@ -36,14 +36,26 @@ NODE_VERSION="20" install_node_and_modules
msg_ok "Installed Node.js"
msg_info "Setup ${APPLICATION}"
RELEASE=$(curl -fsSL https://api.github.com/repos/Dictionarry-Hub/profilarr/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')
RELEASE=$(curl -fsSL https://api.github.com/repos/Dictionarry-Hub/profilarr/releases/latest | grep "tag_name" | cut -d'"' -f4)
if [[ -z "$RELEASE" ]]; then
msg_error "Failed to fetch latest release version"
exit 1
fi
temp_file=$(mktemp)
$STD curl -fsSL -o "$temp_file" "https://github.com/Dictionarry-Hub/profilarr/archive/refs/tags/${RELEASE}.zip"
$STD unzip -q "$temp_file" -d /tmp
$STD mkdir -p /opt/${APPLICATION}
$STD mkdir -p /opt/${APPLICATION}_config
$STD mv "/tmp/profilarr-${RELEASE}/backend" /opt/${APPLICATION}/
$STD mv "/tmp/profilarr-${RELEASE}/frontend" /opt/${APPLICATION}/
# Find the actual extracted directory name
EXTRACTED_DIR=$(find /tmp -maxdepth 1 -name "profilarr-*" -type d | head -n1)
if [[ -z "$EXTRACTED_DIR" ]]; then
msg_error "Failed to find extracted directory"
exit 1
fi
$STD mv "${EXTRACTED_DIR}/backend" /opt/${APPLICATION}/
$STD mv "${EXTRACTED_DIR}/frontend" /opt/${APPLICATION}/
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
$STD uv venv /opt/${APPLICATION}/venv
$STD uv pip install --python /opt/${APPLICATION}/venv/bin/python -r /opt/${APPLICATION}/backend/requirements.txt
@ -85,7 +97,7 @@ customize
msg_info "Cleaning up"
rm -f "$temp_file"
rm -rf "/tmp/profilarr-${RELEASE}"
rm -rf "$EXTRACTED_DIR"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"