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