diff --git a/dist/tools/coccinelle/check.sh b/dist/tools/coccinelle/check.sh
index d2aa3a8055d3ff4adb6b496166b6e1b999575060..73b7bd533c06005ed5d3acfcb9153fbb18c8121d 100755
--- a/dist/tools/coccinelle/check.sh
+++ b/dist/tools/coccinelle/check.sh
@@ -6,7 +6,10 @@
 # General Public License v2.1. See the file LICENSE in the top level
 # directory for more details.
 
-: "${RIOTTOOLS:=${PWD}/dist/tools}"
+: "${RIOTBASE:=$(cd $(dirname $0)/../../../; pwd)}"
+cd $RIOTBASE
+
+: "${RIOTTOOLS:=${RIOTBASE}/dist/tools}"
 . "${RIOTTOOLS}"/ci/changed_files.sh
 
 EXIT_CODE=0
diff --git a/dist/tools/cppcheck/check.sh b/dist/tools/cppcheck/check.sh
index b09f0b14d8c1eef13201383123f81be012cbc632..7d504ccb4f9bdba15d8f58a295291ee8a1b45962 100755
--- a/dist/tools/cppcheck/check.sh
+++ b/dist/tools/cppcheck/check.sh
@@ -8,7 +8,10 @@
 # General Public License v2.1. See the file LICENSE in the top level
 # directory for more details.
 
-: "${RIOTTOOLS:=${PWD}/dist/tools}"
+: "${RIOTBASE:=$(cd $(dirname $0)/../../../; pwd)}"
+cd $RIOTBASE
+
+: "${RIOTTOOLS:=${RIOTBASE}/dist/tools}"
 . "${RIOTTOOLS}"/ci/changed_files.sh
 
 # Don't show warnings about unusedStructMembers by default
diff --git a/dist/tools/externc/check.sh b/dist/tools/externc/check.sh
index 74f30b932d8f1174a6832584b27495ea5117c702..a8a9cd791e073bce570a9951ce5867c406495b80 100755
--- a/dist/tools/externc/check.sh
+++ b/dist/tools/externc/check.sh
@@ -8,7 +8,10 @@
 # General Public License v2.1. See the file LICENSE in the top level
 # directory for more details.
 
-: "${RIOTTOOLS:=${PWD}/dist/tools}"
+: "${RIOTBASE:=$(cd $(dirname $0)/../../../; pwd)}"
+cd $RIOTBASE
+
+: "${RIOTTOOLS:=${RIOTBASE}/dist/tools}"
 . "${RIOTTOOLS}"/ci/changed_files.sh
 
 # prepare
diff --git a/dist/tools/flake8/check.sh b/dist/tools/flake8/check.sh
index 5be1407d69528e9f95ab5a258d087316838608db..473308744086c3fd945dec98f9c938e211fdcecd 100755
--- a/dist/tools/flake8/check.sh
+++ b/dist/tools/flake8/check.sh
@@ -17,7 +17,10 @@ else
     CRESET=
 fi
 
-: "${RIOTTOOLS:=${PWD}/dist/tools}"
+: "${RIOTBASE:=$(cd $(dirname $0)/../../../; pwd)}"
+cd $RIOTBASE
+
+: "${RIOTTOOLS:=${RIOTBASE}/dist/tools}"
 . "${RIOTTOOLS}"/ci/changed_files.sh
 
 EXCLUDE='^(.+/vendor/|dist/tools/cc2538-bsl|dist/tools/mcuboot|dist/tools/uhcpd)'
diff --git a/dist/tools/headerguards/check.sh b/dist/tools/headerguards/check.sh
index bbac91323e410bafeec7d4cde17df8e4cc8e66d5..612a2e5cae837abc1950685ee101f3596ffbbe5e 100755
--- a/dist/tools/headerguards/check.sh
+++ b/dist/tools/headerguards/check.sh
@@ -6,7 +6,10 @@
 # General Public License v2.1. See the file LICENSE in the top level
 # directory for more details.
 
-: "${RIOTTOOLS:=${PWD}/dist/tools}"
+: "${RIOTBASE:=$(cd $(dirname $0)/../../../; pwd)}"
+cd $RIOTBASE
+
+: "${RIOTTOOLS:=${RIOTBASE}/dist/tools}"
 . "${RIOTTOOLS}"/ci/changed_files.sh
 
 EXIT_CODE=0
diff --git a/dist/tools/licenses/check.sh b/dist/tools/licenses/check.sh
index 959f56380035ce09461f35664f315dd3f41c15d5..92bab9798a23c59e590ed736b4734d6f0acf8553 100755
--- a/dist/tools/licenses/check.sh
+++ b/dist/tools/licenses/check.sh
@@ -7,7 +7,10 @@
 # General Public License v2.1. See the file LICENSE in the top level
 # directory for more details.
 
-: "${RIOTTOOLS:=${PWD}/dist/tools}"
+: "${RIOTBASE:=$(cd $(dirname $0)/../../../; pwd)}"
+cd $RIOTBASE
+
+: "${RIOTTOOLS:=${RIOTBASE}/dist/tools}"
 . "${RIOTTOOLS}"/ci/changed_files.sh
 
 # customizable
diff --git a/dist/tools/pr_check/pr_check.sh b/dist/tools/pr_check/pr_check.sh
index f8c93e687c13b53a23b42285a19511c1bc76ca47..5a88e832a969cb706dae1962c2e90b331bb29fc0 100755
--- a/dist/tools/pr_check/pr_check.sh
+++ b/dist/tools/pr_check/pr_check.sh
@@ -7,10 +7,14 @@
 # directory for more details.
 #
 
-EXIT_CODE=0
-: "${RIOTTOOLS:=${PWD}/dist/tools}"
+: "${RIOTBASE:=$(cd $(dirname $0)/../../../; pwd)}"
+cd $RIOTBASE
+
+: "${RIOTTOOLS:=${RIOTBASE}/dist/tools}"
 . "${RIOTTOOLS}"/pr_check/check_labels.sh
 
+EXIT_CODE=0
+
 if tput colors &> /dev/null && [ $(tput colors) -ge 8 ]; then
     CERROR="\e[1;31m"
     CRESET="\e[0m"