forked from TheWrightServer/ProxmoxVE
Fix homarr update (#162)
This commit is contained in:
parent
e0df745ea1
commit
c229c9cb4a
30
ct/homarr.sh
30
ct/homarr.sh
@ -66,29 +66,37 @@ if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_v
|
|||||||
systemctl stop homarr
|
systemctl stop homarr
|
||||||
msg_ok "Services Stopped"
|
msg_ok "Services Stopped"
|
||||||
|
|
||||||
|
msg_info "Backing up Data"
|
||||||
|
mkdir -p /opt/homarr-data-backup
|
||||||
|
cp /opt/homarr/.env /opt/homarr-data-backup/.env
|
||||||
|
cp /opt/homarr/database/db.sqlite /opt/homarr-data-backup/db.sqlite
|
||||||
|
cp -r /opt/homarr/data/configs /opt/homarr-data-backup/configs
|
||||||
|
msg_ok "Backed up Data"
|
||||||
|
|
||||||
msg_info "Updating ${APP} to ${RELEASE}"
|
msg_info "Updating ${APP} to ${RELEASE}"
|
||||||
cp /opt/homarr/.env /opt/.env
|
|
||||||
cp -a /opt/homarr/data /opt/
|
|
||||||
rm -rf /opt/homarr
|
|
||||||
wget -q "https://github.com/ajnart/homarr/archive/refs/tags/v${RELEASE}.zip"
|
wget -q "https://github.com/ajnart/homarr/archive/refs/tags/v${RELEASE}.zip"
|
||||||
unzip -q v${RELEASE}.zip
|
unzip -q v${RELEASE}.zip
|
||||||
|
rm -rf v${RELEASE}.zip
|
||||||
|
rm -rf /opt/homarr
|
||||||
mv homarr-${RELEASE} /opt/homarr
|
mv homarr-${RELEASE} /opt/homarr
|
||||||
mv /opt/.env /opt/homarr/.env
|
mv /opt/homarr-data-backup/.env /opt/homarr/.env
|
||||||
rm -rf /opt/homarr/data
|
cd /opt/homarr
|
||||||
mv /opt/data /opt/homarr/
|
|
||||||
yarn install &>/dev/null
|
yarn install &>/dev/null
|
||||||
yarn build &>/dev/null
|
yarn build &>/dev/null
|
||||||
yarn db:migrate &>/dev/null
|
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||||
msg_ok "Updated ${APP}"
|
msg_ok "Updated ${APP}"
|
||||||
|
|
||||||
|
msg_info "Restoring Data"
|
||||||
|
rm -rf /opt/homarr/data/configs
|
||||||
|
mv /opt/homarr-data-backup/configs /opt/homarr/data/configs
|
||||||
|
mv /opt/homarr-data-backup/db.sqlite /opt/homarr/database/db.sqlite
|
||||||
|
yarn db:migrate &>/dev/null
|
||||||
|
rm -rf /opt/homarr-data-backup
|
||||||
|
msg_ok "Restored Data"
|
||||||
|
|
||||||
msg_info "Starting Services"
|
msg_info "Starting Services"
|
||||||
systemctl start homarr
|
systemctl start homarr
|
||||||
msg_ok "Started Services"
|
msg_ok "Started Services"
|
||||||
|
|
||||||
msg_info "Cleaning Up"
|
|
||||||
rm -rf v${RELEASE}.zip
|
|
||||||
msg_ok "Cleaned"
|
|
||||||
msg_ok "Updated Successfully"
|
msg_ok "Updated Successfully"
|
||||||
else
|
else
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||||
|
@ -39,6 +39,7 @@ msg_info "Installing Homarr (Patience)"
|
|||||||
RELEASE=$(curl -s https://api.github.com/repos/ajnart/homarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
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 "https://github.com/ajnart/homarr/archive/refs/tags/v${RELEASE}.zip"
|
wget -q "https://github.com/ajnart/homarr/archive/refs/tags/v${RELEASE}.zip"
|
||||||
unzip -q v${RELEASE}.zip
|
unzip -q v${RELEASE}.zip
|
||||||
|
rm -rf v${RELEASE}.zip
|
||||||
mv homarr-${RELEASE} /opt/homarr
|
mv homarr-${RELEASE} /opt/homarr
|
||||||
cat <<EOF >/opt/homarr/.env
|
cat <<EOF >/opt/homarr/.env
|
||||||
DATABASE_URL="file:./database/db.sqlite"
|
DATABASE_URL="file:./database/db.sqlite"
|
||||||
@ -76,7 +77,6 @@ motd_ssh
|
|||||||
customize
|
customize
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
rm -rf v${RELEASE}.zip
|
|
||||||
$STD apt-get -y autoremove
|
$STD apt-get -y autoremove
|
||||||
$STD apt-get -y autoclean
|
$STD apt-get -y autoclean
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user