mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
scripts: genconfig: Add wrapper for gen_config.py
Wrapper for compatibility with ./iop genconfig <board> <profile> - convert params to lowercase and call gen_config.py - parse options: -c, --clean; -b,--boards; refs #12352
This commit is contained in:
parent
f1f96516d0
commit
111dc5950b
1 changed files with 34 additions and 0 deletions
34
iop/scripts/genconfig_wrap.sh
Executable file
34
iop/scripts/genconfig_wrap.sh
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Function to convert parameters to lowercase
|
||||
function to_lowercase {
|
||||
local params=()
|
||||
for param in "$@"; do
|
||||
params+=("$(echo "$param" | tr '[:upper:]' '[:lower:]')")
|
||||
done
|
||||
echo "${params[@]}"
|
||||
}
|
||||
|
||||
function genconfig {
|
||||
target_script="./scripts/gen_config.py"
|
||||
|
||||
# First convert all to lowercase
|
||||
args=$(to_lowercase "$@")
|
||||
|
||||
# Check if an option is provided
|
||||
if [[ ${args[0]} == -* ]]; then
|
||||
# Convert options for target script
|
||||
if [[ ${args[0]} == "-b" || ${args[0]} == "--boards" ]]; then
|
||||
args=()
|
||||
args[0]="-l"
|
||||
elif [[ ${args[0]} == "-c" || ${args[0]} == "--clean" ]]; then
|
||||
args=()
|
||||
args[0]="-c"
|
||||
fi
|
||||
fi
|
||||
|
||||
${target_script} ${args[*]}
|
||||
|
||||
}
|
||||
|
||||
register_command "genconfig" "Generate configuration for board and customer"
|
||||
Loading…
Add table
Reference in a new issue