mirror of https://github.com/ericonr/dotfiles.git
Add admin-tasks with (for now) fwupdmgr and openocd initializing access to gdb.
This commit is contained in:
parent
c0b5754473
commit
46dca278ff
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue