From 8e8990429372b8d34d4fb40f7c7a99c5bfaab218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Tue, 28 May 2024 00:44:49 +0200 Subject: [PATCH] Add auto update --- auto_update/auto_update.sh | 88 +++++++++++++++++++++++ auto_update/auto_update_config_example.sh | 1 + 2 files changed, 89 insertions(+) create mode 100644 auto_update/auto_update.sh create mode 100644 auto_update/auto_update_config_example.sh diff --git a/auto_update/auto_update.sh b/auto_update/auto_update.sh new file mode 100644 index 0000000..ce5ed10 --- /dev/null +++ b/auto_update/auto_update.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +set -eu + +readonly app_name=xwiki + +get_from_manifest() { + result=$(python3 <&1 | tee "${app_name}_build_temp.log" + return "${PIPESTATUS[0]}" +} + +app_prev_version="$(get_from_manifest ".version" | cut -d'~' -f1)" +app_version="$app_prev_version" + +if check_app_version +then + set +eu + upgrade_app + res=$? + set -eu + if [ $res -eq 0 ]; then + result="Success" + else + result="Failed" + fi + msg="Build: $app_name version $app_version\n" + msg+="$(cat ${app_name}_build_temp.log)" + echo -e "$msg" | mail.mailutils -a "Content-Type: text/plain; charset=UTF-8" -s "Autoupgrade $app_name : $result" "$notify_email" +fi diff --git a/auto_update/auto_update_config_example.sh b/auto_update/auto_update_config_example.sh new file mode 100644 index 0000000..daecfc8 --- /dev/null +++ b/auto_update/auto_update_config_example.sh @@ -0,0 +1 @@ +notify_email="hello@world.tld"