Update homarr.sh

- fix backup/restore paths
- keep backups until the next update (root directory)
This commit is contained in:
tteckster 2023-11-16 18:20:09 -05:00 committed by GitHub
parent 48f5906246
commit 26230754af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,13 +55,15 @@ header_info
if [[ ! -d /opt/homarr ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_info "Updating $APP (Patience)"
systemctl stop homarr
cp -Rf /opt/homarr/data /opt/homarr/data-backup
cp -Rf /opt/homarr/database /opt/homarr/data-backup
rm -rf /root/data-homarr-backup
rm -rf /root/database-homarr-backup
cp -R /opt/homarr/data /root/data-homarr-backup
cp -R /opt/homarr/database /root/database-homarr-backup
RELEASE=$(curl -s https://api.github.com/repos/ajnart/homarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
wget -q -O- https://github.com/ajnart/homarr/archive/refs/tags/v${RELEASE}.tar.gz | tar -xz -C /opt
cp -Rf /opt/homarr-${RELEASE}/* /opt/homarr/
cp -Rf /opt/homarr/data-backup/* /opt/homarr/
rm -rf /opt/homarr-${RELEASE} /opt/homarr/data-backup
cp -R /root/data-homarr-backup/* /opt/homarr/data
cp -R /root/database-homarr-backup/* /opt/homarr/database
rm -rf /opt/homarr-${RELEASE}
cd /opt/homarr
yarn install &>/dev/null
yarn build &>/dev/null