summaryrefslogtreecommitdiff
path: root/tool/ln_sr.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/ln_sr.rb')
-rwxr-xr-xtool/ln_sr.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/tool/ln_sr.rb b/tool/ln_sr.rb
index 6ab412edde..e1b5b6f76b 100755
--- a/tool/ln_sr.rb
+++ b/tool/ln_sr.rb
@@ -3,6 +3,7 @@
target_directory = true
noop = false
force = false
+quiet = false
until ARGV.empty?
case ARGV[0]
@@ -12,6 +13,8 @@ until ARGV.empty?
force = true
when '-T'
target_directory = false
+ when '-q'
+ quiet = true
else
break
end
@@ -93,7 +96,7 @@ unless respond_to?(:ln_sr)
while c = comp.shift
if c == ".." and clean.last != ".." and !(fu_have_symlink? && File.symlink?(path))
clean.pop
- path.chomp!(%r((?<=\A|/)[^/]+/\z), "")
+ path.sub!(%r((?<=\A|/)[^/]+/\z), "")
else
clean << c
path << c << "/"
@@ -114,9 +117,12 @@ unless respond_to?(:ln_sr)
end
if File.respond_to?(:symlink)
+ if quiet and File.identical?(src, dest)
+ exit
+ end
begin
ln_sr(src, dest, verbose: true, target_directory: target_directory, force: force, noop: noop)
- rescue NotImplementedError, Errno::EPERM
+ rescue NotImplementedError, Errno::EPERM, Errno::EACCES
else
exit
end