Skip to content
This repository has been archived by the owner on Oct 29, 2018. It is now read-only.

Commit

Permalink
Nicer error messages (at scripts' starts)
Browse files Browse the repository at this point in the history
  • Loading branch information
greduan committed May 5, 2015
1 parent 6330d61 commit f7e07c3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
9 changes: 6 additions & 3 deletions agno_add
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
#!/bin/sh -e

test -e "$1" || exit 1
if [ ! -e "$1" ]; then
echo "ERROR: Provided package file doesn't exist!"
exit 1
fi

# get our vars
. $HOME/agno/agnorc || exit 1

PKGFILE=$(basename $1)
PKGFILE=$(basename "$1")
PKGNAME=$(echo $PKGFILE | cut -d\# -f1)

# re-define var
AGNO_WORK=$AGNO_WORK/$PKGFILE

# uninstall package if it already exists
if [ -n "$(ls -1 $AGNO_META | grep $PKGNAME)" ]; then
if \ls -1 $AGNO_META | grep -q $PKGNAME; then
echo "Deleting previously installed package of same name."
$AGNO_HOME/agno_rm $PKGNAME
fi
Expand Down
2 changes: 1 addition & 1 deletion agno_ls
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

. $HOME/agno/agnorc

ls -1 $AGNO_META
\ls -1 $AGNO_META
7 changes: 6 additions & 1 deletion agno_mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

# load our vars
. $HOME/agno/agnorc || exit 1
. ./Pkgfile || exit 1
if [ ! -e ./Pkgfile ]; then
echo "ERROR: There's no Pkgfile in the current dir!"
exit 1
else
. ./Pkgfile
fi

PKGFILE_DIR=$PWD

Expand Down
2 changes: 1 addition & 1 deletion agno_rm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
. $HOME/agno/agnorc || exit 1

# find package name in a lot of kinds of strings
PKGNAME=$(basename $1 | cut -d# -f1)
PKGNAME=$(basename "$1" | cut -d\# -f1)

# delete all of the package's files
cd $AGNO_HOME
Expand Down

0 comments on commit f7e07c3

Please sign in to comment.