summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tl-check-symlinks
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-12-30 23:43:21 +0000
committerKarl Berry <karl@freefriends.org>2019-12-30 23:43:21 +0000
commitacb37f8787486717b8fab68a9cacadb577eaf723 (patch)
tree621b72e0810c189afea97b3d36ff60b495f6e27b /Master/tlpkg/bin/tl-check-symlinks
parent2d88204c158fbd00e45991a52016209840ed9196 (diff)
check for broken symlinks under bin/, both source tree and after test installation
git-svn-id: svn://tug.org/texlive/trunk@53274 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/bin/tl-check-symlinks')
-rwxr-xr-xMaster/tlpkg/bin/tl-check-symlinks30
1 files changed, 30 insertions, 0 deletions
diff --git a/Master/tlpkg/bin/tl-check-symlinks b/Master/tlpkg/bin/tl-check-symlinks
new file mode 100755
index 00000000000..b26ad4d3f90
--- /dev/null
+++ b/Master/tlpkg/bin/tl-check-symlinks
@@ -0,0 +1,30 @@
+#!/usr/bin/env perl
+# $Id$
+# Check given directory tree(s) (default to .) for broken symlinks;
+# report any found, and exit accordingly.
+
+use strict;
+use warnings;
+use File::Find;
+
+our $fail = 0;
+$ARGV[0] = "." if ! @ARGV;
+find(\&process_file, @ARGV);
+exit $fail;
+
+# $File::Find::dir is the current directory name,
+# $_ is the current filename within that directory
+# $File::Find::name is the complete pathname to the file.
+#
+sub process_file {
+ return unless -l;
+ return if -r;
+ $fail = 1;
+ print "broken link $File::Find::name -> ", readlink($_), "\n";
+}
+
+# Doesn't get to the warning in Find.pm, dunno. Anyway, our warning is
+# better since it includes the target.
+#!/bin/sh
+# exec perl -w -MFile::Find -e 'my $wanted=sub{};
+# find({wanted=>$wanted, dangling_symlinks=>1}, "/home/karl/bin");'