#
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com
#
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
#
ATF_PLAT="sun50i_h6"
source "${BASH_SOURCE%/*}/include/sunxi64_common.inc"
OVERLAY_PREFIX='sun50i-h6'
[[ -z $CPUMIN ]] && CPUMIN=480000
[[ -z $CPUMAX ]] && CPUMAX=1810000
GOVERNOR=ondemand
ASOUND_STATE='asound.state.sun50iw2-dev'

function post_family_config__install_lightdm_gtk_greeter(){
	if [[ ${BUILD_DESKTOP} == "yes" ]] && [[ ! ${DESKTOP_ENVIRONMENT} =~ ^(kde|gnome)$ ]]; then
		add_packages_to_image lightdm-gtk-greeter
	fi
}

function post_family_tweaks__switch_to_lightdm_gtk_greeter(){
	# Mali T720 seems to have some issues with slick-greeter.
	# Use gtk greeter instead
	if [[ ${BUILD_DESKTOP} == "yes" ]] && [[ ! ${DESKTOP_ENVIRONMENT} =~ ^(kde|gnome)$ ]]; then
		run_host_command_logged mkdir -p "${SDCARD}"/etc/lightdm/lightdm.conf.d/
		run_host_command_logged cat <<- 'gtk-greeter' > "${SDCARD}"/etc/lightdm/lightdm.conf.d/90-gtk-greeter.conf
			[Seat:*]
			greeter-session=lightdm-gtk-greeter
		gtk-greeter
	fi
}
