aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Robbins <contact@andrewrobbins.info>2017-07-20 22:39:16 -0400
committerAndrew Robbins <contact@andrewrobbins.info>2017-07-21 01:37:29 -0400
commit274b669e1a1f45d592f4765b609afb37e2e66e43 (patch)
tree430f48db86bed204f711f643314286d9aa54b982
parent3dab153b0e0d978a064711ec2ed14f174fd215c2 (diff)
downloadlibrebootfr-274b669e1a1f45d592f4765b609afb37e2e66e43.tar.gz
librebootfr-274b669e1a1f45d592f4765b609afb37e2e66e43.zip
Add libreboot_setup_tool_actions()
The added function is a complement to libreboot_setup_project_actions() which moves generation of the TOOL_ACTIONS array out of libs/tool and into the main script for greater malleability. Notably, the proper elements are now included in the array.
-rwxr-xr-xlibreboot16
-rwxr-xr-xlibs/tool5
2 files changed, 16 insertions, 5 deletions
diff --git a/libreboot b/libreboot
index fac84e8f..45d2fb86 100755
--- a/libreboot
+++ b/libreboot
@@ -129,6 +129,7 @@ libreboot_setup() {
executable="$(basename "$0")"
libreboot_setup_include
+ libreboot_setup_tool_actions
libreboot_setup_project_actions
requirements 'tar' 'sed' 'gpg' 'sha256sum' 'git'
@@ -136,6 +137,21 @@ libreboot_setup() {
libreboot_setup_variables
}
+libreboot_setup_tool_actions() {
+ local -i tool_actions_count="${#TOOL_ACTIONS_GENERIC[@]}"
+ local -a tool_actions
+
+ for ((i=0; i<"${tool_actions_count}"; i++)); do
+ tool_actions+=("${TOOL_ACTIONS_GENERIC[i]}")
+
+ if [[ "${TOOL_ACTIONS_GENERIC[i]}" == @(extract) ]]; then
+ tool_actions+=("${TOOL_ACTIONS_GENERIC[i]/%/_check}")
+ fi
+ done
+
+ TOOL_ACTIONS=("${TOOL_ACTIONS_HELPERS[@]}" "${tool_actions[@]}")
+}
+
libreboot_setup_project_actions() {
local -i project_actions_count="${#PROJECT_ACTIONS_GENERIC[@]}"
local -a project_actions
diff --git a/libs/tool b/libs/tool
index 1ee050c4..0fb09a96 100755
--- a/libs/tool
+++ b/libs/tool
@@ -17,11 +17,6 @@
TOOL_ACTIONS_GENERIC=(usage update execute)
TOOL_ACTIONS_HELPERS=(arguments)
-TOOL_ACTIONS=(
- "${TOOL_ACTIONS_GENERIC[@]}"
- "${TOOL_ACTIONS_GENERIC[@]/%/_check}"
- "${TOOL_ACTIONS_HELPERS[@]}"
-)
tool_include() {
local tool=$1