diff --git a/README.md b/README.md index 6c81a34..cd6726f 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/notify-updates b/notify-updates index 25e59a7..69ff8c2 100755 --- a/notify-updates +++ b/notify-updates @@ -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 diff --git a/notify-updates.config b/notify-updates.config new file mode 100644 index 0000000..2fc0af9 --- /dev/null +++ b/notify-updates.config @@ -0,0 +1,2 @@ +# notify if no updates available +notifynone=true