Allow users to use sbopkg without a global configuration file

This patch allows users to run sbopkg even without the global
configuration file, or when it doesn't contain all the required
variables, as long as the ~/.sbopkg.conf file is available and
complete enough to fill the gaps.

Signed-off-by: Mauro Giachero <mauro.giachero@gmail.com>
This commit is contained in:
mauro.giachero 2009-01-28 12:56:04 +00:00
parent ff2d6ef940
commit 157991f117
2 changed files with 9 additions and 7 deletions

View File

@ -40,6 +40,9 @@ enhancements:
* Commit a patch from slakmagik that adds a new sbopkg.conf variable LOGFILE
where the user can decide the name and location of the permanent build
log, if used; thanks to slakmagik for the patch.
* Improve the configuration file handling so that sbopkg now runs even with
missing or deficient system-wide configuration file, as long as the user's
~/.sbopkg.conf file is present and fills the gaps.
* Fix issue where downloaded sources with spaces in their file names would
cause an MD5SUM failure; thanks to alkos333 for the bug report, and thanks
to Mauro Giachero for improving my initial bug fix implementation.

View File

@ -64,12 +64,14 @@ config_check () {
# needed variables with any value, and set them.
local MISSING VAR
if [ ! -e $SBOPKG_CONF ]; then
echo "$SCRIPT: No $SBOPKG_CONF file was found."
echo "Please create it and run $SCRIPT again." 1>&2
if [[ ! -e $SBOPKG_CONF && ! -e $HOME/.sbopkg.conf ]]; then
echo "$SCRIPT: No $SBOPKG_CONF or ~/.sbopkg.conf file were found."
echo "Please create at least one of them and run $SCRIPT again." 1>&2
exit 1
else
. $SBOPKG_CONF
[[ -e $SBOPKG_CONF ]] && . $SBOPKG_CONF
[[ -e $HOME/.sbopkg.conf ]] && . $HOME/.sbopkg.conf
KEEPLOG=$(echo "$KEEPLOG" | tr [[:lower:]] [[:upper:]])
# Some configuration options are mandatory
for VAR in RSYNCMIRROR SLACKVER LOCALREPO SRCDIR TMP OUTPUT KEEPLOG \
@ -93,9 +95,6 @@ config_check () {
echo "Please correct this error and run $SCRIPT again."
exit 1
fi
if [ -e $HOME/.sbopkg.conf ]; then
. $HOME/.sbopkg.conf
fi
if [[ "$DEBUG" -ne "0" && "$DEBUG" -ne "1" && "$DEBUG" -ne "2" ]]; then
echo "The \$DEBUG variable must be set to 0, 1, or 2."
echo $DEBUG