xref: /utopia/UTPA2-700.0.x/projects/build/scripts/checkconfig/check-config.sh (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1#!/bin/bash
2
3# all config.required.xxx are based on CL621094
4
5# these identifiers can't be disabled!!!!!!
6REQUIRED_CONFIG_PATH=scripts/checkconfig
7#ANDROID_IDENTIFIER=CONFIG_ANDROID
8ANDROID_IDENTIFIER=CONFIG_ANDROID_LOGGER
9EMMC_IDENTIFIER=CONFIG_EMMC_PARTITION
10NAND_IDENTIFIER=CONFIG_MSTAR_NAND
11
12cat .config | \grep -v ^# | \grep -v ^$ | sort > config.tmp
13
14check_miss()
15{
16	if [ "$1" == "0" ]; then
17		#echo [WARNING] you missed some required configs, press enter to continue
18		#read
19		error=1
20	fi
21}
22
23# platform
24grep $ANDROID_IDENTIFIER config.tmp > /dev/null
25if [ "$?" == "0" ]; then
26	echo check .config with config.required.android
27	echo -ne '\E[37;44m'
28	grep $REQUIRED_CONFIG_PATH/config.required.android -v -f config.tmp
29	check_miss $?
30	echo -ne '\033[0m'
31	#sort $REQUIRED_CONFIG_PATH/config.required.android > config.platform
32	#diff config.tmp config.platform | \grep \>
33else
34	echo check .config with config.required.supernova
35	echo -ne '\E[37;44m'
36	grep $REQUIRED_CONFIG_PATH/config.required.supernova -v -f config.tmp
37	check_miss $?
38	echo -ne '\033[0m'
39	#sort $REQUIRED_CONFIG_PATH/config.required.supernova > config.platform
40	#diff config.tmp config.platform | \grep \>
41fi
42
43# storage
44grep $EMMC_IDENTIFIER config.tmp > /dev/null
45if [ "$?" == "0" ]; then
46	echo check .config with config.required.emmc
47	echo -ne '\E[37;44m'
48	grep $REQUIRED_CONFIG_PATH/config.required.emmc -v -f config.tmp
49	check_miss $?
50	echo -ne '\033[0m'
51	#sort $REQUIRED_CONFIG_PATH/config.required.emmc > config.storage
52	#diff config.tmp config.storage | \grep \>
53fi
54grep $NAND_IDENTIFIER config.tmp > /dev/null
55if [ "$?" == "0" ]; then
56	echo check .config with config.required.nand
57	echo -ne '\E[37;44m'
58	grep $REQUIRED_CONFIG_PATH/config.required.nand -v -f config.tmp
59	check_miss $?
60	echo -ne '\033[0m'
61	#sort $REQUIRED_CONFIG_PATH/config.required.nand > config.storage
62	#diff config.tmp config.storage | \grep \>
63fi
64
65echo check .config with config.required.all
66echo -ne '\E[37;44m'
67grep $REQUIRED_CONFIG_PATH/config.required.all -v -f config.tmp
68check_miss $?
69echo -ne '\033[0m'
70
71if [ "$error" == "1" ]; then
72	echo -ne '\E[37;44m'
73	echo you missed the above required configs, y to continue, n to exit:
74	echo \(or email bob.fu@mstarsemi.com to ask about it\)
75	echo -ne '\033[0m'
76	read choice
77
78	case "$choice" in
79		y)
80		;;
81		n)
82		exit 1
83		;;
84		*)
85		echo is that funny?
86		exit 1
87esac
88
89fi
90