Below is a script, implementing a minimal alpine chroot environment. I want you to heavily simplify it, while preserving the same behavior.
```sh
#!/bin/sh

# Exit immediately if a command exits with a non-zero status
set -e

# Define PATH to ensure all necessary commands are found
export PATH=/sbin:/bin:/usr/sbin:/usr/bin

# Determine the directory where the script is located
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

# Define system-wide rootfs extraction directory
# This could be centralized, but we'll keep it relative to the script's location
ROOTFS_DIR="${SCRIPT_DIR}/.alpine"

# Variables
ALPINE_VERSION="3.20.3"
ALPINE_ARCH="aarch64"
ALPINE_URL="https://dl-cdn.alpinelinux.org/alpine/v3.20/releases/aarch64/alpine-minirootfs-${ALPINE_VERSION}-${ALPINE_ARCH}.tar.gz"
TARBALL=".alpine-minirootfs-${ALPINE_VERSION}-${ALPINE_ARCH}.tar.gz"


# Function to download Alpine minirootfs
download_alpine() {
    if [ -f "$TARBALL" ]; then
        echo "Alpine tarball already exists. Skipping download."
    else
        echo "Downloading Alpine minirootfs..."
        # Use wget if available, otherwise try curl
        if command -v wget > /dev/null 2>&1; then
            wget "$ALPINE_URL" -O "$TARBALL"
        elif command -v curl > /dev/null 2>&1; then
            curl -L "$ALPINE_URL" -o "$TARBALL"
        else
            echo "Error: Neither wget nor curl is available to download files."
            exit 1
        fi
    fi
}

# Function to extract Alpine minirootfs
extract_alpine() {
    if [ -d "$ROOTFS_DIR" ]; then
        echo "Alpine root filesystem already exists at $ROOTFS_DIR. Skipping extraction."
    else
        echo "Extracting Alpine minirootfs to $ROOTFS_DIR..."
        mkdir -p "$ROOTFS_DIR"
        tar -xzf "$TARBALL" -C "$ROOTFS_DIR"
    fi
}

# Function to set up the root user's home directory
setup_root_home() {
    echo "Setting up /root directory in $ROOTFS_DIR..."
    # Create /root if it doesn't exist
    if [ ! -d "$ROOTFS_DIR/root" ]; then
        mkdir -p "$ROOTFS_DIR/root"
        echo "/root directory created."
    else
        echo "/root directory already exists."
    fi

    # Set ownership to root:root
    chown 0:0 "$ROOTFS_DIR/root"

    # Set permissions to 700
    chmod 700 "$ROOTFS_DIR/root"
}


# Function to mount necessary filesystems
mount_filesystems() {
    echo "Mounting /proc, /sys, and /dev in $ROOTFS_DIR..."
    
    # Ensure mount points exist
    mkdir -p "$ROOTFS_DIR/proc" "$ROOTFS_DIR/sys" "$ROOTFS_DIR/dev"

    mount -t proc /proc "$ROOTFS_DIR/proc"
    mount --rbind /sys "$ROOTFS_DIR/sys"
    mount --rbind /dev "$ROOTFS_DIR/dev"
}

# Function to unmount filesystems (to be called after exiting chroot)
unmount_filesystems() {
    echo "Unmounting /proc, /sys, and /dev from $ROOTFS_DIR..."
    umount -l "$ROOTFS_DIR/proc" || true
    umount -l "$ROOTFS_DIR/sys" || true
    umount -l "$ROOTFS_DIR/dev" || true
}

# Function to configure DNS inside the chroot
configure_dns() {
    echo "Configuring DNS inside the chroot environment..."
    # Create or overwrite resolv.conf with Google's DNS servers
    cat > "$ROOTFS_DIR/etc/resolv.conf" <<EOF
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
}

# Function to set environment variables for chroot
prepare_chroot_env() {
    echo "Setting up environment variables for chroot..."
    # Optional: Copy essential environment variables
    mkdir -p "$ROOTFS_DIR/etc/profile.d"
    echo "export HOME=/root" > "$ROOTFS_DIR/etc/profile.d/home.sh"
}

# Function to cleanup the rootfs tarball after extraction
cleanup_rootfs() {
    if [ -f "$TARBALL" ]; then
        echo "Keeping rootfs tarball at $DOWNLOAD_DIR for future use."
        # If you want to remove the tarball after extraction, uncomment the lines below:
        # echo "Removing rootfs tarball ($TARBALL)..."
        # rm -f "$TARBALL"
        # echo "Rootfs tarball removed."
    else
        echo "Rootfs tarball ($TARBALL) does not exist. Skipping removal."
    fi
}

# Trap to ensure filesystems are unmounted on script exit
trap unmount_filesystems EXIT INT TERM

# Ensure script is run as root
if [ "$(id -u)" -ne 0 ]; then
    echo "Error: This script must be run as root. Please run with sudo or as root user."
    exit 1
fi

# Main execution
download_alpine
extract_alpine
setup_root_home
mount_filesystems
configure_dns
prepare_chroot_env

echo "Entering Alpine chroot environment..."
# Use chroot with the HOME environment variable set to /root and automatically cd into /root
chroot "$ROOTFS_DIR" /bin/ash -lc "cd /root; exec /bin/ash -l"

# After exiting chroot, the trap will unmount the filesystems
echo "Exited Alpine chroot environment."

exit 0
```