fix minor typos; move check_local_dir function into sanity_checks function (no need for them to be separate)

This commit is contained in:
chess.griffin 2008-03-30 22:09:03 +00:00
parent a7102eeacd
commit 2faa0de4e3

View file

@ -32,12 +32,13 @@ SCRIPT=${0##*/}
DIAG=""
SBOPKG_CONF="${SBOPKG_CONF:-/etc/sbopkg/sbopkg.conf}"
CWD="$(pwd)"
VER=0.0.4
VER=0.0.5
sanity_checks () {
# Check if config file is there and if so check that it has all
# needed variables with any value, and set them; also create
# $SRCDIR if it's not there..
# needed variables with any value, and set them; also check and
# see if local repository directory exists; also create $SRCDIR
# if it's not there.
if [ ! -e $SBOPKG_CONF ]; then
echo "$SCRIPT: No $SBOPKG_CONF file was found."
echo "Please create it and run $SCRIPT again." 1>&2
@ -56,15 +57,6 @@ else
exit 1
fi
fi
if [ ! -d "$SRCDIR" ]; then
echo "Creating local cache directory $SRCDIR to keep \
downloaded sources."
mkdir -p $SRCDIR
fi
}
check_local_dir () {
# Check to see if the main local directory for the mirror exists
if [ ! -d "$LOCALREPO/$SLACKVER" ]; then
echo "$SCRIPT: Directory $LOCALREPO/$SLACKVER does not exist."
echo "Please create it and run $SCRIPT again." 1>&2
@ -72,6 +64,11 @@ if [ ! -d "$LOCALREPO/$SLACKVER" ]; then
else
cd $LOCALREPO/$SLACKVER
fi
if [ ! -d "$SRCDIR" ]; then
echo "Creating local cache directory $SRCDIR to keep \
downloaded sources."
mkdir -p $SRCDIR
fi
}
check_root () {
@ -101,7 +98,7 @@ found. Please make sure your repository directory is set \
correctly and that you have done an rsync first." 10 30
continue
else
dialog --title "SlackBuilds.org ChangeLog" --textbox \
dialog --title "SlackBuilds.org ChangeLog.txt" --textbox \
./ChangeLog.txt 0 0
fi
else
@ -153,7 +150,6 @@ dialog --title "$APP Information" --menu "Choose an item or press \
"Edit" "Create and edit a local SlackBuild" \
"Delete" "Delete the local SlackBuild" \
"Build" "Build a package for $APP" 2>$TMP/sbopkg_info_selection
if [ $? = 1 ]; then
break
fi
@ -526,7 +522,6 @@ cleanup # Do this first just in case there is cruft left over
if [ $# -eq 0 ]; then
DIAG=1
sanity_checks
check_local_dir
main_menu
exit 0
fi
@ -553,13 +548,13 @@ while getopts ":b:d:f:hlrs:" OPT; do
echo "Options are:"
echo " -b package Build a package."
echo " -d localdir Location of local copy of \
SlackBuilds.org repo."
SlackBuilds.org repository"
echo " -f Override default configuration file"
echo " with specified file."
echo " -h Display this help message."
echo " -l Display the SlackBuilds.org \
ChangeLog.txt and then quit."
echo " -r Rsync the SlackBuilds.org respository with"
echo " -r Rsync the SlackBuilds.org repository with"
echo " the local mirror and then quit."
echo " -s package Search for a package and, if found, \
display package information."
@ -575,8 +570,6 @@ shift $(($OPTIND - 1))
sanity_checks
check_local_dir
if [ -n "$BUILD" ]; then
check_root
if [ $ROOT = "false" ]; then