summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2018-05-22 10:07:59 -0400
committerScott Moser <smoser@brickies.net>2018-05-22 10:07:59 -0400
commitb4ae0e1fb8a48a83ea325cf032eb1acb196ee31c (patch)
tree0354c2e46e541135c1e327329ebfb36d58df6b01 /tools
parent327af4a7e64a7e52f2bab7c6d80b79a2474d93eb (diff)
downloadvyos-cloud-init-b4ae0e1fb8a48a83ea325cf032eb1acb196ee31c.tar.gz
vyos-cloud-init-b4ae0e1fb8a48a83ea325cf032eb1acb196ee31c.zip
ds-identify: ensure that we have certain tokens in PATH.
SuSE builds were not getting a PATH set in generator's environment. This may seem like mis-configuration on the system, but caused ds-identify to fail to find blkid (or any other program). The change here just ensures that we get /sbin /usr/sbin /bin /usr/bin into the PATH when main is run. LP: #1771382
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ds-identify11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/ds-identify b/tools/ds-identify
index dc7ac3a7..ce0477a5 100755
--- a/tools/ds-identify
+++ b/tools/ds-identify
@@ -187,6 +187,16 @@ block_dev_with_label() {
return 0
}
+ensure_sane_path() {
+ local t
+ for t in /sbin /usr/sbin /bin /usr/bin; do
+ case ":$PATH:" in
+ *:$t:*|*:$t/:*) continue;;
+ esac
+ PATH="${PATH:+${PATH}:}$t"
+ done
+}
+
read_fs_info() {
cached "${DI_BLKID_OUTPUT}" && return 0
# do not rely on links in /dev/disk which might not be present yet.
@@ -1464,6 +1474,7 @@ _main() {
main() {
local ret=""
+ ensure_sane_path
[ -d "$PATH_RUN_CI" ] || mkdir -p "$PATH_RUN_CI"
if [ "${1:+$1}" != "--force" ] && [ -f "$PATH_RUN_CI_CFG" ] &&
[ -f "$PATH_RUN_DI_RESULT" ]; then