1
0
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:
Alasdair G Kergon 2016-04-06 22:36:42 +01:00
parent 307ab2c179
commit 55001ae9ec
2 changed files with 7 additions and 2 deletions

View File

@ -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
=================================

View File

@ -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"