File tree 4 files changed +31
-3
lines changed
4 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ INSTALL_BIN ?= $(PREFIX)/bin
22
22
INSTALL_LIB ?= $(PREFIX ) /share/$(NAME )
23
23
INSTALL_EXT ?= $(INSTALL_LIB ) /$(NAME ) .d
24
24
INSTALL_MAN1 ?= $(PREFIX ) /share/man/man1
25
- LINK_REL_DIR := $(shell realpath --relative-to= $(INSTALL_BIN ) $(INSTALL_LIB ) )
25
+ LINK_REL_DIR := $(shell bash share/pnrelpath.sh $(INSTALL_BIN ) $(INSTALL_LIB ) )
26
26
27
27
# Docker variables:
28
28
DOCKER_TAG ?= 0.0.6
49
49
50
50
.PHONY : test
51
51
test :
52
+ @echo uname: ' $(shell uname)'
52
53
prove $(prove ) $(test )
53
54
54
55
test-all : test docker-tests
Original file line number Diff line number Diff line change 12
12
export FILTER_BRANCH_SQUELCH_WARNING=1
13
13
14
14
# Import Bash+ helper functions:
15
- SUBREPO_EXT_DIR=" $( dirname " $( realpath " ${BASH_SOURCE[0]} " ) " ) /git-subrepo.d" # replaced by `make install`
15
+ SUBREPO_EXT_DIR=" $( dirname " $( readlink -f " ${BASH_SOURCE[0]} " ) " ) /git-subrepo.d" # replaced by `make install`
16
16
source " ${SUBREPO_EXT_DIR} /bash+.bash"
17
17
bash+:import :std can version-check
18
18
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ #
3
+ # from: https://unix.stackexchange.com/questions/573047/how-to-get-the-relative-path-between-two-directories
4
+ #
5
+ # Expects two parameters, source-dir and target-dir, both absolute canonicalized
6
+ # non-empty pathnames, either may be /-ended, neither need exist.
7
+ # Returns result in shell variable $REPLY as a relative path from source-dir
8
+ # to target-dir without trailing /, . if void.
9
+ #
10
+ # Algorithm is from a 2005 comp.unix.shell posting which has now ascended to
11
+ # archive.org.
12
+
13
+ pnrelpath () {
14
+ set -- " ${1%/ } /" " ${2%/ } /" ' ' # # '/'-end to avoid mismatch
15
+ while [ " $1 " ] && [ " $2 " = " ${2# " $1 " } " ] # # reduce $1 to shared path
16
+ do set -- " ${1%/ ?*/ } /" " $2 " " ../$3 " # # source/.. target ../relpath
17
+ done
18
+ REPLY=" ${3}${2# " $1 " } " # # build result
19
+ # unless root chomp trailing '/', replace '' with '.'
20
+ [ " ${REPLY#/ } " ] && REPLY=" ${REPLY%/ } " || REPLY=" ${REPLY:- .} "
21
+ }
22
+
23
+ pnrelpath " $1 " " $2 "
24
+
25
+ echo $REPLY
Original file line number Diff line number Diff line change 2
2
3
3
set -e
4
4
5
- export LC_ALL=C.UTF-8
5
+ if [ " $( uname) " == " Linux" ]; then
6
+ export LC_ALL=C.UTF-8
7
+ fi
6
8
7
9
# Get the location of this script
8
10
SCRIPT_DIR=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd )
You can’t perform that action at this time.
0 commit comments