Skip to content

Commit 111d317

Browse files
committed
Update deb backup search paths
1 parent 07a5729 commit 111d317

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

debian/postinst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,21 @@ setup_self_restore() {
8484
backup_deb=$(find /var/cache/apt/archives/ -name "${PACKAGE_NAME}_*.deb" -type f 2>/dev/null | sort -V | tail -1)
8585
fi
8686

87-
# 3. Check /tmp/ (where Ansible downloads it)
87+
# 3. Check /tmp/ (Ansible downloads here; shadow sync SCPs as unifi-on-boot.deb)
8888
if [ -z "${backup_deb}" ]; then
89-
backup_deb=$(find /tmp/ -maxdepth 1 -name "${PACKAGE_NAME}_*.deb" -type f 2>/dev/null | sort -V | tail -1)
89+
backup_deb=$(find /tmp/ -maxdepth 1 \( -name "${PACKAGE_NAME}_*.deb" -o -name "${PACKAGE_NAME}.deb" \) -type f 2>/dev/null | sort -V | tail -1)
9090
fi
9191

9292
# 4. Check common manual install locations (/root, /home)
9393
if [ -z "${backup_deb}" ]; then
94-
backup_deb=$(find /root/ /home/ -maxdepth 2 -name "${PACKAGE_NAME}_*.deb" -type f 2>/dev/null | sort -V | tail -1)
94+
backup_deb=$(find /root/ /home/ -maxdepth 2 \( -name "${PACKAGE_NAME}_*.deb" -o -name "${PACKAGE_NAME}.deb" \) -type f 2>/dev/null | sort -V | tail -1)
9595
fi
9696

9797
if [ -n "${backup_deb}" ] && [ -f "${backup_deb}" ]; then
9898
cp "${backup_deb}" "${DATA_DIR}/${PACKAGE_NAME}.deb"
9999
echo "${PACKAGE_NAME}: backed up .deb to ${DATA_DIR} (from ${backup_deb})"
100+
# Also copy to /tmp so shadow sync and subsequent installs can find it
101+
cp "${backup_deb}" "/tmp/${PACKAGE_NAME}.deb" 2>/dev/null || true
100102
else
101103
echo "${PACKAGE_NAME}: WARNING: could not find .deb to backup (self-restore may need Ansible re-deploy)"
102104
fi

0 commit comments

Comments
 (0)