From 8019f2da73fb8c3567ef937fbf1f7f5822fb5938 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 9 Oct 2016 00:57:32 +0300 Subject: --config-dir now also updates database path --- update.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/update.sh b/update.sh index 4e72cbb..8c93ca3 100644 --- a/update.sh +++ b/update.sh @@ -47,12 +47,18 @@ update_config_dir() { return 1 fi - config_dir="$( readlink --canonicalize-existing "$1" )" + local new_config_dir="$( readlink --canonicalize-existing "$1" )" - if [ ! -d "$config_dir" ]; then - dump "must be a directory: $config_dir" >&2 + if [ ! -d "$new_config_dir" ]; then + dump "must be a directory: $new_config_dir" >&2 return 1 fi + + if [ "$database_path" == "$config_dir/$default_database_name" ]; then + database_path="$new_config_dir/$default_database_name" + fi + + config_dir="$new_config_dir" } ensure_symlinks_enabled() { @@ -67,7 +73,8 @@ ensure_symlinks_enabled() { esac } -database_path="$config_dir/db.bin" +readonly default_database_name='db.bin' +database_path="$config_dir/$default_database_name" declare -A database update_database_path() { -- cgit v1.2.3