Container installation and setup functions for Proxmox VE LXC containers
The install.func library provides installation functions executed inside LXC containers after creation. It handles network connectivity verification, OS updates, package installation, DNS resolution checks, MOTD configuration, and container customization.
Comprehensive network connectivity check for IPv4 and IPv6.
DNS Servers Tested
IPv4:
1.1.1.1 (Cloudflare)
8.8.8.8 (Google)
9.9.9.9 (Quad9)
IPv6:
2606:4700:4700::1111 (Cloudflare)
2001:4860:4860::8888 (Google)
2620:fe::fe (Quad9)
install.func:150-207
network_check() { set +e trap - ERR ipv4_connected=false ipv6_connected=false sleep 1 # Check IPv4 connectivity to DNS servers if ping -c 1 -W 1 1.1.1.1 &>/dev/null || ping -c 1 -W 1 8.8.8.8 &>/dev/null || ping -c 1 -W 1 9.9.9.9 &>/dev/null; then msg_ok "IPv4 Internet Connected" ipv4_connected=true else msg_error "IPv4 Internet Not Connected" fi # Check IPv6 connectivity to DNS servers if ping6 -c 1 -W 1 2606:4700:4700::1111 &>/dev/null || ping6 -c 1 -W 1 2001:4860:4860::8888 &>/dev/null || ping6 -c 1 -W 1 2620:fe::fe &>/dev/null; then msg_ok "IPv6 Internet Connected" ipv6_connected=true else msg_error "IPv6 Internet Not Connected" fi # If both checks fail, prompt user if [[ $ipv4_connected == false && $ipv6_connected == false ]]; then read -r -p "No Internet detected, would you like to continue anyway? <y/N> " prompt if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then echo -e "${INFO}${RD}Expect Issues Without Internet${CL}" else echo -e "${NETWORK}Check Network Settings" exit 122 fi fi # DNS resolution checks for GitHub-related domains GIT_HOSTS=("github.com" "raw.githubusercontent.com" "api.github.com" "git.community-scripts.org") GIT_STATUS="Git DNS:" DNS_FAILED=false for HOST in "${GIT_HOSTS[@]}"; do RESOLVEDIP=$(getent hosts "$HOST" | awk '{ print $1 }' | grep -E '(^([0-9]{1,3}\.){3}[0-9]{1,3}$)|(^[a-fA-F0-9:]+$)' | head -n1) if [[ -z "$RESOLVEDIP" ]]; then GIT_STATUS+="$HOST:($DNSFAIL)" DNS_FAILED=true else GIT_STATUS+="$HOST:($DNSOK)" fi done if [[ "$DNS_FAILED" == true ]]; then fatal "$GIT_STATUS" else msg_ok "$GIT_STATUS" fi set -e trap 'error_handler' ERR}
#!/usr/bin/env bashsource <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/install.func)# 1. Set up container OS and verify networksetting_up_containernetwork_check# 2. Update OS and install packagesupdate_os# 3. Configure MOTD and SSHmotd_ssh# 4. Customize containercustomize