Closed clopez closed 10 years ago
That is the point. It should fail whenever $2 is not set. What problem are you actually trying to fix?
The problem is that current code don't ignores lost+found when $2 is not set.
# Create empty dir with a lost+found dir
mkdir -p /tmp/emptydir/lost+found
# Source the funciton isDirectoryEmpty
. scripts/functions
# Check it
isDirectoryEmpty /tmp/emptydir
echo $?
1
With this patch it returns true
isDirectoryEmpty /tmp/emptydir
echo $?
0
And this function is called without setting $2 at least once.
./scripts/vserver-build.functions:141: test ! -e "$i" || isDirectoryEmpty "$i" || {
Building an vserver with the debootstrap method on a ext2/ext3/ext4 LVM volume recently formatted fails without this patch
This is intentional. It should work exactly as it works right now. What command are you running that doesn't work? Building guests on a new filesystem works fine here.
For example: If the new filesystem has a lost+found directory (ext2/3/4) vserver debootstrap aborts when --force is used.
$ mkdir /var/lib/vservers/testserver
$ lvcreate -L 4G -n vs-testserver vg
$ mkfs.ext4 /dev/vg/vs-testserver
$ mount /dev/vg/vs-testserver /var/lib/vservers/testserver
$ vserver --silent testserver build -m debootstrap --interface eth0:192.168.10.110/24 --hostname testserver --force -- -d testing -m http://ftp.debian.org/debian -- --arch amd64
mv: cannot move `/etc/vservers/.defaults/vdirbase/testserver' to `/etc/vservers/.defaults/vdirbase/testserver.~1395230681~': Device or resource busy
--force does not make sense for a mount point. It will not be able to move it. Simplest solution is to just not use --force, and just use delete first if you're looking to recreate a guest.