aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron W. Swenson <aaron@grandmasfridge.org>2018-01-14 11:26:53 -0500
committerAaron W. Swenson <aaron@grandmasfridge.org>2018-01-14 11:26:53 -0500
commit3e4f034603522c95427c26fc0e9b93002397c749 (patch)
tree3634abf3a83af5b85af8b6d4c3abc82cc93f46d5
parentMore concise die messages (diff)
downloadeselect-3e4f034603522c95427c26fc0e9b93002397c749.tar.gz
eselect-3e4f034603522c95427c26fc0e9b93002397c749.tar.bz2
eselect-3e4f034603522c95427c26fc0e9b93002397c749.zip
Just try to update symlink
ln now removes an existing symlink when it tries to create one. This makes it unnecessary to first try to remove the symlink.
-rw-r--r--postgresql.eselect11
1 files changed, 4 insertions, 7 deletions
diff --git a/postgresql.eselect b/postgresql.eselect
index d05f724..84a6e0d 100644
--- a/postgresql.eselect
+++ b/postgresql.eselect
@@ -80,19 +80,16 @@ linker() {
local pattern=$2
local target_dir=$3
local suffix=$4
- local link_source
+
local findings
+ local link_source
+ local link_target
local rel_source
findings=$(finder "${source_dir}" "${pattern}")
for link_source in ${findings} ; do
- local link_target="${target_dir%/}/$(basename ${link_source})${suffix}"
-
- # For good measure, remove target before creating the symlink
- [[ -h ${link_target} ]] && rm -f "${link_target}"
- [[ -e ${link_target} ]] && \
- die -q "The target '${link_target}' still exists and could not be removed!"
+ link_target="${target_dir%/}/$(basename ${link_source})${suffix}"
# Create relative links so that they work both here and inside the new
# root if $ROOT is not "/".