diff --git a/script/.local/bin/admin-tasks b/script/.local/bin/admin-tasks new file mode 100755 index 0000000..3b317bd --- /dev/null +++ b/script/.local/bin/admin-tasks @@ -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 + diff --git a/script/.local/bin/openocd-gdb-stm32f3x b/script/.local/bin/openocd-gdb-stm32f3x new file mode 100755 index 0000000..ba6cced --- /dev/null +++ b/script/.local/bin/openocd-gdb-stm32f3x @@ -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 +