summaryrefslogtreecommitdiffstats
path: root/gnuzilla/uscanzilla
blob: a879ca505fdd9d311ce7c85036f6b40238639a7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

set -eu

old_version='0'
{ read old_version 0<"${0%/*}/version" || :; } 2>'/dev/null'

output="$(uscan --package 'icecat' --upstream-version "${old_version}" \
	--watchfile "${0%/*}/watch" 2>&1)" || return 0

sed_s='s/uscan: Newest version of icecat on remote site is \([^,][^,]*\),'
sed_s="${sed_s}"' local version is .*$/\1/p;'
new_version="$(sed -n "${sed_s}")" <<-EOF
	${output}
	EOF

printf '%s\n' "${new_version}" >"${0%/*}/version"

notify-send "New icecat version: ${new_version}" \
	"${old_version} -> ${new_version}"
# mailx -s "New version of icecat available: ${version}" 'pj@pehjota.net' <<-EOF
# 	${output}
# 	EOF