mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
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
34 lines
825 B
Bash
Executable file
34 lines
825 B
Bash
Executable file
#!/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"
|