Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding trap to catch errors and suggesting fixes that worked for me #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
#!/bin/sh
############################################

test "$(id -u)" -eq "0" || { echo "Whao dude! You gotta run this type of thing as root! try: sudo $0" ; exit 1; }

set -e

finish() {
local exit_code=$?
# Tell the user something went wrong
test $exit_code -eq 0 || echo "Whao dude, something went wrong..."
# Possibly the user did not partition the sd card correctly and is running out of space
if df | grep "100%" ; then
echo "Whao dude, looks like you're all full"
df | grep 100%
echo "Maybe you need to repartition your sd card?"
fi
exit $exit_code
}
trap finish EXIT

echo "Welcome to PiCAST 3! \n\n\n"

echo "Performing Aptitude Update... \n"
Expand Down