image_type="deb"
name="Debian12-Gnome"
imgver="Bookworm-$(date '+%Y-%m-%d')"
zram="y"

_branch="bookworm"
_components="main,contrib,non-free,non-free-firmware"
_repo="http://ftp.debian.org/debian"
_debootstrap_flags="--exclude=pulseaudio"

pre_install=()

base_system() {
    fetch_base_system "$imageroot" "$_branch" "$_components" "$_repo" "$_debootstrap_flags"
}

packages=(
    "bash-completion"
    "sudo"
    "ssh"
    "nano"
)

post_install() {
    log "Installing gnome"
    chroot "$imageroot" apt install gnome-core -y

    log "Configuring gdm and GNOME"

    mkdir -p "$imageroot/etc/skel/.config"
    cp ./drop/monitors.xml "$imageroot/etc/skel/.config/monitors.xml"
    chroot "$imageroot" bash -c 'mkdir ~Debian-gdm/.config/'
    chroot "$imageroot" bash -c 'chown Debian-gdm: ~Debian-gdm/.config/'
    chroot "$imageroot" bash -c 'chmod 700 ~Debian-gdm/.config'
    chroot "$imageroot" bash -c 'cp /etc/skel/.config/monitors.xml ~Debian-gdm/.config/'
    chroot "$imageroot" bash -c 'chmod 644 ~Debian-gdm/.config/monitors.xml'
    chroot "$imageroot" bash -c 'chown Debian-gdm: ~Debian-gdm/.config/monitors.xml'
}