0001-Build-system-add-missing-ln-srf-script.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. From 6f6fb88077bce7f9dd9d21a286eeec700acff04e Mon Sep 17 00:00:00 2001
  2. From: Carlos Santos <unixmania@gmail.com>
  3. Date: Mon, 16 Sep 2019 22:22:37 -0300
  4. Subject: [PATCH] Build system:: add missing ln-srf script
  5. It is missing in the 1.25.6 release tarball.
  6. Signed-off-by: Carlos Santos <unixmania@gmail.com>
  7. ---
  8. ln-srf | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
  9. 1 file changed, 49 insertions(+)
  10. create mode 100755 ln-srf
  11. diff --git a/ln-srf b/ln-srf
  12. new file mode 100755
  13. index 00000000..f395a760
  14. --- /dev/null
  15. +++ b/ln-srf
  16. @@ -0,0 +1,49 @@
  17. +#!/bin/sh
  18. +#
  19. +# Author: Carlos Santos <unixmania@gmail.com>
  20. +# This file is in public domain.
  21. +#
  22. +
  23. +error() {
  24. + echo "$@" 1>&2
  25. + exit 1
  26. +}
  27. +
  28. +src="$1"
  29. +dst="$2"
  30. +
  31. +check_path() {
  32. + case "$2" in
  33. + */../*|*/./*|*/.|*/..) error "$1 path '$2' must be absolute";;
  34. + */) error "$1 path '$2' must not end with '/'";;
  35. + /?*) ;;
  36. + *) error "$1 path '$2' must start with '/'";;
  37. + esac
  38. +}
  39. +
  40. +check_path "source" "$src"
  41. +check_path "destination" "$dst"
  42. +
  43. +# strip leading '/'
  44. +src=${src#/*}
  45. +tmp=${dst#/*}
  46. +
  47. +s_prefix=${src%%/*}
  48. +d_prefix=${tmp%%/*}
  49. +
  50. +# strip leading common
  51. +while [ "$s_prefix" = "$d_prefix" ]; do
  52. + src="${src#$s_prefix/}"
  53. + tmp="${tmp#$d_prefix/}"
  54. + s_prefix=${src%%/*}
  55. + d_prefix=${tmp%%/*}
  56. +done
  57. +
  58. +s_prefix="../"
  59. +while [ -n "$d_prefix" ] && [ "$tmp" != "$d_prefix" ]; do
  60. + s_prefix="../$s_prefix"
  61. + tmp="${tmp#$d_prefix/}"
  62. + d_prefix=${tmp%%/*}
  63. +done
  64. +
  65. +ln -s -f "$s_prefix$src" "$dst"
  66. --
  67. 2.18.1