mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-19 00:19:14 +00:00
Fix path munging funcs and usage
Our `realpath` and `readlink -f` functions (required only because of MacOS, thanks Steve) were poor substitutes at best. Mostly they were downright broken. This thoroughly overhauls them and adds a test (in comments, since we don't seem to have shell tests). For all the interesting cases I could think of, the fakes act just like the real thing. Then use those and canonicalize KUBE_ROOT. In order to make recursive calls of our shell tool not additively grow `pwd` we have to essentially make the sourcing of init.sh idempotent.
This commit is contained in:
@@ -26,11 +26,8 @@ DOCKER_HOST=${DOCKER_HOST:-""}
|
||||
DOCKER_MACHINE_NAME=${DOCKER_MACHINE_NAME:-"kube-dev"}
|
||||
readonly DOCKER_MACHINE_DRIVER=${DOCKER_MACHINE_DRIVER:-"virtualbox --virtualbox-memory 4096 --virtualbox-cpu-count -1"}
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
cd "${KUBE_ROOT}"
|
||||
|
||||
# This'll canonicalize the path
|
||||
KUBE_ROOT=$PWD
|
||||
# This will canonicalize the path
|
||||
KUBE_ROOT=$(cd $(dirname "${BASH_SOURCE}")/.. && pwd -P)
|
||||
|
||||
source hack/lib/init.sh
|
||||
|
||||
|
Reference in New Issue
Block a user