From e6e9805edcdfd7176a32f35cb8df04b25dbcb03c Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Thu, 1 Sep 2022 07:53:34 +0000 Subject: Reapply "replace two perl snippets with calls to script-utils" This reverts commit e6417d19767e080b4a668f84553df05adf13d1bf. --- vespabase/src/common-env.sh | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/vespabase/src/common-env.sh b/vespabase/src/common-env.sh index afed1595a19..628ebe6b074 100755 --- a/vespabase/src/common-env.sh +++ b/vespabase/src/common-env.sh @@ -35,26 +35,7 @@ consider_fallback () { read_conf_file () { deffile="$VESPA_HOME/conf/vespa/default-env.txt" if [ -f "${deffile}" ]; then - 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) + eval $(${VESPA_HOME}/libexec/vespa/script-utils export-env) fi } @@ -329,8 +310,7 @@ use_configserver_if_needed () { } getJavaOptionsIPV46() { - canon_ipv4=$(hostname | perl -pe 'chomp; ($_,$rest) = gethostbyname($_);') - if [ -z "${canon_ipv4}" ]; then + if ${VESPA_HOME}/libexec/vespa/script-utils ipv6-only; then echo " -Djava.net.preferIPv6Addresses=true" fi } -- cgit v1.2.3