chore: fileflows update script
This commit is contained in:
parent
9ff05c6cc9
commit
8d22ce9ba9
@ -25,45 +25,46 @@ function update_script() {
|
|||||||
check_container_resources
|
check_container_resources
|
||||||
|
|
||||||
# Check if installation is present | -f for file, -d for folder
|
# Check if installation is present | -f for file, -d for folder
|
||||||
if [[ ! -f [INSTALLATION_CHECK_PATH] ]]; then
|
if [[ ! -d /opt/fileflows ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Crawling the new version and checking whether an update is required
|
UPDATE_AVAILABLE=$(curl -s -X 'GET' "http://${IP}:19200/api/status/update-available" -H 'accept: application/json' | jq .UpdateAvailable)
|
||||||
RELEASE=$(curl -fsSL [RELEASE_URL] | [PARSE_RELEASE_COMMAND])
|
if [[ "${UPDATE_AVAILABLE}" == "true" ]]; then
|
||||||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
|
||||||
# Stopping Services
|
|
||||||
msg_info "Stopping $APP"
|
msg_info "Stopping $APP"
|
||||||
systemctl stop [SERVICE_NAME]
|
systemctl stop fileflows
|
||||||
msg_ok "Stopped $APP"
|
msg_ok "Stopped $APP"
|
||||||
|
|
||||||
# Creating Backup
|
# Creating Backup
|
||||||
msg_info "Creating Backup"
|
msg_info "Creating Backup"
|
||||||
tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" [IMPORTANT_PATHS]
|
tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" -C /opt/fileflows Data
|
||||||
msg_ok "Backup Created"
|
msg_ok "Backup Created"
|
||||||
|
|
||||||
# Execute Update
|
# Execute Update
|
||||||
msg_info "Updating $APP to v${RELEASE}"
|
msg_info "Updating $APP to latest version"
|
||||||
[UPDATE_COMMANDS]
|
temp_file=$(mktemp)
|
||||||
msg_ok "Updated $APP to v${RELEASE}"
|
wget -q https://fileflows.com/downloads/zip -O $temp_file
|
||||||
|
unzip -oq -d /opt/fileflows $temp_file
|
||||||
|
chmod +x /opt/fileflows/fileflows-systemd-entrypoint.sh
|
||||||
|
msg_ok "Updated $APP to latest version"
|
||||||
|
|
||||||
# Starting Services
|
# Starting Services
|
||||||
msg_info "Starting $APP"
|
msg_info "Starting $APP"
|
||||||
systemctl start [SERVICE_NAME]
|
systemctl start fileflows
|
||||||
msg_ok "Started $APP"
|
msg_ok "Started $APP"
|
||||||
|
|
||||||
# Cleaning up
|
# Cleaning up
|
||||||
msg_info "Cleaning Up"
|
msg_info "Cleaning Up"
|
||||||
rm -rf [TEMP_FILES]
|
rm -rf $temp_file
|
||||||
msg_ok "Cleanup Completed"
|
msg_ok "Cleanup Completed"
|
||||||
|
|
||||||
# Last Action
|
# Last Action
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
|
||||||
msg_ok "Update Successful"
|
msg_ok "Update Successful"
|
||||||
else
|
else
|
||||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
msg_ok "No update required. ${APP} is already at latest version"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,4 +75,4 @@ description
|
|||||||
msg_ok "Completed Successfully!\n"
|
msg_ok "Completed Successfully!\n"
|
||||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:[PORT]${CL}"
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:19200${CL}"
|
||||||
|
@ -19,7 +19,8 @@ msg_info "Installing Dependencies"
|
|||||||
$STD apt-get install -y \
|
$STD apt-get install -y \
|
||||||
curl \
|
curl \
|
||||||
sudo \
|
sudo \
|
||||||
mc
|
mc \
|
||||||
|
jq # Used for updating checking from json response
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
msg_info "Installing FFmpeg (Patience)"
|
msg_info "Installing FFmpeg (Patience)"
|
||||||
@ -59,7 +60,7 @@ msg_info "Setup ${APPLICATION}"
|
|||||||
temp_file=$(mktemp)
|
temp_file=$(mktemp)
|
||||||
wget -q https://fileflows.com/downloads/zip -O $temp_file
|
wget -q https://fileflows.com/downloads/zip -O $temp_file
|
||||||
unzip -q -d /opt/fileflows $temp_file
|
unzip -q -d /opt/fileflows $temp_file
|
||||||
chmod +x /opt/fileflows/run-server.sh
|
chmod +x /opt/fileflows/fileflows-systemd-entrypoint.sh
|
||||||
msg_ok "Setup ${APPLICATION}"
|
msg_ok "Setup ${APPLICATION}"
|
||||||
|
|
||||||
# Creating Service
|
# Creating Service
|
||||||
|
Loading…
x
Reference in New Issue
Block a user