#!/bin/bash

dir="$(dirname "$0")"

DEVTOOLS="$dir/data/development.list"

# Install preferred development applications using the list of packages 'data/development.list'
function development {
	if (eval `resize` && whiptail \
		--title "Preferred Development Applications" \
		--yesno "Current list of preferred development tools to install: \n\n$(cat $DEVTOOLS) \n\nProceed with installation?" \
		$LINES $COLUMNS $(( $LINES - 12 )) \
		--scrolltext) then
		show_info 'Installing...'
		show_warning 'Requires root privileges'
		sudo apt install -y $(cat $DEVTOOLS)
		# Done
		show_success 'Done.'
		# Check
		EXITSTATUS=$1
		if [[ $EXITSTATUS != 0 ]]; then
			# Already installed
			show_success 'Already installed.'
			whiptail --title "Finished" --msgbox "Your preferred development tools are installed." 8 78
			main
		else
			whiptail --title "Finished" --msgbox "Installation complete." 8 78
			main
		fi
	else
		main
	fi
}