mirror of https://github.com/ericonr/dotfiles.git
44 lines
874 B
Bash
Executable File
44 lines
874 B
Bash
Executable File
#!/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
|
|
|