diff --git a/CHANGELOG.md b/CHANGELOG.md index 524d238ba..d258a7b60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ permalink: /docs/en-US/changelog/ # Changelog -## 3.13 ( 2023 December TBA ) +## 3.13 ( 2024 TBA ) ### Enhancements @@ -17,6 +17,10 @@ permalink: /docs/en-US/changelog/ * Opted out of Dotnet package telemetry ( #2689 ) * Replace references to the Squizlab PHPCS with that from the PHPCS Standards org ( #2692 ) +### Maintenance + +* Switch the Parallels Arm64 box from `mpasternak/focal64-arm` to `bento/ubuntu-22.04-arm64` to match x86 boxes ( #2695 ) + ### Bug Fixes * The host file inside the VM was only adding sites with `127.0.0.1` addresses, now it adds the IPVv6 `::1` too ( #2689 ) diff --git a/Vagrantfile b/Vagrantfile index d408b8908..ea506a906 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -447,7 +447,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # this seems to be the most reliable way to detect whether or not we're # running under ARM64. if Etc.uname[:version].include? 'ARM64' - override.vm.box = 'mpasternak/focal64-arm' + override.vm.box = 'bento/ubuntu-20.04-arm64' end end diff --git a/provision/core/env/provision.sh b/provision/core/env/provision.sh index dcbeb844f..fa46db7b3 100644 --- a/provision/core/env/provision.sh +++ b/provision/core/env/provision.sh @@ -2,6 +2,19 @@ set -eo pipefail DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +DNS_SERVERS=( + # Quad9 + "9.9.9.9" + "149.112.112.112" + "2620:fe::fe" + "2620:fe::9" + + # Cloudflare + "1.1.1.1" + "1.0.0.2" + "2606:4700:4700::1112" + "2606:4700:4700::1002" +) # @description Adds the homebin folder to PATH # @noargs @@ -24,6 +37,57 @@ function setup_vvv_env() { /etc/environment } +# Function to test DNS resolution for a specified domain +function vvv_check_domain_dns() { + local domain="${1}" + + if [ -z "${domain}" ]; then + vvv_Error "Error: No domain provided." + return 1 + fi + + if command -v nslookup &> /dev/null; then + nslookup "${domain}" >/dev/null 2>&1 + elif command -v dig &> /dev/null; then + dig +short "${domain}" >/dev/null 2>&1 + else + vvv_error "Error: Neither nslookup nor dig is available." + return 1 + fi +} + +# @description Tests for working DNS and re-configures on failure +function setup_dns() { + if vvv_check_domain_dns "github.com" && vvv_check_domain_dns "ppa.launchpadcontent.net"; then + return + fi + + vvv_warn "Could not resolve github.com or ppa.launchpadcontent.net domains via DNS, configuring 3rd party DNS resolvers." + + DNS_SERVERS_TO_ADD=() + + # Test reachability of DNS servers + for dns_server in "${DNS_SERVERS[@]}"; do + if ping -c 1 -W 2 "${dns_server}" >/dev/null 2>&1; then + echo "DNS server ${dns_server} is reachable" + DNS_SERVERS_TO_ADD+=("${dns_server}") + fi + done + + vvv_info "Adding DNS Servers: ${DNS_SERVERS_TO_ADD[*]}" + + for file in /etc/netplan/*.yaml; do + for dns_server in "${DNS_SERVERS_TO_ADD[@]}"; do + if ! grep -qF "${dns_server}" "${file}"; then + sed -i "/nameservers:/a \ \ \ \ addresses: [${dns_server}]" "${file}" + echo "DNS updated to ${dns_server} in ${file}" + fi + done + done + + netplan apply +} + # @description Remove MOTD output from Ubuntu and add our own # @noargs function cleanup_terminal_splash() { @@ -116,6 +180,7 @@ function profile_setup() { function vvv_init_profile() { # Profile_setup vvv_info " * Bash profile setup and directories." + setup_dns setup_vvv_env cleanup_terminal_splash profile_setup