Close issue 40 by making directory creation prompts optional

Add config file option MKDIR_PROMPT which, when set to NO, causes sbopkg to
skip prompting the user for directory creations.
This commit is contained in:
slakmagik 2010-02-03 04:47:47 +00:00
parent f38349a7c5
commit 9614f088c4
4 changed files with 29 additions and 5 deletions

View File

@ -10,4 +10,8 @@ enhancements:
some cases; thanks to artourter for the report, thanks to slakmagik for
the hard work in fixing this and thanks to Mauro for the review and
suggestions.
* Add the ability to skip the prompts for sbopkg's directory creations. This
is useful, for example, if you have some SBo/sbopkg directories on a
temporary filesystem and don't want to be bothered with repeated directory
creation prompts. Thanks to agikhan for the report.
+--------------------------+

View File

@ -19,6 +19,7 @@ KEEPLOG=YES
LOGFILE=$LOGDIR/sbopkg-build-log
DEBUG=0
CLEANUP=NO
MKDIR_PROMPT=YES
# Set this to YES to allow multiple instances of sbopkg to run.
# Please read the sbopkg.conf(5) man page before doing so

View File

@ -13,6 +13,8 @@ Slackware packages. A sample file is provided at
/etc/sbopkg/sbopkg.conf.new. Also, please see a note below about
$ARCH.
Boolean options are case-insensitive.
The different configuration options are:
.TP 5
@ -185,6 +187,18 @@ set to 2, all non-updated packages are also listed. Changing DEBUG to 1 or
The default value of DEBUG is: 0.
.TP 5
.B MKDIR_PROMPT
.br
This option may be set to YES or NO. When set to YES, sbopkg will prompt
for confirmation before changing the filesystem by creating its
directories. If you do not wish to be prompted (for instance, if you
have some of the directories on a temporary filesystem and don't wish to
be prompted for confirmation each time the filesystem is reinitialized)
you can set this to NO.
The default value of MKDIR_PROMPT is: YES.
.TP 5
.B RSYNCFLAGS
.br

View File

@ -138,6 +138,7 @@ EOF
yesno_to_setunset KEEPLOG
yesno_to_setunset CLEANUP
yesno_to_setunset ALLOW_MULTI
yesno_to_setunset MKDIR_PROMPT
# If multiple instances of sbopkg are allowed, they need their own
# private $SBOPKGTMP.
@ -283,11 +284,15 @@ ck_dir() {
# Try to create the specified folder
if [[ ! -d $DIR ]]; then
echo
crunch_fmt "$MSG"
echo
read -n1 -sep "Press any key to continue or Ctrl-C to exit."
mkdir -p $DIR 2> /dev/null && echo "Directory created." || ERROR=1
if [[ $MKDIR_PROMPT ]]; then
echo
crunch_fmt "$MSG"
echo
read -n1 -sep "Press any key to continue or Ctrl-C to exit."
mkdir -p $DIR 2> /dev/null && echo "Directory created." || ERROR=1
else
mkdir -p $DIR 2> /dev/null || ERROR=1
fi
fi
# Try to create a file in the specified folder