-
Notifications
You must be signed in to change notification settings - Fork 77
/
build_active_devices.sh
executable file
·54 lines (48 loc) · 1.81 KB
/
build_active_devices.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Function to display Help Message
function _help(){
echo "Usage: ./build_active_devices.sh [-r <Build Mode>]"
echo
echo "Build Project Mu UEFI for active Devices"
echo
echo "Options:"
echo " --release <Build Mode>, -r <Build Mode>: Release mode for building, 'RELEASE' is the default or use 'DEBUG' alternatively."
echo " --help, -h: Shows this Help."
echo
echo "MainPage: https://github.com/Project-Silicium/Mu-Silicium"
exit 1
}
# Functions to display the Message Type (Error or Warning)
function _error(){ echo -e "\033[1;31m${@}\033[0m" >&2;exit 1; }
function _warn(){ echo -e "\033[0;33m${@}\033[0m" >&2; }
# Check if any args were given
OPTS="$(getopt -o hr: -l help,release: -n 'build_uefi.sh' -- "$@")"||exit 1
eval set -- "${OPTS}"
while true
do case "${1}" in
-h|--help) _help 0;shift;;
-r|--release) TARGET_BUILD_MODE="${2}";shift 2;;
--) shift;break;;
*) _help 1;;
esac
done
# Parse active devices from Status.md
DEVICES=$(awk '/**State: Active**/,/**Codename:/ {if ($0 ~ /**Codename:/) print substr($2, 1, length($2)-2)}' Status.md)
# Build UEFI for active Devices
for Device in $DEVICES; do
# Include Device Config if it exists
if [ -f "Resources/Configs/${Device}.conf" ]
then source "Resources/Configs/${Device}.conf"
else _error "\nDevice configuration not found from ${Device}!\nCheck if your .conf File is in the 'configs' Folder\n"
fi
# Check if the Device has Multiple Models
if [ ${TARGET_MULTIPLE_MODELS} == 1 ]; then
# If device has it build device with models
for ((Model = 0; Model < $TARGET_NUMBER_OF_MODELS; Model++)); do
bash ./build_uefi.sh -d $Device -r $_TARGET_BUILD_MODE -c -m $Model || exit $?
done
else
# If device don't have it just run build script
bash ./build_uefi.sh -d $Device -r $_TARGET_BUILD_MODE -c || exit $?
fi
done