}
lxc_ip() {
- grep lxc.network.ipv4 /var/lib/lxc/$name/config | cut -d= -f2 ||
- grep address $(lxc_rootfs $name)/etc/network/interfaces | sed 's/.*address //'
+ ( grep lxc.network.ipv4 /var/lib/lxc/$name/config | cut -d= -f2 || \
+ grep address $(lxc_rootfs $name)/etc/network/interfaces | sed 's/.*address //' ) | \
+ sed -e 's/ *//g' -e 's/\/.*$//'
}
lxc_status() {
2>/dev/null | xargs -i rm -v {}
echo $1 > $rootfs/etc/hostname
+ grep $1 $rootfs/etc/hosts || echo "$(lxc_ip $1) $1" >> $rootfs/etc/hosts
}