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" default_path="/var/lib/lxc"
LXC_TEMPLATE_CONFIG="/usr/share/lxc/config" LXC_TEMPLATE_CONFIG="/usr/share/lxc/config"
# Install 'base-voidstrap' by default # Install 'base-voidstrap' and 'openssh-server' by default
base_packages=('base-voidstrap') base_packages=('base-voidstrap' 'openssh-server')
declare -a additional_packages declare -a additional_packages
# split comma-separated string into an array # split comma-separated string into an array
@ -65,6 +65,13 @@ copy_configuration() {
hostname=$3 hostname=$3
arch=$4 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 ## Add all the includes
echo "" >> $path/config echo "" >> $path/config
echo "# Common configuration" >> $path/config echo "# Common configuration" >> $path/config
@ -159,6 +166,13 @@ EOF
grep nameserver /etc/resolv.conf > "${rootfs}/etc/resolv.conf" grep nameserver /etc/resolv.conf > "${rootfs}/etc/resolv.conf"
# Enable agetty on /dev/console # Enable agetty on /dev/console
ln -s /etc/sv/agetty-console $rootfs/etc/runit/runsvdir/default/ 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 "root:root" | chroot ${rootfs} chpasswd -c SHA512
echo echo

View File

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