From 3bc536413d095e332804900803cbb1e7b07accbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sun, 21 Apr 2024 01:09:16 +0200 Subject: [PATCH] Add auto update script --- auto_update/auto_update.sh | 82 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 auto_update/auto_update.sh diff --git a/auto_update/auto_update.sh b/auto_update/auto_update.sh new file mode 100644 index 0000000..5221e60 --- /dev/null +++ b/auto_update/auto_update.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +set -eu + +readonly app_name=seafile + +get_from_manifest() { + result=$(python3 <&1 | tee "${app_name}_build_temp.log" + return "${PIPESTATUS[0]}" +} + +app_version=$(get_from_manifest ".version" | cut -d'~' -f1) + +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