aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/update.sh
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-10-09 00:57:32 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-10-09 00:57:32 +0300
commit8019f2da73fb8c3567ef937fbf1f7f5822fb5938 (patch)
tree86a703c0a3a430b9bb73b9d565cd9a74b5d5d1d6 /update.sh
parentrefactoring (diff)
downloadconfig-links-8019f2da73fb8c3567ef937fbf1f7f5822fb5938.tar.gz
config-links-8019f2da73fb8c3567ef937fbf1f7f5822fb5938.zip
--config-dir now also updates database path
Diffstat (limited to '')
-rw-r--r--update.sh15
1 files 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() {