diff options
author | Harald Musum <musum@verizonmedia.com> | 2022-08-30 14:04:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-30 14:04:49 +0200 |
commit | e6417d19767e080b4a668f84553df05adf13d1bf (patch) | |
tree | 0ca0697d7df1118c6259338774b5ba5311cd6a83 | |
parent | 28e0da92641cb3ec9693349fcb28fd554e6b72ef (diff) |
Revert "replace two perl snippets with calls to script-utils"
-rwxr-xr-x | vespabase/src/common-env.sh | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/vespabase/src/common-env.sh b/vespabase/src/common-env.sh index 628ebe6b074..afed1595a19 100755 --- a/vespabase/src/common-env.sh +++ b/vespabase/src/common-env.sh @@ -35,7 +35,26 @@ consider_fallback () { read_conf_file () { deffile="$VESPA_HOME/conf/vespa/default-env.txt" if [ -f "${deffile}" ]; then - eval $(${VESPA_HOME}/libexec/vespa/script-utils export-env) + eval $(perl -ne ' + chomp; + my ($action, $varname, $value) = split(" ", $_, 3); + $varname =~ s{[.]}{__}g; + if ($varname !~ m{^\w+}) { + # print STDERR "invalid var name $varname" + next; + } + if ($action eq "fallback" || $action eq "override") { + next if ($action eq "fallback" && $ENV{$varname} ne ""); + # quote value + if ($value !~ m{^["][^"]*["]$} ) { + $value =~ s{(\W)}{\\$1}g; + } + print "$varname=$value; export $varname; " + } + if ($action eq "unset") { + print "export -n $varname; unset $varname; " + } + ' < $deffile) fi } @@ -310,7 +329,8 @@ use_configserver_if_needed () { } getJavaOptionsIPV46() { - if ${VESPA_HOME}/libexec/vespa/script-utils ipv6-only; then + canon_ipv4=$(hostname | perl -pe 'chomp; ($_,$rest) = gethostbyname($_);') + if [ -z "${canon_ipv4}" ]; then echo " -Djava.net.preferIPv6Addresses=true" fi } |