diff options
author | Bo Ørsted Andresen <bo.andresen@zlin.dk> | 2008-08-25 22:57:00 +0000 |
---|---|---|
committer | Bo Ørsted Andresen <bo.andresen@zlin.dk> | 2008-09-03 02:23:23 +0200 |
commit | eeba9d604518752fa65cb3b4af4443f27ffaba72 (patch) | |
tree | d642b306920d75661002ea8bd2ac2c50c513d377 | |
parent | 1ffb1b7688faea2f901cc63486cc6bb01d107b9d (diff) | |
download | wgetpaste-eeba9d604518752fa65cb3b4af4443f27ffaba72.tar.gz |
Add compatibility code for old config locations.
-rwxr-xr-x | wgetpaste | 28 |
1 files changed, 24 insertions, 4 deletions
@@ -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} |