mirror of
https://github.com/tteck/Proxmox.git
synced 2024-11-29 18:13:10 +01:00
Update ersatztv.sh
Refactor `function update_script ()` fixes https://github.com/tteck/Proxmox/issues/3404
This commit is contained in:
parent
2febf2c39b
commit
6c155c7463
@ -57,22 +57,20 @@ function default_settings() {
|
|||||||
function update_script() {
|
function update_script() {
|
||||||
header_info
|
header_info
|
||||||
if [[ ! -d /opt/ErsatzTV ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
|
if [[ ! -d /opt/ErsatzTV ]]; 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
|
|
||||||
msg_info "Stopping ErsatzTV"
|
msg_info "Stopping ErsatzTV"
|
||||||
systemctl stop ersatzTV
|
systemctl stop ersatzTV
|
||||||
msg_ok "Stopped ErsatzTV"
|
msg_ok "Stopped ErsatzTV"
|
||||||
|
|
||||||
msg_info "Updating ErsatzTV"
|
msg_info "Updating ErsatzTV"
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/ErsatzTV/ErsatzTV/releases | grep -oP '"tag_name": "\K[^"]+' | head -n 1)
|
RELEASE=$(curl -s https://api.github.com/repos/ErsatzTV/ErsatzTV/releases | grep -oP '"tag_name": "\K[^"]+' | head -n 1)
|
||||||
if [ -d /opt/ErsatzTV/ErsatzTV_bak ]; then
|
cp -R /opt/ErsatzTV/ ErsatzTV-backup
|
||||||
rm -rf /opt/ErsatzTV/ErsatzTV_bak
|
rm ErsatzTV-backup/ErsatzTV
|
||||||
fi
|
rm -rf /opt/ErsatzTV
|
||||||
mv /opt/ErsatzTV/ErsatzTV /opt/ErsatzTV/ErsatzTV_bak
|
|
||||||
wget -qO- "https://github.com/ErsatzTV/ErsatzTV/releases/download/${RELEASE}/ErsatzTV-${RELEASE}-linux-x64.tar.gz" | tar -xz -C /opt
|
wget -qO- "https://github.com/ErsatzTV/ErsatzTV/releases/download/${RELEASE}/ErsatzTV-${RELEASE}-linux-x64.tar.gz" | tar -xz -C /opt
|
||||||
mv "/opt/ErsatzTV-${RELEASE}-linux-x64" /opt/ErsatzTV
|
mv "/opt/ErsatzTV-${RELEASE}-linux-x64" /opt/ErsatzTV
|
||||||
|
cp -R ErsatzTV-backup/* /opt/ErsatzTV/
|
||||||
|
rm -rf ErsatzTV-backup
|
||||||
msg_ok "Updated ErsatzTV"
|
msg_ok "Updated ErsatzTV"
|
||||||
|
|
||||||
msg_info "Starting ErsatzTV"
|
msg_info "Starting ErsatzTV"
|
||||||
|
Loading…
Reference in New Issue
Block a user