added packages to the prereq list since we are not building them with the global...
[lxqt-slackware.git] / CHECK_PREREQ.sh
1 #! /bin/bash
2
3 # Check prerequisite packages before compile time :-)
4
5 CWD=$(pwd)
6 PREREQ=${PREREQ:-${CWD}/prereq}
7 PKGS="/var/log/packages"
8 RESULT="test_prereq.log"
9 MISSING=0
10
11 if [ ! -f $PREREQ ];then
12 echo -e "NO LIST OF PREREQUISITE PACKAGES FOUND! EXITING"
13 echo "NO PREREQ LIST FOUND!" > $RESULT
14 exit 117
15 else
16 # let's source the prereq list
17 . $PREREQ
18 fi
19
20 if [ ! -f $RESULT ];then
21 touch $RESULT
22 fi
23
24 # let's test them
25 for KEY in ${!deps[@]}; do
26 # echo "KEY is $KEY and VALUE is ${deps[${KEY}]}"
27 findings=$(ls $PKGS |egrep -i "^$KEY")
28 echo -e "$KEY:" >> $RESULT
29 if [[ $findings != "" ]]; then
30 for l in $findings; do
31 echo -e "Installed\t$l" >> $RESULT
32 done
33 echo >> $RESULT
34 else
35 let MISSING=MISSING+1
36 echo -e "Missing\t'$KEY'" >> $RESULT
37 echo -e "Expected\t'${deps[${KEY}]}'." >> $RESULT
38 echo >> $RESULT
39 fi
40 done
41
42 if [[ $MISSING -gt 1 ]]; then
43 # We have missing packages, issue a warning!!
44 echo -e "looks like $MISSING packages are missing. Go check the log."
45 echo -e "grep \"Missing\" $RESULT"
46 echo
47 else
48 # No missing packages. We can procede!!
49 echo -e "GREAT!! All dependancies are satisfied."
50 echo -e "Let's start building."
51 echo
52 fi