Fix spacing and # error

This commit is contained in:
Cody Cook 2019-06-12 15:39:58 -07:00
commit 50de621dd4

View file

@ -12,20 +12,20 @@ debug=0
if [[ "$debug" -gt 0 ]]; then if [[ "$debug" -gt 0 ]]; then
usrmsg="printf" usrmsg="printf"
else else
usrmsg="#" usrmsg="echo > /dev/null <<"
fi fi
get_tools() { get_tools() {
if test -f "$inb" && test -f "$outb"; then if test -f "$inb" && test -f "$outb"; then
$usrmsg "Tools exist - not acquiring again." $usrmsg "Tools exist - not acquiring again.\n"
else else
$usrmsg "Acquiring latest tools... " $usrmsg "Acquiring latest tools... \n"
if ! test -f "$inb"; then if ! test -f "$inb"; then
$usrmsg "Missing inb; downloading now." $usrmsg "Missing inb; downloading now.\n"
wget -q "$get_inb" -O "$inb" wget -q "$get_inb" -O "$inb"
fi fi
if ! test -f "$outb"; then if ! test -f "$outb"; then
$usrmsg "Missing outb; downloading now." $usrmsg "Missing outb; downloading now.\n"
wget -q "$get_outb" -O "$outb" wget -q "$get_outb" -O "$outb"
fi fi
fi fi
@ -33,17 +33,17 @@ get_tools() {
} }
check_problem() { check_problem() {
$usrmsg "Querying the SMBus for its current status..." $usrmsg "Querying the SMBus for its current status...\n"
problem=$($inb 0xf00f) problem=$($inb 0xf00f)
validate_problem validate_problem
} }
validate_problem() { validate_problem() {
if [[ "$problem" -ne 7 ]]; then if [[ "$problem" -ne 7 ]]; then
$usrmsg " SMBus reporting invalid value; reported: %s" "$problem" $usrmsg " SMBus reporting invalid value; reported: %s\n" "$problem"
fix fix
else else
$usrmsg " The SMBus is currently operating as normal. Exiting script." $usrmsg " The SMBus is currently operating as normal. Exiting script.\n"
exit 0 exit 0
fi fi
} }
@ -65,7 +65,7 @@ verify_fix(){
if [[ "$attempts" -lt 10 ]]; then if [[ "$attempts" -lt 10 ]]; then
check_problem check_problem
else else
$usrmsg "Attempted to recover this %s times... seek alternative recovery method." "$attempts" $usrmsg "Attempted to recover this %s times... seek alternative recovery method.\n" "$attempts"
exit 1 exit 1
fi fi
} }