Improve bootstrap-haskell and fix shellcheck warnings
This commit is contained in:
parent
ba8e4f6ac6
commit
a2373f2056
@ -197,12 +197,15 @@ posix_realpath() {
|
||||
current_loop=0
|
||||
max_loops=50
|
||||
mysource=$1
|
||||
# readlink and '[ -h $path ]' behave different wrt '/sbin/' and '/sbin', so we strip it
|
||||
mysource=${mysource%/}
|
||||
[ -z "${mysource}" ] && mysource=$1
|
||||
|
||||
while [ -h "${mysource}" ]; do
|
||||
current_loop=$((current_loop+1))
|
||||
mydir="$( cd -P "$( dirname "${mysource}" )" > /dev/null 2>&1 && pwd )"
|
||||
mysource="$(readlink "${mysource}")"
|
||||
[ "${mysource%${mysource#?}}"x != '/x' ] && mysource="${mydir}/${mysource}"
|
||||
[ "${mysource%"${mysource#?}"}"x != '/x' ] && mysource="${mydir%/}/${mysource}"
|
||||
|
||||
if [ ${current_loop} -gt ${max_loops} ] ; then
|
||||
(>&2 echo "${1}: Too many levels of symbolic links")
|
||||
|
Loading…
Reference in New Issue
Block a user