diff --git a/bin/run.sh b/bin/run.sh index 8fd98c2..fac9711 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -24,12 +24,13 @@ if [[ "$DIT4C_INSTANCE_URI_UPDATE_URL" == "" ]]; then exit 1 fi -PORTAL_DOMAIN=$(echo $DIT4C_INSTANCE_URI_UPDATE_URL | awk -F/ '{print $3}') +PORTAL_URI=$(echo $DIT4C_INSTANCE_URI_UPDATE_URL | sed -e 's/^\(https*:\/\/[^\/]*\).*$/\1/') +PORTAL_PUBLIC_CONFIG_URL="${PORTAL_URI}/config.json" umask 0077 while true do - SSH_SERVER=$(dig +short TXT $PORTAL_DOMAIN | grep -Eo "dit4c-fileserver-9pfs=[^\"]*" | cut -d= -f2 | xargs /opt/bin/sort_by_latency.sh | head -1) + SSH_SERVER=$(curl $PORTAL_PUBLIC_CONFIG_URL | jq -r '.storage | .["9pfs"] | .servers | .[] | @text' | xargs /opt/bin/sort_by_latency.sh | head -1) SSH_HOST=$(echo $SSH_SERVER | cut -d: -f1) SSH_PORT=$(echo $SSH_SERVER | cut -d: -f2) diff --git a/install.sh b/install.sh index f9caceb..23a45a9 100755 --- a/install.sh +++ b/install.sh @@ -8,7 +8,7 @@ echo nameserver 8.8.8.8 > /etc/resolv.conf # Install packages apt-get update -apt-get install -y curl openssh-client nmap dnsutils fuse socat +apt-get install -y curl fuse jq nmap openssh-client socat apt-get clean # Cleanup DNS config diff --git a/test/dit4c-helper-storage-9pfs.linux.amd64.aci.bats b/test/dit4c-helper-storage-9pfs.linux.amd64.aci.bats index f546323..cdf1ad2 100644 --- a/test/dit4c-helper-storage-9pfs.linux.amd64.aci.bats +++ b/test/dit4c-helper-storage-9pfs.linux.amd64.aci.bats @@ -35,6 +35,14 @@ teardown() { [ "$status" -eq 0 ] } +@test "jq binary runs" { + run sudo $RKT run --insecure-options=image --stage1-path=$RKT_STAGE1 \ + $IMAGE \ + --exec /usr/bin/jq -- -V + echo $output + [ "$status" -eq 0 ] +} + @test "nmap binary runs" { run sudo $RKT run --insecure-options=image --stage1-path=$RKT_STAGE1 \ $IMAGE \