summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Ørsted Andresen <bo.andresen@zlin.dk>2008-08-25 22:57:00 +0000
committerBo Ørsted Andresen <bo.andresen@zlin.dk>2008-09-03 02:23:23 +0200
commiteeba9d604518752fa65cb3b4af4443f27ffaba72 (patch)
treed642b306920d75661002ea8bd2ac2c50c513d377
parent1ffb1b7688faea2f901cc63486cc6bb01d107b9d (diff)
downloadwgetpaste-eeba9d604518752fa65cb3b4af4443f27ffaba72.tar.gz
Add compatibility code for old config locations.
-rwxr-xr-xwgetpaste28
1 files changed, 24 insertions, 4 deletions
diff --git a/wgetpaste b/wgetpaste
index 3103234..90d50ae 100755
--- a/wgetpaste
+++ b/wgetpaste
@@ -519,11 +519,31 @@ while [[ -n $1 ]]; do
done
### defaults
-[[ $IGNORECONFIGS ]] || for f in {/etc/,~/.}wgetpaste{.d/*,}.conf; do
- if [[ -f $f ]]; then
- source "$f" || die "Failed to source $f"
+load_configs() {
+ if [[ ! $IGNORECONFIGS ]]; then
+ # compatibility code
+ local f deprecated=
+ for f in {/etc/,~/.}wgetpaste{.d/*.bash,}; do
+ if [[ -f $f ]]; then
+ if [[ -z $deprecated ]]; then
+ echo "The config files for wgetpaste have changed to *.conf." >&2
+ echo >&2
+ deprecated=0
+ fi
+ echo "Please move ${f} to ${f%.bash}.conf" >&2
+ source "$f" || die "Failed to source $f"
+ fi
+ done
+ [[ -n $deprecated ]] && echo >&2
+ # new locations override old ones in case they collide
+ for f in {/etc/,~/.}wgetpaste{.d/*,}.conf; do
+ if [[ -f $f ]]; then
+ source "$f" || die "Failed to source $f"
+ fi
+ done
fi
-done
+}
+load_configs
[[ $SERVICESET ]] && verifyservice "$SERVICESET" && SERVICE=$(escape "$SERVICESET")
DEFAULT_NICK=${DEFAULT_NICK:-$(whoami)} || die "whoami failed"
DEFAULT_SERVICE=${DEFAULT_SERVICE:-rafb}