commit 2f02f04138fce4d74dfc00aa82ee973cf1221801
parent b1ef0b0f013bf65638a86d370107c4cb885a5693
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Fri, 23 Oct 2020 17:34:55 +0200
newsrefreshd: PATH is set from environment, so all good
Former-commit-id: fac0370097e5fa028beedd8c292f4aa790b5c6da
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/scripts/newsrefreshd b/scripts/newsrefreshd
@@ -1,18 +1,16 @@
#!/bin/sh
set -e
-alias git=/usr/local/bin/git
-alias newsboat=/usr/local/bin/newsboat
-
notidie() {
- /usr/local/bin/terminal-notifier -group news -sender news -title "$1" -message "$2"
+ terminal-notifier -group news -sender news -title "$1" -message "$2"
exit 1
}
-newsboat -x reload || notidie "Newsboat: error reloading" "Unable to reload"
+newsboat -x reload 2>&1 || notidie "Newsboat: error reloading" "Unable to reload"
{ cd "${DOTFILES:-$HOME/.dotfiles}" && git commit -m "Newsboat cache" newsboat/cache.db; } || notidie "Newsboat: error committing cache" "Could not commit cache dotfile."
previous_commit_msg="$(git log --format=%s -n 1 HEAD~)"
if [ "$previous_commit_msg" = "Newsboat cache" ]; then
+ printf "Previous commit is also Newsboat, rolling back\n"
{ git stash save \
&& git reset --soft HEAD~2 \
&& git commit -m "Newsboat cache" \
@@ -20,7 +18,8 @@ if [ "$previous_commit_msg" = "Newsboat cache" ]; then
&& git fetch --all \
&& git stash pop; } || notidie "Newsboat error: refreshed but unpushed" "Could not push new cache, check the state of the git repository."
else
+ printf "Previous commit is not Newsboat\n"
git push origin master
fi
-newsboat -x print-unread | xargs -I{} /usr/local/bin/terminal-notifier -group news -sender news -title 'Newsboat reloaded' -message "{}"
+newsboat -x print-unread | xargs -I{} terminal-notifier -group news -sender news -title 'Newsboat reloaded' -message "{}"