Bläddra i källkod

Allow supplying own config

Ideal for servers in contained environments where writing to $HOME would
not be not considered polite.
Alois Mahdal 4 år sedan
förälder
incheckning
dd03791894
1 ändrade filer med 10 tillägg och 1 borttagningar
  1. 10
    1
      bin/notifirc

+ 10
- 1
bin/notifirc Visa fil

@@ -1,5 +1,12 @@
1 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 11
 usage() {
5 12
     #
@@ -16,7 +23,8 @@ usage() {
16 23
         echo "will JOIN the channel first."
17 24
         echo ""
18 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 28
         echo ""
21 29
         echo "All is logged under /var/log/notifirc.log, ~/.notifirc.log, or"
22 30
         echo "/tmp/notifirc.log, whichever $self can write to."
@@ -177,6 +185,7 @@ main() {
177 185
 
178 186
     load_defaults /etc/notifirc.rc
179 187
     load_defaults "$HOME/.notifirc.rc"
188
+    load_defaults "$NOTIFIRC_RC"
180 189
 
181 190
     while true; do case $1 in
182 191
         -c) context=$2; shift 2 || usage ;;