Browse Source

Allow supplying own config

Ideal for servers in contained environments where writing to $HOME would
not be not considered polite.
Alois Mahdal 4 years ago
parent
commit
dd03791894
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      bin/notifirc

+ 10
- 1
bin/notifirc View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
+#
4
+# Extra defaults file
5
+#
6
+# Options here override /etc and ~/, but are overrided
7
+# by command line options.
8
+#
9
+NOTIFIRC_RC=${NOTIFIRC_RC:-}
3
 
10
 
4
 usage() {
11
 usage() {
5
     #
12
     #
16
         echo "will JOIN the channel first."
23
         echo "will JOIN the channel first."
17
         echo ""
24
         echo ""
18
         echo "Defaults for options can be defined as POSIX shell assignments under"
25
         echo "Defaults for options can be defined as POSIX shell assignments under"
19
-        echo "/etc/notifirc.rc or ~/.notifirc.rc. (E.g. 'nick=jdoe', 'max_width=40')."
26
+        echo "/etc/notifirc.rc, ~/.notifirc.rc or file specified by NOTIFIRC_RC"
27
+        echo "envvar. (E.g. 'nick=jdoe', 'max_width=40')."
20
         echo ""
28
         echo ""
21
         echo "All is logged under /var/log/notifirc.log, ~/.notifirc.log, or"
29
         echo "All is logged under /var/log/notifirc.log, ~/.notifirc.log, or"
22
         echo "/tmp/notifirc.log, whichever $self can write to."
30
         echo "/tmp/notifirc.log, whichever $self can write to."
177
 
185
 
178
     load_defaults /etc/notifirc.rc
186
     load_defaults /etc/notifirc.rc
179
     load_defaults "$HOME/.notifirc.rc"
187
     load_defaults "$HOME/.notifirc.rc"
188
+    load_defaults "$NOTIFIRC_RC"
180
 
189
 
181
     while true; do case $1 in
190
     while true; do case $1 in
182
         -c) context=$2; shift 2 || usage ;;
191
         -c) context=$2; shift 2 || usage ;;