This commit is contained in:
ahmadbilalkhalid 2019-10-24 11:40:08 +05:00
parent 21c8019313
commit 4e2da675fb
1 changed files with 22 additions and 15 deletions

View File

@ -32,7 +32,7 @@ setup_ssh() {
# TODO: Make sure to replace the following address with http://metadata
# whenever we got http://metadata resolving to url work successfully.
metadata=$(curl -s http://metadata:5000)
metadata=$(curl -s http://metadata:9000)
echo "$metadata" | jq -r '.["ssh-key-list"] | .[]' > ssh-key-list.txt
while read ssh_key; do
@ -82,23 +82,30 @@ setup_dns() {
setup_etc_host() {
tput setaf 2; tput bold; echo "Setting up /etc/hosts"; tput sgr0;
metadata=$(curl -s http://[2a0a:e5c1:144::]:5000)
host_list=$(echo "$metadata" | jq -r '.["host-list"]')
host_list_len=$(echo "$host_list" | jq -r '. | length')
cat > /etc/hosts <<EOF
cat > /etc/hosts << EOF
127.0.0.1 localhost.my.domain localhost localhost.localdomain localhost
::1 localhost localhost.localdomain
$(
for i in $(seq 0 $((host_list_len - 1)));
do
ip=$(echo $host_list | jq -r ".[$i][0]")
hostname=$(echo $host_list | jq -r ".[$i][1]")
printf "%-25s %s\n" $ip $hostname
done
)
2a0a:e5c1:144:: metadata
EOF
# metadata=$(curl -s http://[2a0a:e5c1:144::]:9000)
# host_list=$(echo "$metadata" | jq -r '.["host-list"]')
# host_list_len=$(echo "$host_list" | jq -r '. | length')
# cat > /etc/hosts <<EOF
# 127.0.0.1 localhost.my.domain localhost localhost.localdomain localhost
# ::1 localhost localhost.localdomain
# $(
# for i in $(seq 0 $((host_list_len - 1)));
# do
# ip=$(echo $host_list | jq -r ".[$i][0]")
# hostname=$(echo $host_list | jq -r ".[$i][1]")
# printf "%-25s %s\n" $ip $hostname
# done
# )
# EOF
}
@ -113,8 +120,8 @@ setup_dns
# Initial Package Installation
if [[ $(get_distro) = "alpine" ]]; then
edge_package_flags='--update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted'
apk update -q
apk upgrade
apk add -q ndisc6 $edge_package_flags
apk add -q openssh-server sfdisk util-linux jq curl ncurses
else