mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-29 15:22:30 +03:00
lvmdump: Allow dir to exist already if it is empty
This commit is contained in:
parent
307ab2c179
commit
55001ae9ec
@ -1,5 +1,6 @@
|
||||
Version 2.02.150 -
|
||||
=================================
|
||||
Allow the lvmdump directory to exist already provided it is empty.
|
||||
|
||||
Version 2.02.149 - 1st April 2016
|
||||
=================================
|
||||
|
@ -99,8 +99,12 @@ else
|
||||
dir="$HOME/$dirbase"
|
||||
fi
|
||||
|
||||
test -e $dir && die 3 "Fatal: $dir already exists"
|
||||
$MKDIR -p $dir || die 4 "Fatal: could not create $dir"
|
||||
if test -d $dir ; then
|
||||
(shopt -s nullglob dotglob; cd $dir && files=(*) && ((${#files[@]}))) && die 5 "Fatal: directory $dir already exists and is not empty"
|
||||
else
|
||||
test -e $dir && die 3 "Fatal: $dir already exists"
|
||||
$MKDIR -p $dir || die 4 "Fatal: could not create $dir"
|
||||
fi
|
||||
|
||||
log="$dir/lvmdump.log"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user