Commit fe6a1208 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Switch to realpath for path canonicalisation

parent e5384691
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
#!/bin/bash
# Copyright (c) 2020, 2022 Dom Sekotill <dom.sekotill@kodo.org.uk>
# Copyright (c) 2020, 2022, 2023 Dom Sekotill <dom.sekotill@kodo.org.uk>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -52,10 +52,16 @@ missing() {
		echo "the optional Bash builtins are installed and '$1' is enabled:"
		echo "  enable -f <lib-path>/bash/$1 $1"
	} >&2
	coreutils() {
		echo "Please ensure '$1' from the coreutils package is installed"
	} >&2
	case $BASH_COMMAND in
		cp\ *) echo >&2 "Please ensure 'cp' is installed" ;;
		ldd\ *) echo >&2 "Please install the object dependency checker 'ldd'" ;;

		cp\ *) coreutils cp ;;
		readlink\ *) coreutils readlink ;;
		realpath\ *) coreutils realpath ;;

		head\ *) opt_builtin head ;;
		ln\ *) opt_builtin ln ;;
		mkdir\ *) opt_builtin mkdir ;;
@@ -95,7 +101,7 @@ copy_elf() {
copy_link() {
	copy_dirs "$(dirname "$1")"
	ln -s $(readlink "$1") "$STAGE/$1"
	copy "$(readlink -f "$1")"
	copy "$(realpath "$1")"
}

copy_file() {