diff options
author | Stonewall Jackson <stonewall@sacredheartsc.com> | 2023-02-04 01:23:43 -0500 |
---|---|---|
committer | Stonewall Jackson <stonewall@sacredheartsc.com> | 2023-02-04 01:52:13 -0500 |
commit | 0261e875679f1bf63c8d689da7fc7e014597885d (patch) | |
tree | 3f19cd74a0c1070944f75437f30b098d6ef2ffcb /roles/ttrss/templates/usr/local/sbin | |
download | selfhosted-0261e875679f1bf63c8d689da7fc7e014597885d.tar.gz selfhosted-0261e875679f1bf63c8d689da7fc7e014597885d.zip |
initial commit
Diffstat (limited to 'roles/ttrss/templates/usr/local/sbin')
-rw-r--r-- | roles/ttrss/templates/usr/local/sbin/ttrss-update.sh.j2 | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/roles/ttrss/templates/usr/local/sbin/ttrss-update.sh.j2 b/roles/ttrss/templates/usr/local/sbin/ttrss-update.sh.j2 new file mode 100644 index 0000000..663558c --- /dev/null +++ b/roles/ttrss/templates/usr/local/sbin/ttrss-update.sh.j2 @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -eu + +SRCDIR={{ ttrss_home | quote }} + +if (( $EUID != 0 )); then + echo 'must be superuser' 1>&2 + exit 1 +fi + +cd "$SRCDIR" + +git fetch + +local_rev=$(git rev-parse HEAD) +upstream_rev=$(git rev-parse '@{u}') + +echo "local: $local_rev" +echo "upstream: $upstream_rev" + +if [ "$local_rev" != "$upstream_rev" ]; then + git reset --hard HEAD + systemctl restart ttrss +else + echo "ttrss is already up to date" +fi |