add configuration file for notify-updates

This commit is contained in:
ray 2020-02-17 19:00:11 +00:00
parent dfa9bb1106
commit 5e2f1f2656
3 changed files with 22 additions and 1 deletions

View File

@ -10,8 +10,13 @@ Notifies of available updates.
notify-updates --help
```
## Configuration
Example configuration file: `notify-updates.config`.
Configuration directory (hardcoded for now): `~/.config/notify-updates`.
## TODO
* `notify-updates` triggered to run after `pacman-update-count`
* config file for `notify-updates`
* `update.sh` script

View File

@ -6,6 +6,7 @@ _notify_none=0
_error_code=0
_show_help=0
_hostname=$(hostname)
_config_file="$HOME/.config/notify-updates/notify-updates.config"
if ! [ -f "$_target_file" ] ;
then
@ -37,6 +38,19 @@ if [ "$_error_code" -gt 0 ] ; then
exit "$_error_code"
fi
# TODO use $XDG_CONFIG_HOME
if [ -f "$_config_file" ] ; then
. "$_config_file"
else
echo "notify-updates: warning - config file not found: $_config_file"
fi
if [ "$notifynone" = "true" ] ; then
_notify_none=1
elif [ "$notifynone" = "false" ] ; then
_notify_none=0
fi
_updates_available=$(cat $_target_file)
if [ "$_updates_available" -gt 0 ] ; then

2
notify-updates.config Normal file
View File

@ -0,0 +1,2 @@
# notify if no updates available
notifynone=true