lxc: lxc-void: add openssh-server; setup timezone, dhcpcd and sshd.

This commit is contained in:
Juan RP 2014-08-07 22:08:59 +02:00
parent 3d08d1347f
commit 213261db33
2 changed files with 17 additions and 3 deletions

View file

@ -42,8 +42,8 @@ arch=$(uname -m)
default_path="/var/lib/lxc"
LXC_TEMPLATE_CONFIG="/usr/share/lxc/config"
# Install 'base-voidstrap' by default
base_packages=('base-voidstrap')
# Install 'base-voidstrap' and 'openssh-server' by default
base_packages=('base-voidstrap' 'openssh-server')
declare -a additional_packages
# split comma-separated string into an array
@ -65,6 +65,13 @@ copy_configuration() {
hostname=$3
arch=$4
# if there is exactly one veth network entry, make sure it has an
# associated hwaddr.
nics=`grep -e '^lxc\.network\.type[ \t]*=[ \t]*veth' $path/config | wc -l`
if [ $nics -eq 1 ]; then
grep -q "^lxc.network.hwaddr" $path/config || sed -i -e "/^lxc\.network\.type[ \t]*=[ \t]*veth/a lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" $path/config
fi
## Add all the includes
echo "" >> $path/config
echo "# Common configuration" >> $path/config
@ -159,6 +166,13 @@ EOF
grep nameserver /etc/resolv.conf > "${rootfs}/etc/resolv.conf"
# Enable agetty on /dev/console
ln -s /etc/sv/agetty-console $rootfs/etc/runit/runsvdir/default/
# Enable dhcpcd and sshd.
ln -s /etc/sv/dhcpcd $rootfs/etc/runit/runsvdir/default/
ln -s /etc/sv/sshd $rootfs/etc/runit/runsvdir/default/
# Copy host /etc/localtime
if [ -f /etc/localtime ]; then
cat /etc/localtime > $rootfs/etc/localtime
fi
echo "root:root" | chroot ${rootfs} chpasswd -c SHA512
echo

View file

@ -3,7 +3,7 @@ _desc="Linux Containers"
pkgname=lxc
version=1.0.5
revision=4
revision=5
build_style=gnu-configure
configure_args="--enable-doc --enable-seccomp --disable-apparmor --with-distro=none
--with-rootfs-path=/var/lxc/containers --with-log-path=/var/lxc/log"