aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Robbins <contact@andrewrobbins.info>2017-07-20 16:06:07 -0400
committerAndrew Robbins <contact@andrewrobbins.info>2017-07-21 01:34:55 -0400
commit15d5ee9e71fca2df938c5692d070f66733ab69ab (patch)
treedd167922578b51cb1c6821573a100dc501b2b4bc
parentf92dcc2d00667abe5fa4e509f49a90964ab52229 (diff)
downloadlibrebootfr-15d5ee9e71fca2df938c5692d070f66733ab69ab.tar.gz
librebootfr-15d5ee9e71fca2df938c5692d070f66733ab69ab.zip
Add libreboot_setup_project_actions()
The added function is called after all files in libs/ have been sourced and provides the correct action sequence for 'test'. Importantly, this function avoids providing undefined 'usage_check' and 'clean_check' actions.
-rwxr-xr-xlibreboot16
-rwxr-xr-xlibs/project5
2 files changed, 16 insertions, 5 deletions
diff --git a/libreboot b/libreboot
index 9c58618e..fac84e8f 100755
--- a/libreboot
+++ b/libreboot
@@ -129,12 +129,28 @@ libreboot_setup() {
executable="$(basename "$0")"
libreboot_setup_include
+ libreboot_setup_project_actions
requirements 'tar' 'sed' 'gpg' 'sha256sum' 'git'
libreboot_setup_variables
}
+libreboot_setup_project_actions() {
+ local -i project_actions_count="${#PROJECT_ACTIONS_GENERIC[@]}"
+ local -a project_actions
+
+ for ((i=0; i<"${project_actions_count}"; i++)); do
+ project_actions+=("${PROJECT_ACTIONS_GENERIC[i]}")
+
+ if [[ "${PROJECT_ACTIONS_GENERIC[i]}" == !(usage|clean) ]]; then
+ project_actions+=("${PROJECT_ACTIONS_GENERIC[i]/%/_check}")
+ fi
+ done
+
+ PROJECT_ACTIONS=("${PROJECT_ACTIONS_HELPERS[@]}" "${project_actions[@]}")
+}
+
libreboot_setup_include() {
local libs_path="${root}/libs"
local conf_path
diff --git a/libs/project b/libs/project
index c2f0f764..6df2f714 100755
--- a/libs/project
+++ b/libs/project
@@ -17,11 +17,6 @@
PROJECT_ACTIONS_GENERIC=(usage download extract update build install release clean)
PROJECT_ACTIONS_HELPERS=(arguments)
-PROJECT_ACTIONS=(
- "${PROJECT_ACTIONS_GENERIC[@]}"
- "${PROJECT_ACTIONS_GENERIC[@]/%/_check}"
- "${PROJECT_ACTIONS_HELPERS[@]}"
-)
INSTALL_REGEX='\([^:]*\):\(.*\)'