remaster/src/func/chroot

33 lines
636 B
Bash
Executable File

#!/bin/bash
#remaster lib
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }
## overload chroot with lxc
function chroot() {
lxc-attach -n _remaster_ -- "$2" "$3" "$4" "$5" "$6" "$7"
}
## create lxc config
#chroot_config [chroot_dir]
function chroot_config() {
chroot_dir="$1"
# Container specific configuration
echo "lxc.rootfs = $chroot_dir"
echo "lxc.rootfs.backend = dir"
echo "lxc.utsname = _remaster_"
# Network configuration
echo "lxc.network.type = veth"
echo "lxc.network.link = lxcbr0"
echo "lxc.network.flags = up"
echo "lxc.network.hwaddr = 00:16:3e:5a:ba:1e"
}
[ -n "$1" ] && {
echo param
$1
}