From ca0d8a2ab391bf8dd1a40635d8755ab428bb1f4c Mon Sep 17 00:00:00 2001
From: Chizi123 <build@jsrv.com>
Date: Thu, 15 Oct 2020 08:56:03 +0000
Subject: [PATCH] added dependency checking and automatic adding. not tested

---
 main.sh |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/main.sh b/main.sh
index 66cc216..6d801b0 100755
--- a/main.sh
+++ b/main.sh
@@ -173,13 +173,30 @@
 }
 
 #Add a new package to be built
-#There is no name checking so be sure to put in the name correctly
+#Adding build dependencies is 
 # Usage: add [package name]
 function add {
 	for i in $@; do
 		cd $BUILDDIR
+		if [[ -z $(git ls-remote https://aur.archlinux.org/$i.git) ]]; then
+			echo "Not a package"
+			exit 2
+		fi
 		git clone https://aur.archlinux.org/$i.git
 		cd $i
+
+		#check for all build dependencies
+		for i in ${makedepends[@]}; do
+			if pacman -Si $i; then 
+				makedepends=${makedepends[@]/$delete}
+			fi &>/dev/null
+		done
+		for i in ${makedepends[@]}; do
+			add $i
+		done
+		sudo pacman -Sy
+		
+		#Actually build wanted package
 		build_pkg $i -f
 	done
 	return 0

--
Gitblit v1.9.3