2023-08-16 12:57:18 +00:00
|
|
|
#!/usr/bin/env bash
|
2024-11-02 07:48:05 +00:00
|
|
|
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
2024-01-01 17:13:05 +00:00
|
|
|
# Copyright (c) 2021-2024 tteck
|
2023-08-16 12:57:18 +00:00
|
|
|
# Author: tteck (tteckster)
|
2024-11-08 10:34:07 +00:00
|
|
|
# Co-Author: MickLesk (Canbiz)
|
2023-08-16 12:57:18 +00:00
|
|
|
# License: MIT
|
2024-11-02 07:48:05 +00:00
|
|
|
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
2023-08-16 12:57:18 +00:00
|
|
|
|
|
|
|
function header_info {
|
|
|
|
clear
|
|
|
|
cat <<"EOF"
|
|
|
|
__ __
|
|
|
|
/ / / /___ ____ ___ ____ ___________
|
|
|
|
/ /_/ / __ \/ __ `__ \/ __ `/ ___/ ___/
|
|
|
|
/ __ / /_/ / / / / / / /_/ / / / /
|
|
|
|
/_/ /_/\____/_/ /_/ /_/\__,_/_/ /_/
|
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
header_info
|
|
|
|
echo -e "Loading..."
|
|
|
|
APP="Homarr"
|
2023-11-14 13:10:00 +00:00
|
|
|
var_disk="8"
|
2023-08-16 12:57:18 +00:00
|
|
|
var_cpu="2"
|
|
|
|
var_ram="2048"
|
|
|
|
var_os="debian"
|
|
|
|
var_version="12"
|
|
|
|
variables
|
|
|
|
color
|
|
|
|
catch_errors
|
|
|
|
|
|
|
|
function default_settings() {
|
|
|
|
CT_TYPE="1"
|
|
|
|
PW=""
|
|
|
|
CT_ID=$NEXTID
|
|
|
|
HN=$NSAPP
|
|
|
|
DISK_SIZE="$var_disk"
|
|
|
|
CORE_COUNT="$var_cpu"
|
|
|
|
RAM_SIZE="$var_ram"
|
|
|
|
BRG="vmbr0"
|
|
|
|
NET="dhcp"
|
|
|
|
GATE=""
|
2024-01-12 20:00:42 +00:00
|
|
|
APT_CACHER=""
|
|
|
|
APT_CACHER_IP=""
|
2023-08-16 12:57:18 +00:00
|
|
|
DISABLEIP6="no"
|
|
|
|
MTU=""
|
|
|
|
SD=""
|
|
|
|
NS=""
|
|
|
|
MAC=""
|
|
|
|
VLAN=""
|
|
|
|
SSH="no"
|
|
|
|
VERB="no"
|
|
|
|
echo_default
|
|
|
|
}
|
|
|
|
|
|
|
|
function update_script() {
|
|
|
|
header_info
|
2024-11-08 10:34:07 +00:00
|
|
|
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"
|
2024-04-15 03:53:59 +00:00
|
|
|
systemctl start homarr
|
2024-11-08 10:34:07 +00:00
|
|
|
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}"
|
2024-04-15 03:53:59 +00:00
|
|
|
fi
|
2023-08-16 12:57:18 +00:00
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
start
|
|
|
|
build_container
|
|
|
|
description
|
|
|
|
|
|
|
|
msg_ok "Completed Successfully!\n"
|
|
|
|
echo -e "${APP} should be reachable by going to the following URL.
|
|
|
|
${BL}http://${IP}:3000${CL} \n"
|