summaryrefslogtreecommitdiff
path: root/install.sh
diff options
context:
space:
mode:
authorluckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com>2022-01-07 18:18:10 -0500
committerGitHub <noreply@github.com>2022-01-07 18:18:10 -0500
commita4417ead3c87c6cb36efc9829200e650f2a413a9 (patch)
treeed600e702dd3932637cc92dedf6ef2e3bac97025 /install.sh
parent1cff637716dcc2e5fff74c7bedb7ae0da0eb5b47 (diff)
parentc19734bb7acd33e27fb28fb1ebb84b5270aac8c5 (diff)
Merge pull request #48 from luckytyphlosion/master
Add helpful error checks for common user errors.
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh40
1 files changed, 28 insertions, 12 deletions
diff --git a/install.sh b/install.sh
index 608d82d..54aa66e 100755
--- a/install.sh
+++ b/install.sh
@@ -1,17 +1,33 @@
#!/bin/sh
set -e
if [ "$1" != "" ]; then
- mkdir -p $1/tools/agbcc
- mkdir -p $1/tools/agbcc/bin
- mkdir -p $1/tools/agbcc/include
- mkdir -p $1/tools/agbcc/lib
- cp agbcc $1/tools/agbcc/bin/
- cp old_agbcc $1/tools/agbcc/bin/
- cp agbcc_arm $1/tools/agbcc/bin/
- cp -R libc/include $1/tools/agbcc/ #drop include, because we don't want include/include
- cp ginclude/* $1/tools/agbcc/include/
- cp libgcc.a $1/tools/agbcc/lib/
- cp libc.a $1/tools/agbcc/lib/
+ if [ -d "$1" ]; then
+ mkdir -p $1/tools/agbcc
+ mkdir -p $1/tools/agbcc/bin
+ mkdir -p $1/tools/agbcc/include
+ mkdir -p $1/tools/agbcc/lib
+ cp agbcc $1/tools/agbcc/bin/
+ cp old_agbcc $1/tools/agbcc/bin/
+ cp agbcc_arm $1/tools/agbcc/bin/
+ cp -R libc/include $1/tools/agbcc/ #drop include, because we don't want include/include
+ cp ginclude/* $1/tools/agbcc/include/
+ cp libgcc.a $1/tools/agbcc/lib/
+ cp libc.a $1/tools/agbcc/lib/
+ else
+ if [ -d "../$1" ]; then
+ echo "Target directory does not exist. Did you mean to do \"./install.sh ../$1\"?"
+ else
+ if case $1 in ".."*) true;; *) false;; esac; then
+ echo "Target directory does not exist. If you aren't familiar with relative paths, make sure that agbcc and the repository are in the same directory, and run \"./install.sh $1\" again."
+ else
+ if echo "$1" | grep -qE '^[^/]*.$'; then
+ echo "Target directory does not exist. You probably meant to do \"./install.sh ../$1\", but agbcc and $1 do not exist in the same directory. Check your spelling, make sure that the repository has been cloned, ensure that agbcc and the repository are in the same directory, and run \"./install.sh ../$1\" again."
+ else
+ echo "Target directory does not exist. Check your spelling, re-read the instructions, and try again."
+ fi
+ fi
+ fi
+ fi
else
- echo "Usage: install.sh PATH"
+ echo "Usage: install.sh PATH"
fi