-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrm.sh
executable file
·130 lines (119 loc) · 2.82 KB
/
brm.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/bash
#
# @brief Build root manager (brm)
# @version ver.1.0
# @date Sun Nov 21 00:40:40 CET 2021
# @company None, free software to use 2021
# @author Vladimir Roncevic <elektron.ronca@gmail.com>
#
BUILD_ROOT_REPO="https://github.com/buildroot/buildroot.git"
BUILD_ROOT_DIR="/data/dev/build_root"
. brm_clone_project.sh
. brm_list_projects.sh
. brm_list_configurations.sh
. brm_menu_configuration.sh
. brm_build_project.sh
. brm_list_images.sh
. brm_clone_project.sh
. brm_setup_project.sh
#
# @brief Print help info for options
# @param None
# @retval None
#
# @usage
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#
# __brm_build_root_helper
#
function __brm_build_root_helper {
read -r -d '' END_HELP_TXT <<- END_HELP_TXT
### Create and setup build root project structure
init
### List projects in BRM workspace
list
### List prepared configurations in project
conf
### Open menu configuration for project
menu
### Start build process for selected configuration
build
### List build root output images from project
images
### Clean up build outputs for project
clean
END_HELP_TXT
echo "$END_HELP_TXT"
}
#
# @brief Buildroot manager handler
# @param Value required option
# @retval Success return 0, else return 127
#
# @usage
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#
# local OPTION="init" STATUS
# brm_handler $OPTION
# STATUS=$?
#
# if [ $STATUS -eq 0 ]; then
# # true
# # notify admin | user success opearation
# # exit 0
# else
# # false
# # missing argument | failed operation
# # exit $STATUS
# fi
#
function brm_handler {
local OPTION=$1 NUMBER_OF_ARGUMENTS=$# STATUS
if [[ "$NUMBER_OF_ARGUMENTS" -ne 1 || ! -n "${OPTION}" ]]; then
__brm_build_root_helper
return 127
fi
STATUS=128
case $OPTION in
"init")
printf "%s: " "[brm] provide project name"
read PRO_NAME
__brm_setup_project $PRO_NAME
STATUS=$?
;;
"list")
__brm_list_projects
STATUS=$?
;;
"conf")
__brm_list_configurations
STATUS=$?
;;
"menu")
__brm_menu_configuration
STATUS=$?
;;
"build")
printf "%s: " "[brm] select target configuration"
read CONFIGURATION
__brm_build_project $CONFIGURATION
STATUS=$?
;;
"images")
__brm_list_images
STATUS=$?
;;
"clean")
__brm_clean_project
STATUS=$?
;;
*)
__brm_build_root_helper
;;
esac
return $STATUS
}
# @brief Main entry point
brm_handler $1
BRM_STATUS=$?
exit $BRM_STATUS