Re: [lxc-devel] touch /fastboot to rootfs before start container

2011-08-16 Thread Matteo Bernardini
for what's worth (if useful to know), slackware uses /etc/fastboot for
that purpose: could it be seen as a specific template thingie?
in the template for slackware that I'm preparing, for example, I
cutted out all mount/fsck from the shell init script checking for a
CONTAINER variable...

Matteo

--
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


[lxc-devel] [PATCH] add slackware template

2011-08-16 Thread Matteo Bernardini
Hi to all.

This patch add a template for slackware.

You can pass it, besides the SUITE and MIRROR variables:
- cache: a folder, defaults to /var/cache/lxc/slackware;
- arch: i486 or x86_64, the default is autodetect it from the running
kernel;
- PACKAGES: the list of packages to install, the existing value,a choice
taken from the kind Vincent Batts
http://connie.slackware.com/~vbatts/minimal/, can be taken as an example
for the syntax.

As we don't have debootstrap I had to do some steps more, hope it hasn't
got too big: the patches that introduce a check for a CONTAINER variable
in the rc.* scripts are the biggest part, for the rest I tried to be
synthetic but also to comment what I was doing a little.

Matteo
>From b6fe5ae6d84f606fa184b233b7121be9dc43b799 Mon Sep 17 00:00:00 2001
From: ponce 
Date: Tue, 16 Aug 2011 21:43:49 +0200
Subject: [PATCH] templates: add slackware template.

---
 .gitignore |1 +
 configure.ac   |1 +
 templates/Makefile.am  |1 +
 templates/lxc-slackware.in |  717 
 4 files changed, 720 insertions(+), 0 deletions(-)
 create mode 100644 templates/lxc-slackware.in

diff --git a/.gitignore b/.gitignore
index 962ecea..5bd7a3c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,6 +30,7 @@ templates/lxc-maverick
 templates/lxc-natty
 templates/lxc-oneiric
 templates/lxc-fedora
+templates/lxc-slackware
 templates/lxc-sshd
 templates/lxc-busybox
 
diff --git a/configure.ac b/configure.ac
index 7a96d64..0ab2e5e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -143,6 +143,7 @@ AC_CONFIG_FILES([
templates/lxc-opensuse
templates/lxc-busybox
templates/lxc-fedora
+   templates/lxc-slackware
templates/lxc-sshd
 
src/Makefile
diff --git a/templates/Makefile.am b/templates/Makefile.am
index 658fb2f..498947e 100644
--- a/templates/Makefile.am
+++ b/templates/Makefile.am
@@ -6,5 +6,6 @@ templates_SCRIPTS = \
lxc-ubuntu \
lxc-opensuse \
lxc-fedora \
+   lxc-slackware \
lxc-busybox \
lxc-sshd
diff --git a/templates/lxc-slackware.in b/templates/lxc-slackware.in
new file mode 100644
index 000..8963c10
--- /dev/null
+++ b/templates/lxc-slackware.in
@@ -0,0 +1,717 @@
+#!/bin/bash
+
+#
+# lxc: linux Container library
+
+# Authors:
+# Daniel Lezcano 
+
+# template for slackware by ponce 
+# some parts are taken from the debian one (used as model)
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+SUITE=${SUITE:-13.37}
+cache=${cache:-/var/cache/lxc/slackware}
+# let's use a secondary mirror to avoid loading the primary
+MIRROR=${MIRROR:-http://www.slackware.at/data}
+
+if [ -z "$arch" ]; then
+case "$( uname -m )" in
+i?86) arch=i486 ;;
+arm*) arch=arm ;;
+   *) arch=$( uname -m ) ;;
+esac
+fi
+
+configure_slackware()
+{
+rootfs=$1
+hostname=$2
+
+echo "Configuring..." ; echo
+
+# the next part contains excerpts taken from SeTconfig (written by
+# Patrick Volkerding) from the slackware setup disk.
+# but before pasting them just set a variable to use them as they are 
+T_PX=$rootfs
+
+( cd $T_PX ; chmod 755 ./ )
+( cd $T_PX ; chmod 755 ./var )
+if [ -d $T_PX/usr/src/linux ]; then
+  chmod 755 $T_PX/usr/src/linux
+fi
+if [ ! -d $T_PX/proc ]; then
+  mkdir $T_PX/proc
+  chown root.root $T_PX/proc
+fi
+if [ ! -d $T_PX/sys ]; then
+  mkdir $T_PX/sys
+  chown root.root $T_PX/sys
+fi
+chmod 1777 $T_PX/tmp
+if [ ! -d $T_PX/var/spool/mail ]; then
+  mkdir -p $T_PX/var/spool/mail
+  chmod 755 $T_PX/var/spool
+  chown root.mail $T_PX/var/spool/mail
+  chmod 1777 $T_PX/var/spool/mail
+fi
+
+echo "#!/bin/sh" > $T_PX/etc/rc.d/rc.keymap
+echo "# Load the keyboard map.  More maps are in /usr/share/kbd/keymaps." \
+  >> $T_PX/etc/rc.d/rc.keymap
+echo "if [ -x /usr/bin/loadkeys ]; then" >> $T_PX/etc/rc.d/rc.keymap
+echo " /usr/bin/loadkeys us" >> $T_PX/etc/rc.d/rc.keymap
+echo "fi" >> $T_PX/etc/rc.d/rc.keymap
+chmod 755 $T_PX/etc/rc.d/rc.keymap
+
+# network configuration is left to the user
+# editing /etc/rc.d/rc.inet1.conf and /etc/resolv.conf of the container
+# just set the hostname
+cat < $rootfs/etc/HOSTNAME
+$hostname.example.net
+EOF
+cp $rootfs/etc/HOSTNAME $rootfs/etc/hostname
+
+# make needed devices, from Chris Willing's MAKEDEV.sh
+# http://www.vislab.uq

Re: [lxc-devel] [PATCH] add slackware template

2011-08-19 Thread Matteo Bernardini
Sorry for the noise, I just got illuminated and will substitute the
install part using slackpkg, a slackware specific tool that I think as
the correct choice here (my package install procedure was a little
trivial compared to what this tool does), also because it permits the
use of package templates too (with an easier and more portable syntax).
So, please, ignore the last patch as I will submit a new one in the next
days.

Matteo

--
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel