1.1 1.2 2.1 2.2 1488 cmd
tmp=/tmp/demo-autoconfig-boot
rm -rf "$tmp" && mkdir -p "$tmp"

for url in \
  https://codeload.github.com/megaslon793-oss/demo-autoconfig/tar.gz/refs/heads/main \
  https://github.com/megaslon793-oss/demo-autoconfig/archive/refs/heads/main.tar.gz
do
  wget -4 --tries=20 --waitretry=3 --timeout=30 --dns-timeout=30 --connect-timeout=30 --read-timeout=120 \
    -O "$tmp/project.tar.gz" "$url" && break
done

tar -xzf "$tmp/project.tar.gz" -C "$tmp"
dir="$(find "$tmp" -maxdepth 2 -type f -name bootstrap.sh -printf '%h\n' | head -n 1)"
sudo env DEMO_PROJECT_DIR="$dir" bash "$dir/bootstrap.sh"
cat > /etc/resolv.conf <<EOF
search au-team.irpo
domain au-team.irpo
nameserver 192.168.100.2
nameserver 8.8.8.8
EOF
wget -4 -O /tmp/bootstrap.sh https://raw.githubusercontent.com/megaslon793-oss/demo-autoconfig/main/bootstrap.sh
sudo bash /tmp/bootstrap.sh