forked from TheWrightServer/ProxmoxVE
[Bug] | [Change]: Homarr (+Script harmonized) (#124)
* [Bug] | [Change]: Homarr (+Script harmonized) * Update ct/homarr.sh Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * add ttekc Signed-off-by: CanbiZ <47820557+MickLesk@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * fix echo Signed-off-by: CanbiZ <47820557+MickLesk@users.noreply.github.com> * Final Fix Signed-off-by: CanbiZ <47820557+MickLesk@users.noreply.github.com> * remove cd /opt Signed-off-by: CanbiZ <47820557+MickLesk@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> --------- Signed-off-by: CanbiZ <47820557+MickLesk@users.noreply.github.com> Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com>
This commit is contained in:
parent
e26bb4e0bd
commit
a68f380d6b
50
ct/homarr.sh
50
ct/homarr.sh
@ -2,6 +2,7 @@
|
||||
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# Co-Author: MickLesk (Canbiz)
|
||||
# License: MIT
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
@ -54,20 +55,43 @@ function default_settings() {
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
if [[ ! -d /opt/homarr ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
|
||||
msg_info "Updating $APP (Patience)"
|
||||
systemctl stop homarr
|
||||
cd /opt/homarr
|
||||
if ! git pull; then
|
||||
echo "Already up to date."
|
||||
systemctl start homarr
|
||||
echo "No update required."
|
||||
exit
|
||||
if [[ ! -d /opt/homarr]]; then msg_error "No ${APP} Installation Found!"; exit; fi
|
||||
if (( $(df /boot | awk 'NR==2{gsub("%","",$5); print $5}') > 80 )); then
|
||||
read -r -p "Warning: Storage is dangerously low, continue anyway? <y/N> " prompt
|
||||
[[ ${prompt,,} =~ ^(y|yes)$ ]] || exit
|
||||
fi
|
||||
RELEASE=$(curl -s https://api.github.com/repos/ajnart/homarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop homarr
|
||||
msg_ok "Services Stopped"
|
||||
|
||||
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"
|
||||
unzip -q v${RELEASE}.zip
|
||||
mv homarr-${RELEASE} /opt/homarr
|
||||
mv /opt/.env /opt/homarr/.env
|
||||
mv /opt/data /opt/homarr/
|
||||
yarn install &>/dev/null
|
||||
yarn build &>/dev/null
|
||||
yarn db:migrate &>/dev/null
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated ${APP}"
|
||||
|
||||
msg_info "Starting Services"
|
||||
systemctl start homarr
|
||||
msg_ok "Started Services"
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
rm -rf v${RELEASE}.zip
|
||||
msg_ok "Cleaned"
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
fi
|
||||
yarn install
|
||||
yarn build
|
||||
systemctl start homarr
|
||||
msg_ok "Updated $APP"
|
||||
exit
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,10 @@
|
||||
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# Co-Author: MickLesk (Canbiz)
|
||||
# License: MIT
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/ajnart/homarr
|
||||
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
@ -17,7 +19,6 @@ msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y curl
|
||||
$STD apt-get install -y sudo
|
||||
$STD apt-get install -y mc
|
||||
$STD apt-get install -y git
|
||||
$STD apt-get install -y ca-certificates
|
||||
$STD apt-get install -y gnupg
|
||||
msg_ok "Installed Dependencies"
|
||||
@ -31,12 +32,14 @@ msg_ok "Set up Node.js Repository"
|
||||
msg_info "Installing Node.js/Yarn"
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y nodejs
|
||||
$STD npm install -g npm@latest
|
||||
$STD npm install -g yarn
|
||||
msg_ok "Installed Node.js/Yarn"
|
||||
|
||||
msg_info "Installing Homarr (Patience)"
|
||||
$STD git clone -b dev https://github.com/ajnart/homarr.git /opt/homarr
|
||||
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"
|
||||
unzip -q v${RELEASE}.zip
|
||||
mv homarr-${RELEASE} /opt/homarr
|
||||
cat <<EOF >/opt/homarr/.env
|
||||
DATABASE_URL="file:./database/db.sqlite"
|
||||
NEXTAUTH_URL="http://localhost:3000"
|
||||
@ -48,6 +51,7 @@ cd /opt/homarr
|
||||
$STD yarn install
|
||||
$STD yarn build
|
||||
$STD yarn db:migrate
|
||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
||||
msg_ok "Installed Homarr"
|
||||
|
||||
msg_info "Creating Service"
|
||||
@ -72,6 +76,7 @@ motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf v${RELEASE}.zip
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
|
Loading…
x
Reference in New Issue
Block a user