sed -i '/lxc.rootfs/d' $lxc_path/$lxc_new/config
if [ -b $oldroot ]; then
- which vgscan >/dev/null || { echo "$(basename $0): lvm is not installed" >&2; false; }
+ which vgscan >/dev/null 2>&1 || { echo "$(basename $0): lvm is not installed" >&2; false; }
lvdisplay $oldroot > /dev/null 2>&1 || { echo "$(basename $0): non-lvm blockdev cloning is not supported" >&2; false; }
lvm=TRUE
# ok, create a snapshot of the lvm device
fi
if [ "$backingstore" = "lvm" ]; then
- which vgscan > /dev/null
+ which vgscan > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$(basename $0): vgscan not found (is lvm2 installed?)" >&2
exit 1
exit 1
fi
-which lxc-info > /dev/null || { echo "lxc-info not found."; exit 1; }
-which lxc-wait > /dev/null || { echo "lxc-wait not found."; exit 1; }
+which lxc-info > /dev/null 2>&1 || { echo "lxc-info not found."; exit 1; }
+which lxc-wait > /dev/null 2>&1 || { echo "lxc-wait not found."; exit 1; }
pid=`lxc-info -n $lxc_name -p 2>/dev/null | awk '{ print $2 }'`
if [ "$pid" = "-1" ]; then
{
rootfs=$1
- type busybox >/dev/null
+ which busybox >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "busybox executable is not accessible"
# add ssh functionality if dropbear package available on host
- type dropbear >/dev/null
+ which dropbear >/dev/null 2>&1
if [ $? -eq 0 ]; then
# copy dropbear binary
cp $(which dropbear) $rootfs/usr/sbin
# Code taken from debootstrap
if [ -x /usr/bin/dpkg ] && /usr/bin/dpkg --print-architecture >/dev/null 2>&1; then
arch=`/usr/bin/dpkg --print-architecture`
-elif type udpkg >/dev/null 2>&1 && udpkg --print-architecture >/dev/null 2>&1; then
+elif which udpkg >/dev/null 2>&1 && udpkg --print-architecture >/dev/null 2>&1; then
arch=`/usr/bin/udpkg --print-architecture`
else
arch=$(arch)
exit 1
fi
-type debootstrap
-if [ $? -ne 0 ]; then
- echo "'debootstrap' command is missing"
- exit 1
-fi
+which debootstrap >/dev/null 2>&1 || { echo "'debootstrap' command is missing" >&2; false; }
if [ -z "$path" ]; then
echo "'path' parameter is required"