2018-02-23 21:18:35 +01:00
|
|
|
From 17560d52e9ec0afebbfe31e694870c6433b36f60 Mon Sep 17 00:00:00 2001
|
2018-01-01 14:09:44 +01:00
|
|
|
From: Adam Duskett <Adamduskett@outlook.com>
|
|
|
|
Date: Sun, 31 Dec 2017 12:46:04 -0500
|
|
|
|
Subject: [PATCH] install: don't use ln --relative
|
|
|
|
|
|
|
|
Oldish enterprise-class distributions have too old versions of
|
|
|
|
coreutils, with ln not supporting --relative.
|
|
|
|
|
|
|
|
So we fake it.
|
|
|
|
|
|
|
|
ln --relative would create minimalist relative paths, but they are not
|
|
|
|
trivial to generate. Instead, we always create paths relative to the
|
|
|
|
root, i.e.:
|
|
|
|
|
|
|
|
ln -s --relative /usr/bin/foo /usr/sbin/foo
|
|
|
|
|
|
|
|
would create: /usr/sbin/foo -> ../bin/foo
|
|
|
|
while we do : /usr/sbin/foo -> ../../usr/bin/foo
|
|
|
|
|
|
|
|
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
|
|
|
|
[aduskett@gmail.com: Added meson.build section and dirname wrapper in add-wants]
|
2018-01-31 00:44:28 +01:00
|
|
|
[aduskett@gmail.com: Update for systemd v237]
|
2018-01-01 14:09:44 +01:00
|
|
|
Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
|
2018-02-23 21:18:35 +01:00
|
|
|
[tpiepho@impinj.com: Fix add-wants wrapper]
|
|
|
|
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
|
2018-01-01 14:09:44 +01:00
|
|
|
---
|
|
|
|
meson.build | 2 +-
|
|
|
|
tools/meson-make-symlink.sh | 3 ++-
|
2018-02-23 21:18:35 +01:00
|
|
|
units/meson-add-wants.sh | 6 ++++--
|
|
|
|
3 files changed, 7 insertions(+), 4 deletions(-)
|
2018-01-01 14:09:44 +01:00
|
|
|
|
|
|
|
diff --git a/meson.build b/meson.build
|
2018-02-23 21:18:35 +01:00
|
|
|
index d4af95a44..d75f2b34c 100644
|
2018-01-01 14:09:44 +01:00
|
|
|
--- a/meson.build
|
|
|
|
+++ b/meson.build
|
2018-02-23 21:18:35 +01:00
|
|
|
@@ -586,7 +586,7 @@ endforeach
|
|
|
|
conf.set_quoted('TELINIT', get_option('telinit-path'))
|
2018-01-01 14:09:44 +01:00
|
|
|
|
|
|
|
if run_command('ln', '--relative', '--help').returncode() != 0
|
|
|
|
- error('ln does not support --relative')
|
|
|
|
+ message('ln does not support --relative')
|
|
|
|
endif
|
|
|
|
|
|
|
|
############################################################
|
|
|
|
diff --git a/tools/meson-make-symlink.sh b/tools/meson-make-symlink.sh
|
2018-02-23 21:18:35 +01:00
|
|
|
index 501cd43d4..25e7f89fd 100755
|
2018-01-01 14:09:44 +01:00
|
|
|
--- a/tools/meson-make-symlink.sh
|
|
|
|
+++ b/tools/meson-make-symlink.sh
|
2018-01-31 00:44:28 +01:00
|
|
|
@@ -8,5 +8,6 @@ mkdir -vp "$(dirname "${DESTDIR:-}$2")"
|
2018-01-01 14:09:44 +01:00
|
|
|
if [ "$(dirname $1)" = . ]; then
|
|
|
|
ln -vfs -T "$1" "${DESTDIR:-}$2"
|
|
|
|
else
|
|
|
|
- ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2"
|
|
|
|
+ dds="$( dirname "$2" |sed -r -e 's:/+[^/]+:../:g; s:/$::' )"
|
|
|
|
+ ln -vfs -T "${dds}$1" "${DESTDIR:-}$2"
|
|
|
|
fi
|
|
|
|
diff --git a/units/meson-add-wants.sh b/units/meson-add-wants.sh
|
2018-02-23 21:18:35 +01:00
|
|
|
index 70f7172ae..bb8155075 100755
|
2018-01-01 14:09:44 +01:00
|
|
|
--- a/units/meson-add-wants.sh
|
|
|
|
+++ b/units/meson-add-wants.sh
|
2018-01-31 00:44:28 +01:00
|
|
|
@@ -14,7 +14,7 @@ case "$target" in
|
2018-01-01 14:09:44 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
-unitpath="${DESTDIR:-}${unitdir}/${unit}"
|
|
|
|
+unitpath="${unitdir}/${unit}"
|
|
|
|
|
|
|
|
case "$target" in
|
|
|
|
*/)
|
2018-02-23 21:18:35 +01:00
|
|
|
@@ -25,4 +25,6 @@ case "$target" in
|
2018-01-01 14:09:44 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
-ln -vfs --relative "$unitpath" "$dir"
|
2018-02-23 21:18:35 +01:00
|
|
|
+[ ! -d "${dir}" ] && linkdir=`dirname "${dir}"` || linkdir="${dir}"
|
|
|
|
+dds="$(printf "%s" "${linkdir#${DESTDIR:-}}" |sed -r -e 's:/+[^/]+:../:g; s:/$::')"
|
2018-01-01 14:09:44 +01:00
|
|
|
+ln -vfs "$dds$unitpath" "$dir"
|
|
|
|
--
|
|
|
|
2.14.3
|
|
|
|
|