Hello community,

here is the log from the commit of package lxc for openSUSE:Factory checked in 
at 2012-04-17 07:46:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/lxc (Old)
 and      /work/SRC/openSUSE:Factory/.lxc.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "lxc", Maintainer is "jsl...@suse.com"

Changes:
--------
--- /work/SRC/openSUSE:Factory/lxc/lxc.changes  2012-03-07 13:43:21.000000000 
+0100
+++ /work/SRC/openSUSE:Factory/.lxc.new/lxc.changes     2012-04-17 
07:46:30.000000000 +0200
@@ -1,0 +2,6 @@
+Fri Apr 13 11:36:16 UTC 2012 - fcro...@suse.com
+
+- Add lxc-createconfig script to easy LXC configuration
+  (bnc#723950).
+
+-------------------------------------------------------------------

New:
----
  lxc-createconfig.in

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ lxc.spec ++++++
--- /var/tmp/diff_new_pack.Nb6fI4/_old  2012-04-17 07:46:32.000000000 +0200
+++ /var/tmp/diff_new_pack.Nb6fI4/_new  2012-04-17 07:46:32.000000000 +0200
@@ -15,6 +15,7 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
+
 Name:           lxc
 Version:        0.7.5
 Release:        0
@@ -24,6 +25,7 @@
 Group:          System/Management
 Source:         
http://lxc.sourceforge.net/download/lxc/%{name}-%{version}.tar.gz
 Source1:        README.SUSE
+Source2:        lxc-createconfig.in
 # PATCH-FIX-UPSTREAM update openSUSE template to use 12.1
 Patch0:         lxc-opensuse-12.1.patch
 # PATCH-FIX-UPSTREAM lxc-checkconfig-kernel-3.patch bnc#720845 
fcro...@suse.com -- correctly detect kernel 3.x
@@ -56,7 +58,8 @@
 Summary:        Development library for lxc
 License:        LGPL-2.1
 Group:          Development/Libraries/C and C++
-Requires:       %name = %version glibc-devel
+Requires:       %name = %version
+Requires:       glibc-devel
 
 %description devel
 Lxc header files and library needed for development of containers.
@@ -80,6 +83,9 @@
 install -d -m 755 %{buildroot}/var/lib/lxc
 find %buildroot -type f -name '*.la' -delete
 
+./config.status --file=%{buildroot}%{_bindir}/lxc-createconfig:%{S:2}
+chmod a+x %{buildroot}%{_bindir}/lxc-createconfig
+
 %clean
 %__rm -rf %buildroot
 

++++++ lxc-createconfig.in ++++++
#!/bin/bash

#
# lxc: linux Container library

# Authors:
# Mike Friesenegger <mi...@suse.com>
# Daniel Lezcano <daniel.lezc...@free.fr>

# 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


usage() {
    echo "usage: lxc-createconfig -n <name> [-i <ipaddr/cidr>] [-b <bridge>] 
[-t <template]"
}

help() {
    usage
    echo
    echo "creates a lxc container config file which can be in"
    echo "turn used by lxc-create to create the lxc system object."
    echo
    echo "Options:"
    echo "name         : name of the container"
    echo "ipaddr       : ip address/cidr of the container"
    echo "bridge       : bridge device for container (br0 if undefined)"
    echo "template     : template is an accessible template script (sles if 
undefined)"
}

shortoptions='hn:i:b:t:'
longoptions='help,name:,ipaddr:,bridge:,template:'
lxc_confpath=$HOME
templatedir=@LXCTEMPLATEDIR@
lxc_bridge=br0
lxc_template=sles

getopt=$(getopt -o $shortoptions --longoptions  $longoptions -- "$@")
if [ $? != 0 ]; then
    usage
    exit 1;
fi

eval set -- "$getopt"

while true; do
        case "$1" in
            -h|--help)
                help
                exit 1
                ;;
            -n|--name)
                shift
                lxc_name=$1
                lxc_confname=$lxc_name.config
                shift
                ;;
            -i|--ipaddr)
                shift
                lxc_ipaddr=$1
                shift
                ;;
            -b|--bridge)
                shift
                lxc_bridge=$1
                shift
                ;;
            -t|--template)
                shift
                lxc_template=$1
                shift
                ;;
            --)
                shift
                break;;
            *)
                echo $1
                usage
                exit 1
                ;;
        esac
done

if [ -z "$lxc_name" ]; then
    echo "no container name specified"
    usage
    exit 1
fi

if [ -f "$lxc_confpath/$lxc_confname" ]; then
    echo "'$lxc_confname' already exists"
    exit 1
fi

if [ ! -z "$lxc_ipaddr" ]; then
    echo $lxc_ipaddr | grep "/[0-3][0-9]\{0,1\}"
    if [ $? -ne 0 ]; then
        echo "$lxc_ipaddr is missing a cidr"
        usage
        exit 1
    fi
fi

if [ -z "$lxc_ipaddr" ]; then
    lxc_ipaddr=DHCP
fi

if [ ! -z $lxc_bridge ]; then
    brctl show | grep $lxc_bridge >/dev/null
    if [ $? -ne 0 ]; then
        echo "$lxc_bridge not defined"
        exit 1
    fi
fi

if [ ! -z $lxc_template ]; then
    type ${templatedir}/lxc-$lxc_template >/dev/null
    if [ $? -ne 0 ]; then
        echo "unknown template '$lxc_template'"
        exit 1
    fi
fi

echo
echo "Container Name            = " $lxc_name
echo "IP Address                = " $lxc_ipaddr
echo "Bridge                    = " $lxc_bridge
echo
echo -n "Create container config? (n): "
read ANSWER
if [ "$ANSWER" != "y" -a "$ANSWER" != "Y" ]
then
    exit 1
fi
echo
echo "Creating container config $lxc_confpath/$lxc_confname"

# generate a MAC for the IP
lxc_hwaddr="02:00:`(date ; cat /proc/interrupts ) | md5sum | sed -r 
's/^(.{8}).*$/\1/;s/([0-9a-f]{2})/\1:/g;s/:$//;'`"

cat >"$lxc_confpath/$lxc_confname" <<%%
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = $lxc_bridge
lxc.network.hwaddr = $lxc_hwaddr
%%
if [ ! $lxc_ipaddr = "DHCP" ]; then
    cat >>"$lxc_confpath/$lxc_confname" <<%%
lxc.network.ipv4 = $lxc_ipaddr
%%
fi
cat >>"$lxc_confpath/$lxc_confname" <<%%
lxc.network.name = eth0
%%

echo
echo "Run 'lxc-create -n $lxc_name -f $lxc_confpath/$lxc_confname -t 
$lxc_template' to create the lxc system object."
-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to