fix mv path

This commit is contained in:
bilulib
2025-07-21 14:45:06 +02:00
parent 2c61e49140
commit aed40090ef
2 changed files with 32 additions and 8 deletions
+16 -4
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