#!/bin/bash

# variables
SRC="source"
KERNEL="linux-rpi"
CKERNEL="linux"

# host machine
HOST_ARCH=`uname -m`
HOST_CODENAME=`cat /etc/os-release | grep -w "VERSION_CODENAME" | sed 's/VERSION_CODENAME=//g'`
HOST_MACHINE=`cat /etc/os-release | grep -w NAME | sed 's/NAME=//g' | sed 's/"//g' | sed 's/ GNU\/Linux//g'`
HOST_PRETTY=`cat /etc/os-release | grep -w "PRETTY_NAME" | sed 's/PRETTY_NAME=//g' | sed 's/"//g'`
EXPIRED="The userdata.txt file has expired. Create a new one."

# validate
validation (){
BUILDER=`grep "BUILDER=" "userdata.txt" | sed 's/BUILDER=//g'`
UD="userdata.txt"
if [ -f "$UD" ]; then
	:;
else 
	echo "";
	echo "Create a $UD file";
	while [ true ]; do
		read -t 10 -n 1
		if [ $? = 0 ]; then
			exit 0;
		fi
	done
fi
if [[ "$BUILDER" == "6.9" ]]; then :; else echo -e "${EXPIRED}"; exit 0; fi
}

# board dot txt
noboard (){
echo -e "board.txt was not found."
echo -e "Run again with the correct spelling and or command."
echo -e ""
read -p "Press enter to continue."
exit 0
}

# packages
PKGS="tzdata keyboard-configuration sudo man-db dbus initramfs-tools whiptail \
	fonty-rg patch curl wget apt-transport-https dirmngr cmake rsync \
	psmisc parted pv zip unzip aria2 libell0 fdisk i2c-tools cpu \
	haveged git build-essential net-tools wireless-regdb ntp mtools \
	fuse3 wpasupplicant wireless-tools usbutils alsa-utils gettext iw \
	bison flex mc nano figlet toilet dialog python3 python3-setuptools \
	ntfs-3g bc zram-tools libncursesw5-dev libssl-dev autopoint autoconf \
	automake pkg-config libtool fake-hwclock avahi-utils distro-info-data \
	lsb-release liblzo2-2 bluetooth bluez bluez-tools gpiod python3-libgpiod \
	e2fsprogs btrfs-progs f2fs-tools xfsprogs kpartx sg3-utils lsscsi flashrom"

# sys-mods
SYSMODS="debhelper d-shlibs rfkill dosfstools psmisc"

# firmware
FIRMWARE="firmware-linux-nonfree firmware-linux firmware-misc-nonfree \
          firmware-realtek firmware-ralink"
