Add admin-tasks with (for now) fwupdmgr and openocd initializing access to gdb.

This commit is contained in:
Érico Rolim 2019-10-08 22:20:08 -03:00
parent c0b5754473
commit 46dca278ff
2 changed files with 52 additions and 0 deletions

43
script/.local/bin/admin-tasks Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Formatting:
# https://stackoverflow.com/questions/2924697/how-does-one-output-bold-text-in-bash
bold=$(tput bold)
normal=$(tput sgr0)
function bold_echo() {
echo "${bold}$1${normal}"
}
function print_help() {
echo "This command allows you to quickly run a few adminstrative tasks!"
}
# run fwupmgr
function firmware() {
bold_echo "Devices available:"
fwupdmgr get-devices
bold_echo "Updates available:"
fwupdmgr get-updates
bold_echo "Use 'fwupdmgr update' to update all firmware"
}
# Run function from script:
# https://stackoverflow.com/questions/8818119/how-can-i-run-a-function-from-a-script-in-command-line
# Check if the function exists (bash specific)
if declare -f "$1" > /dev/null
then
# call arguments verbatim
"$@"
else
# Show a helpful error
echo "'$1' is not a known function name" >&2
print_help
exit 1
fi

View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
openocd -f interface/stlink.cfg -f target/stm32f3x.cfg >/dev/null 2>/dev/null &
PID=$!
arm-none-eabi-gdb "$@"
kill $PID