summaryrefslogtreecommitdiffstats
path: root/scripts/lnr
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2014-10-16 03:05:19 +0200
committerTudor Florea <tudor.florea@enea.com>2014-10-16 03:05:19 +0200
commitc527fd1f14c27855a37f2e8ac5346ce8d940ced2 (patch)
treebb002c1fdf011c41dbd2f0927bed23ecb5f83c97 /scripts/lnr
downloadpoky-c527fd1f14c27855a37f2e8ac5346ce8d940ced2.tar.gz
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'scripts/lnr')
-rwxr-xr-xscripts/lnr21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/lnr b/scripts/lnr
new file mode 100755
index 0000000000..9dacebe095
--- /dev/null
+++ b/scripts/lnr
@@ -0,0 +1,21 @@
1#! /usr/bin/env python
2
3# Create a *relative* symlink, just like ln --relative does but without needing
4# coreutils 8.16.
5
6import sys, os
7
8if len(sys.argv) != 3:
9 print "$ lnr TARGET LINK_NAME"
10 sys.exit(1)
11
12target = sys.argv[1]
13linkname = sys.argv[2]
14
15if os.path.isabs(target):
16 if not os.path.isabs(linkname):
17 linkname = os.path.abspath(linkname)
18 start = os.path.dirname(linkname)
19 target = os.path.relpath(target, start)
20
21os.symlink(target, linkname)