boxes: Update lxc-template to use a file lock around rootfs extraction
This commit is contained in:
parent
82b49b7242
commit
cfa1d2e02f
1 changed files with 18 additions and 2 deletions
|
@ -106,8 +106,24 @@ fi
|
||||||
# Unpack the rootfs
|
# Unpack the rootfs
|
||||||
echo "Unpacking the rootfs"
|
echo "Unpacking the rootfs"
|
||||||
|
|
||||||
mkdir -p ${LXC_ROOTFS}
|
|
||||||
(cd ${LXC_ROOTFS} && tar xfz ${LXC_TARBALL} --strip-components=2)
|
(
|
||||||
|
flock -x 200
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Cache repository is busy."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p ${LXC_ROOTFS}
|
||||||
|
(cd ${LXC_ROOTFS} && tar xfz ${LXC_TARBALL} --strip-components=2)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Failed to extract rootfs"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
) 200>/var/lock/subsys/lxc
|
||||||
|
|
||||||
mkdir -p ${LXC_ROOTFS}/dev/pts/
|
mkdir -p ${LXC_ROOTFS}/dev/pts/
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue