added packages to the prereq list since we are not building them with the global...
[lxqt-slackware.git] / CHECK_PREREQ.sh
CommitLineData
73c8ba7d 1#! /bin/bash
2
3# Check prerequisite packages before compile time :-)
4
5CWD=$(pwd)
6PREREQ=${PREREQ:-${CWD}/prereq}
7PKGS="/var/log/packages"
8RESULT="test_prereq.log"
9MISSING=0
10
11if [ ! -f $PREREQ ];then
12 echo -e "NO LIST OF PREREQUISITE PACKAGES FOUND! EXITING"
13 echo "NO PREREQ LIST FOUND!" > $RESULT
14 exit 117
15else
16 # let's source the prereq list
17 . $PREREQ
18fi
19
20if [ ! -f $RESULT ];then
21 touch $RESULT
22fi
23
24# let's test them
25for 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
40done
41
42if [[ $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
47else
48 # No missing packages. We can procede!!
49 echo -e "GREAT!! All dependancies are satisfied."
50 echo -e "Let's start building."
51 echo
52fi