summaryrefslogtreecommitdiffstats
path: root/vespabase
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2022-08-30 14:04:49 +0200
committerGitHub <noreply@github.com>2022-08-30 14:04:49 +0200
commite6417d19767e080b4a668f84553df05adf13d1bf (patch)
tree0ca0697d7df1118c6259338774b5ba5311cd6a83 /vespabase
parent28e0da92641cb3ec9693349fcb28fd554e6b72ef (diff)
Revert "replace two perl snippets with calls to script-utils"
Diffstat (limited to 'vespabase')
-rwxr-xr-xvespabase/src/common-env.sh24
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
}