Re: [lxc-devel] using posix shell instead of bash
On Wed, 14 Nov 2012 08:40:39 +0100 Natanael Copa wrote: > I wonder if it there are any interest to make the scripts posix shell > compliant so they can run with for example busybox ash and dash. I should maybe add that I think the biggest challenge will be the longopts parsing. That said I have managed to make an alternative that should make it possible to be compatible with the current option parsing so we would not need break scripts that uses current lcx-* scripts. I also think it might not be worth convert the template scripts since those probably will depend on bash, perl and other stuff anyways. The scripts I'm interested in make posix compliant are: lxc-checkconfig.in lxc-clone.in lxc-create.in lxc-destroy.in lxc-ls.in lxc-netstat.in lxc-ps.in lxc-setcap.in lxc-setuid.in lxc-shutdown.in lxc-version.in I have made a few of them already as shown below (mostly untested). I have a solution for: 'prog arg1 --opt1 -- arg2' in case that would ever be needed. I think it would be nice with some kind of feedback before I continue. commit 6b65cb9e5a33ce3cc1156329b8e775c0b6aa36ee Author: Natanael Copa Date: Wed Nov 14 13:55:21 2012 +0100 lxc-ls: use posix shell instead of bash Signed-off-by: Natanael Copa diff --git a/src/lxc/lxc-ls.in b/src/lxc/lxc-ls.in index 9293323..948eef9 100644 --- a/src/lxc/lxc-ls.in +++ b/src/lxc/lxc-ls.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # lxc: linux Container library @@ -18,10 +18,11 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA lxc_path=@LXCPATH@ +program=${0##*/} usage() { - echo "usage: $(basename $0) [--active] [--] [LS_OPTIONS...]" >&2 + echo "usage: $program [--active] [--] [LS_OPTIONS...]" >&2 } help() { @@ -61,11 +62,10 @@ get_parent_cgroup() # Return the absolute path to the containers' parent cgroup # (do not append '/lxc' if the hierarchy contains the 'ns' subsystem) - if [[ ",$subsystems," == *,ns,* ]]; then - parent_cgroup="${mountpoint}${init_cgroup%/}" - else - parent_cgroup="${mountpoint}${init_cgroup%/}/lxc" - fi + case ",$subsystems," in + *,ns,*) parent_cgroup="${mountpoint}${init_cgroup%/}";; + *) parent_cgroup="${mountpoint}${init_cgroup%/}/lxc";; + esac break done } @@ -91,7 +91,7 @@ if [ ! -z "$directory" ]; then fi if [ -z "$containers" ]; then - echo "$(basename $0): no containers found" >&2 + echo "$program: no containers found" >&2 exit 1 fi commit bc4c995b12bc6d0df563296d929ccf5266f657d8 Author: Natanael Copa Date: Wed Nov 14 13:54:04 2012 +0100 lxc-create: use posix shell instead of bash Signed-off-by: Natanael Copa diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in index b21cdc3..98bf380 100644 --- a/src/lxc/lxc-create.in +++ b/src/lxc/lxc-create.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # lxc: linux Container library @@ -20,8 +20,9 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +program=${0##*/} usage() { -echo "usage: $(basename $0) -n NAME [-f CONFIG_FILE] [-t TEMPLATE] [FS_OPTIONS] --" >&2 +echo "usage: $program -n NAME [-f CONFIG_FILE] [-t TEMPLATE] [FS_OPTIONS] --" >&2 echo " [TEMPLATE_OPTIONS]" >&2 echo >&2 echo "where FS_OPTIONS is one of:" >&2 @@ -49,7 +50,7 @@ help() { echo >&2 if [ -z $lxc_template ]; then echo "To see template-specific options, specify a template. For example:" >&2 -echo " $(basename $0) -t ubuntu -h" >&2 +echo " $program -t ubuntu -h" >&2 exit 0 fi type ${templatedir}/lxc-$lxc_template 2>/dev/null @@ -60,8 +61,19 @@ help() { fi } -shortoptions='hn:f:t:B:' -longoptions='help,name:,config:,template:,backingstore:,fstype:,lvname:,vgname:,fssize:' +usage_err() { +[ -n "$1" ] && echo "$1" >&2 +usage +exit 1 +} + +optarg_check() { +local opt="$1" optarg="$2" +if [ -z "$optarg" ]; then +usage_err "option '$opt' requires an argument" +fi +} + lxc_path=@LXCPATH@ bindir=@BINDIR@ templatedir=@LXCTEMPLATEDIR@ @@ -70,66 +82,65 @@ fstype=ext4 fssize=500M vgname=lxc -getopt=$(getopt -o $shortoptions --longoptions $longoptions -- "$@") -if [ $? != 0 ]; then -usage -exit 1; -fi - -eval set -- "$getopt" - -while true; do -case "$1" in +while [ $# -gt 0 ]; do +local opt="$1" +shift +case "$opt" in -h|--help) help exit 1 ;; -n|--name) - shift + optarg_check $opt "$1" lxc_name=$1 shift ;; -f|--config) - shift + opt
Re: [lxc-devel] using posix shell instead of bash
On Wed, 14 Nov 2012 14:04:43 +0100 Natanael Copa wrote: > @@ -18,10 +18,11 @@ > # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA > 02111-1307 USA > lxc_path=@LXCPATH@ > +program=${0##*/} > > usage() > { > - echo "usage: $(basename $0) [--active] [--] [LS_OPTIONS...]" > >&2 > + echo "usage: $program [--active] [--] [LS_OPTIONS...]" >&2 > } Those hunks are not needed. I'll revert them in final patch. -nc -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] [PATCH] lxc-destroy: make it work with busybox
Quoting Natanael Copa (nc...@alpinelinux.org): > Busybox 'rm' has no support for --one-file-system. We can make it work > on busybox with find ... -xdev. Hm, well it does slow it down a smidgeon, but no real objection from me. Still let's if anyone else has a comment. > Signed-off-by: Natanael Copa > --- > src/lxc/lxc-destroy.in | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/lxc/lxc-destroy.in b/src/lxc/lxc-destroy.in > index 846266c..f8f4b48 100644 > --- a/src/lxc/lxc-destroy.in > +++ b/src/lxc/lxc-destroy.in > @@ -122,9 +122,9 @@ if [ -n "$rootdev" ]; then > btrfs subvolume delete "$rootdev" > else > # In case rootfs is not under $lxc_path/$lxc_name, > remove it > - rm -rf --one-file-system --preserve-root $rootdev > + find $rootdev -xdev -delete > fi > fi > fi > # recursively remove the container to remove old container configuration > -rm -rf --one-file-system --preserve-root $lxc_path/$lxc_name > +find $lxc_path/$lxc_name -xdev -delete > -- > 1.8.0 > > > -- > Monitor your physical, virtual and cloud infrastructure from a single > web console. Get in-depth insight into apps, servers, databases, vmware, > SAP, cloud infrastructure, etc. Download 30-day Free Trial. > Pricing starts from $795 for 25 servers or applications! > http://p.sf.net/sfu/zoho_dev2dev_nov > ___ > Lxc-devel mailing list > Lxc-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/lxc-devel -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] [PATCH] lxc-start: add option -p, --pidfile=FILE for use with --daemon
Quoting Natanael Copa (nc...@alpinelinux.org): > Add option to create a pidfile for lxc-start daemon. This is helpful > for init scripts and process monitors. Why only when daemonizing? Someone could presumably first lxc-start by hand in the foreground, then another admin walks in and restarts the sysvinit lxc job? > Signed-off-by: Natanael Copa > --- > doc/lxc-start.sgml.in | 12 > src/lxc/arguments.h | 1 + > src/lxc/lxc_start.c | 24 > 3 files changed, 37 insertions(+) > > diff --git a/doc/lxc-start.sgml.in b/doc/lxc-start.sgml.in > index 2b6778f..bd875d6 100644 > --- a/doc/lxc-start.sgml.in > +++ b/doc/lxc-start.sgml.in > @@ -53,6 +53,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA > 02111-1307 USA >-f config_file >-c console_file >-d > + -p pid_file >-s KEY=VAL >-C >command > @@ -109,6 +110,17 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA > 02111-1307 USA > > > > + -p, --pidfile pid_file > + > + > + > + Create a pidfile when running as daemon. > + > + > + > + > + > + > -f, --rcfile config_file > > > diff --git a/src/lxc/arguments.h b/src/lxc/arguments.h > index 40f0d6c..789ccd9 100644 > --- a/src/lxc/arguments.h > +++ b/src/lxc/arguments.h > @@ -45,6 +45,7 @@ struct lxc_arguments { > int daemonize; > const char *rcfile; > const char *console; > + const char *pidfile; > > /* for lxc-checkpoint/restart */ > const char *statefile; > diff --git a/src/lxc/lxc_start.c b/src/lxc/lxc_start.c > index 81a5774..a031ee1 100644 > --- a/src/lxc/lxc_start.c > +++ b/src/lxc/lxc_start.c > @@ -62,6 +62,7 @@ static int my_parser(struct lxc_arguments* args, int c, > char* arg) > case 'f': args->rcfile = arg; break; > case 'C': args->close_all_fds = 1; break; > case 's': return lxc_config_define_add(&defines, arg); > + case 'p': args->pidfile = arg; break; > } > return 0; > } > @@ -72,6 +73,7 @@ static const struct option my_longopts[] = { > {"define", required_argument, 0, 's'}, > {"console", required_argument, 0, 'c'}, > {"close-all-fds", no_argument, 0, 'C'}, > + {"pidfile", required_argument, 0, 'p'}, > LXC_COMMON_OPTIONS > }; > > @@ -85,6 +87,7 @@ lxc-start start COMMAND in specified container NAME\n\ > Options :\n\ >-n, --name=NAME NAME for name of the container\n\ >-d, --daemon daemonize the container\n\ > + -p, --pidfile=FILE Create pidfile when daemonized\n\ >-f, --rcfile=FILELoad configuration file FILE\n\ >-c, --console=FILE Set the file output for the container console\n\ >-C, --close-all-fds If any fds are inherited, close them\n\ > @@ -95,6 +98,7 @@ Options :\n\ > .parser= my_parser, > .checker = NULL, > .daemonize = 0, > + .pidfile = NULL, > }; > > int main(int argc, char *argv[]) > @@ -200,6 +204,7 @@ int main(int argc, char *argv[]) > } > > if (my_args.daemonize) { > + FILE *pid_fp; > /* do an early check for needed privs, since otherwise the >* user won't see the error */ > > @@ -208,10 +213,26 @@ int main(int argc, char *argv[]) > return err; > } > > + if (my_args.pidfile != NULL) { > + pid_fp = fopen(my_args.pidfile, "w"); > + if (pid_fp == NULL) { > + SYSERROR("failed to create '%s'", my_args.name); > + return err; > + } > + } > + > if (daemon(0, 0)) { > SYSERROR("failed to daemonize '%s'", my_args.name); > return err; > } > + > + if (my_args.pidfile != NULL) { > + if (fprintf(pid_fp, "%d\n", getpid()) < 0) { > + SYSERROR("failed to write '%s'", > my_args.pidfile); > + return err; > + } > + fclose(pid_fp); > + } > } > > if (my_args.close_all_fds) > @@ -230,6 +251,9 @@ int main(int argc, char *argv[]) > err = -1; > } > > + if (my_args.daemonize && my_args.pidfile) > + unlink(my_args.pidfile); > + > return err; > } > > -- > 1.8.0 > > > -- > Monitor your physical, virtual and cloud infrastructure from a single > web console. Get in-depth insight into apps, servers, databases, vmware, > SAP, cloud infrastructure, etc. Download 30-day Free Trial. > Pricing starts from $795 for 25 servers or applications! > http://p.sf.net/sfu/zoho_dev2dev_nov > ___ > Lxc-devel mailing list > Lxc-deve
[lxc-devel] [PATCH] ensure btrfs subvolume is removed when container creating fails
Hi, while updating our package for LXC 0.8.0, I discovered that lxc-create didn't properly delete btrfs subvolume if container creation failed for any reason. Attached patch fixes this issue. -- Frederic Crozat SUSE >From 028d1b3eb110229113dc99f3587fac1f9fca9b0e Mon Sep 17 00:00:00 2001 From: Frederic Crozat Date: Wed, 14 Nov 2012 16:02:37 +0100 Subject: [PATCH] Ensure btrfs subvolume is destroyed on error --- src/lxc/lxc-create.in |2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in index b21cdc3..124ffd5 100644 --- a/src/lxc/lxc-create.in +++ b/src/lxc/lxc-create.in @@ -237,6 +237,8 @@ cleanup() { if [ $backingstore = "lvm" ]; then umount $rootfs lvremove -f $rootdev +elif [ $backingstore = "btrfs" ]; then +btrfs subvolume delete "$rootfs" fi ${bindir}/lxc-destroy -n $lxc_name echo "$(basename $0): aborted" >&2 -- 1.7.10.4 -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
[lxc-devel] [PATCH] Fix package name needed for building docs with RPM
Tested on Oracle Linux 6 and Fedora 17 Signed-off-by: Dwight Engen --- lxc.spec.in |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lxc.spec.in b/lxc.spec.in index 10b7254..7998cfd 100644 --- a/lxc.spec.in +++ b/lxc.spec.in @@ -30,7 +30,7 @@ Group: Applications/System License: LGPL BuildRoot: %{_tmppath}/%{name}-%{version}-build Requires: libcap -BuildRequires: libcap libcap-devel docbook2x +BuildRequires: libcap libcap-devel docbook2X %description -- 1.7.1 -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] [PATCH] ensure btrfs subvolume is removed when container creating fails
Quoting Frederic Crozat (fcro...@suse.com): > Hi, > > while updating our package for LXC 0.8.0, I discovered that lxc-create > didn't properly delete btrfs subvolume if container creation failed for > any reason. > > Attached patch fixes this issue. Acked-by: Serge E. Hallyn > -- > Frederic Crozat > SUSE > >From 028d1b3eb110229113dc99f3587fac1f9fca9b0e Mon Sep 17 00:00:00 2001 > From: Frederic Crozat > Date: Wed, 14 Nov 2012 16:02:37 +0100 > Subject: [PATCH] Ensure btrfs subvolume is destroyed on error > > --- > src/lxc/lxc-create.in |2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in > index b21cdc3..124ffd5 100644 > --- a/src/lxc/lxc-create.in > +++ b/src/lxc/lxc-create.in > @@ -237,6 +237,8 @@ cleanup() { > if [ $backingstore = "lvm" ]; then > umount $rootfs > lvremove -f $rootdev > +elif [ $backingstore = "btrfs" ]; then > +btrfs subvolume delete "$rootfs" > fi > ${bindir}/lxc-destroy -n $lxc_name > echo "$(basename $0): aborted" >&2 > -- > 1.7.10.4 > > -- > Monitor your physical, virtual and cloud infrastructure from a single > web console. Get in-depth insight into apps, servers, databases, vmware, > SAP, cloud infrastructure, etc. Download 30-day Free Trial. > Pricing starts from $795 for 25 servers or applications! > http://p.sf.net/sfu/zoho_dev2dev_nov > ___ > Lxc-devel mailing list > Lxc-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/lxc-devel -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] using posix shell instead of bash
Quoting Natanael Copa (nc...@alpinelinux.org): > Hi, > > I wonder if it there are any interest to make the scripts posix shell > compliant so they can run with for example busybox ash and dash. > > I would like to provide proper LCX support for Alpine Linux, which by > default runs from tmpfs. It uses uclibc and busybox as the base system, > which makes it very lightweight. Looking at the scripts, it seems like > it would be fairly easy to adjust the script to not depend on bash at > all, making it possible to make the LCX host even lighter. > > Before I start with sending patches, is this something that you would > be interested in, or are you married with bash (like the vserver ppl)? I don't think anyone is married to bash here. The debian package has changed some scripts from bash to sh. I'm only leery of resulting breakages and reports of subtle time-consuming bugs, and potentially less-maintainable code. (Note also that lxc-ls may be rewritten in python. Is that a problem for your use case?) > Would you be prepared for minor sacrifices to use posix compliant shell > scripts? Someone else can jump in if they object, but I personally don't. Are you willing to subscribe to github.com/lxc/lxc#staging commits and watch for new commits re-breaking posix compliance? Successful runs of https://code.launchpad.net/~serge-hallyn/+junk/lxc-test with your patches will also be reassuring. -serge -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] [PATCH] Fix package name needed for building docs with RPM
On 11/14/2012 10:44 AM, Dwight Engen wrote: > Tested on Oracle Linux 6 and Fedora 17 > > Signed-off-by: Dwight Engen Acked-by: Stéphane Graber And applied to staging branch. > --- > lxc.spec.in |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/lxc.spec.in b/lxc.spec.in > index 10b7254..7998cfd 100644 > --- a/lxc.spec.in > +++ b/lxc.spec.in > @@ -30,7 +30,7 @@ Group: Applications/System > License: LGPL > BuildRoot: %{_tmppath}/%{name}-%{version}-build > Requires: libcap > -BuildRequires: libcap libcap-devel docbook2x > +BuildRequires: libcap libcap-devel docbook2X > > %description > > -- Stéphane Graber Ubuntu developer http://www.ubuntu.com signature.asc Description: OpenPGP digital signature -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] [PATCH] ensure btrfs subvolume is removed when container creating fails
On 11/14/2012 10:47 AM, Serge Hallyn wrote: > Quoting Frederic Crozat (fcro...@suse.com): >> Hi, >> >> while updating our package for LXC 0.8.0, I discovered that lxc-create >> didn't properly delete btrfs subvolume if container creation failed for >> any reason. >> >> Attached patch fixes this issue. > > Acked-by: Serge E. Hallyn Acked-by: Stéphane Graber And applied to staging branch. >> -- >> Frederic Crozat >> SUSE > >> >From 028d1b3eb110229113dc99f3587fac1f9fca9b0e Mon Sep 17 00:00:00 2001 >> From: Frederic Crozat >> Date: Wed, 14 Nov 2012 16:02:37 +0100 >> Subject: [PATCH] Ensure btrfs subvolume is destroyed on error >> >> --- >> src/lxc/lxc-create.in |2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in >> index b21cdc3..124ffd5 100644 >> --- a/src/lxc/lxc-create.in >> +++ b/src/lxc/lxc-create.in >> @@ -237,6 +237,8 @@ cleanup() { >> if [ $backingstore = "lvm" ]; then >> umount $rootfs >> lvremove -f $rootdev >> +elif [ $backingstore = "btrfs" ]; then >> +btrfs subvolume delete "$rootfs" >> fi >> ${bindir}/lxc-destroy -n $lxc_name >> echo "$(basename $0): aborted" >&2 >> -- >> 1.7.10.4 >> > >> -- >> Monitor your physical, virtual and cloud infrastructure from a single >> web console. Get in-depth insight into apps, servers, databases, vmware, >> SAP, cloud infrastructure, etc. Download 30-day Free Trial. >> Pricing starts from $795 for 25 servers or applications! >> http://p.sf.net/sfu/zoho_dev2dev_nov > >> ___ >> Lxc-devel mailing list >> Lxc-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/lxc-devel > > > -- > Monitor your physical, virtual and cloud infrastructure from a single > web console. Get in-depth insight into apps, servers, databases, vmware, > SAP, cloud infrastructure, etc. Download 30-day Free Trial. > Pricing starts from $795 for 25 servers or applications! > http://p.sf.net/sfu/zoho_dev2dev_nov > ___ > Lxc-devel mailing list > Lxc-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/lxc-devel > -- Stéphane Graber Ubuntu developer http://www.ubuntu.com signature.asc Description: OpenPGP digital signature -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
[lxc-devel] [PATCH] Fix checkconfig to handle kernel memory cgroup name change
The kernel config option for the memory cgroup was changed in 3.6 from CONFIG_CGROUP_MEM_RES_CTLR to CONFIG_MEMCG with commit c255a458. Signed-off-by: Dwight Engen --- src/lxc/lxc-checkconfig.in | 25 +++-- 1 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/lxc/lxc-checkconfig.in b/src/lxc/lxc-checkconfig.in index 8c2b5e5..8263c17 100644 --- a/src/lxc/lxc-checkconfig.in +++ b/src/lxc/lxc-checkconfig.in @@ -68,6 +68,15 @@ print_cgroups() { } CGROUP_MNT_PATH=`print_cgroups cgroup /proc/self/mounts | head -1` +KVER_MAJOR=$($GREP '^# Linux' $CONFIG | \ +sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/') +if [[ $KVER_MAJOR == 2 ]]; then +KVER_MINOR=$($GREP '^# Linux' $CONFIG | \ +sed -r 's/.* 2.6.([0-9]{2}).*/\1/') +else +KVER_MINOR=$($GREP '^# Linux' $CONFIG | \ +sed -r 's/.* [0-9]\.([0-9]{1,3})\.[0-9]{1,3}.*/\1/') +fi echo -n "Cgroup: " && is_enabled CONFIG_CGROUPS yes @@ -80,22 +89,18 @@ fi echo -n "Cgroup device: " && is_enabled CONFIG_CGROUP_DEVICE echo -n "Cgroup sched: " && is_enabled CONFIG_CGROUP_SCHED echo -n "Cgroup cpu account: " && is_enabled CONFIG_CGROUP_CPUACCT -echo -n "Cgroup memory controller: " && is_enabled CONFIG_CGROUP_MEM_RES_CTLR +echo -n "Cgroup memory controller: " +if [ $KVER_MAJOR -ge 3 -a $KVER_MINOR -ge 6 ]; then +is_enabled CONFIG_MEMCG +else +is_enabled CONFIG_CGROUP_MEM_RES_CTLR +fi is_set CONFIG_SMP && echo -n "Cgroup cpuset: " && is_enabled CONFIG_CPUSETS echo echo "--- Misc ---" echo -n "Veth pair device: " && is_enabled CONFIG_VETH echo -n "Macvlan: " && is_enabled CONFIG_MACVLAN echo -n "Vlan: " && is_enabled CONFIG_VLAN_8021Q -KVER_MAJOR=$($GREP '^# Linux' $CONFIG | \ -sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/') -if [[ $KVER_MAJOR == 2 ]]; then -KVER_MINOR=$($GREP '^# Linux' $CONFIG | \ -sed -r 's/.* 2.6.([0-9]{2}).*/\1/') -else -KVER_MINOR=$($GREP '^# Linux' $CONFIG | \ -sed -r 's/.* [0-9]\.([0-9]{1,3})\.[0-9]{1,3}.*/\1/') -fi echo -n "File capabilities: " && ( [[ ${KVER_MAJOR} == 2 && ${KVER_MINOR} < 33 ]] && is_enabled CONFIG_SECURITY_FILE_CAPABILITIES ) || -- 1.7.1 -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] using posix shell instead of bash
On Wed, 2012-11-14 at 09:54 -0600, Serge Hallyn wrote: > Quoting Natanael Copa (nc...@alpinelinux.org): > > Hi, > > > > I wonder if it there are any interest to make the scripts posix shell > > compliant so they can run with for example busybox ash and dash. > > > > I would like to provide proper LCX support for Alpine Linux, which by > > default runs from tmpfs. It uses uclibc and busybox as the base system, > > which makes it very lightweight. Looking at the scripts, it seems like > > it would be fairly easy to adjust the script to not depend on bash at > > all, making it possible to make the LCX host even lighter. > > > > Before I start with sending patches, is this something that you would > > be interested in, or are you married with bash (like the vserver ppl)? > I don't think anyone is married to bash here. The debian package has > changed some scripts from bash to sh. I'm only leery of resulting > breakages and reports of subtle time-consuming bugs, and potentially > less-maintainable code. > (Note also that lxc-ls may be rewritten in python. Is that a problem > for your use case?) Some reason? Sorry. In my "day job" I have to maintain code written in C, bash, sh, ash (I wrote and array function library for ash and busybox), perl and python, including a raft of stuff that interfaces to web scrappers and SQL databases. My team and I find python to be the least maintainable and all the cruft that our predecessors wrote in python is getting rewritten in perl so it can be maintained as soon as we figure out what the hell they did in there... We had one guy who was absolutely in love with python and django and left us with a mess. Now, that may well be his fault to begin with being that it is uncommented highly recursive web processing code (yes it uses "beautiful soup") that drives us all nuts and breaks with nothing more that the classical python backtrace. I know a lot of people are just in love with python but I wouldn't just rewrite it unless there was a really good reason to. > > Would you be prepared for minor sacrifices to use posix compliant shell > > scripts? > Someone else can jump in if they object, but I personally don't. Are > you willing to subscribe to github.com/lxc/lxc#staging commits and > watch for new commits re-breaking posix compliance? Converting from bash to ash (which is very sh like) isn't too bad if you are not making extensive use of arrays and string functions. It's probably doable (having done it myself with some fairly sophisticated bash scripts dealing with LUKS encryption and file systems). I would start by trying to run it under busybox ash and see what breaks. > Successful runs of https://code.launchpad.net/~serge-hallyn/+junk/lxc-test > with your patches will also be reassuring. > -serge Regards, Mike -- Michael H. Warfield (AI4NB) | (770) 985-6132 | m...@wittsend.com /\/\|=mhw=|\/\/ | (678) 463-0932 | http://www.wittsend.com/mhw/ NIC whois: MHW9 | An optimist believes we live in the best of all PGP Key: 0x674627FF| possible worlds. A pessimist is sure of it! signature.asc Description: This is a digitally signed message part -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] using posix shell instead of bash
On 11/14/2012 01:50 PM, Michael H. Warfield wrote: > On Wed, 2012-11-14 at 09:54 -0600, Serge Hallyn wrote: >> Quoting Natanael Copa (nc...@alpinelinux.org): >>> Hi, >>> >>> I wonder if it there are any interest to make the scripts posix shell >>> compliant so they can run with for example busybox ash and dash. >>> >>> I would like to provide proper LCX support for Alpine Linux, which by >>> default runs from tmpfs. It uses uclibc and busybox as the base system, >>> which makes it very lightweight. Looking at the scripts, it seems like >>> it would be fairly easy to adjust the script to not depend on bash at >>> all, making it possible to make the LCX host even lighter. >>> >>> Before I start with sending patches, is this something that you would >>> be interested in, or are you married with bash (like the vserver ppl)? > >> I don't think anyone is married to bash here. The debian package has >> changed some scripts from bash to sh. I'm only leery of resulting >> breakages and reports of subtle time-consuming bugs, and potentially >> less-maintainable code. > >> (Note also that lxc-ls may be rewritten in python. Is that a problem >> for your use case?) > > Some reason? Sorry. In my "day job" I have to maintain code written in > C, bash, sh, ash (I wrote and array function library for ash and > busybox), perl and python, including a raft of stuff that interfaces to > web scrappers and SQL databases. My team and I find python to be the > least maintainable and all the cruft that our predecessors wrote in > python is getting rewritten in perl so it can be maintained as soon as > we figure out what the hell they did in there... We had one guy who was > absolutely in love with python and django and left us with a mess. Now, > that may well be his fault to begin with being that it is uncommented > highly recursive web processing code (yes it uses "beautiful soup") that > drives us all nuts and breaks with nothing more that the classical > python backtrace. I know a lot of people are just in love with python > but I wouldn't just rewrite it unless there was a really good reason to. The reason is that we have API bindings in python which let us directly access any function from the C API instead of having to do wild guess from the shell scripts or limit the possible features as is done currently. In my experience, the readability of the code has little to do with the language, it tends to have a lot more to do with who wrote the code to being with ;) >>> Would you be prepared for minor sacrifices to use posix compliant shell >>> scripts? > >> Someone else can jump in if they object, but I personally don't. Are >> you willing to subscribe to github.com/lxc/lxc#staging commits and >> watch for new commits re-breaking posix compliance? > > Converting from bash to ash (which is very sh like) isn't too bad if you > are not making extensive use of arrays and string functions. It's > probably doable (having done it myself with some fairly sophisticated > bash scripts dealing with LUKS encryption and file systems). I would > start by trying to run it under busybox ash and see what breaks. The target really should be pure POSIX shell and nothing else, this will guarantee that the code will work on the standard shells like busybox's sh, Debian's dash and the good old bash. The checkbashisms command can be used to spot any of the usual bashims (once the script has been changed to use #!/bin/sh). >> Successful runs of https://code.launchpad.net/~serge-hallyn/+junk/lxc-test >> with your patches will also be reassuring. > >> -serge > > Regards, > Mike > > > > -- > Monitor your physical, virtual and cloud infrastructure from a single > web console. Get in-depth insight into apps, servers, databases, vmware, > SAP, cloud infrastructure, etc. Download 30-day Free Trial. > Pricing starts from $795 for 25 servers or applications! > http://p.sf.net/sfu/zoho_dev2dev_nov > > > > ___ > Lxc-devel mailing list > Lxc-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/lxc-devel > -- Stéphane Graber Ubuntu developer http://www.ubuntu.com signature.asc Description: OpenPGP digital signature -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] [PATCH] lxc-destroy: make it work with busybox
On Wed, 14 Nov 2012 08:51:07 -0600 Serge Hallyn wrote: > Quoting Natanael Copa (nc...@alpinelinux.org): > > Busybox 'rm' has no support for --one-file-system. We can make it > > work on busybox with find ... -xdev. > > Hm, well it does slow it down a smidgeon, but no real objection > from me. Still let's if anyone else has a comment. Why does it slow down? Did you test it? -nc -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] [PATCH] lxc-start: add option -p, --pidfile=FILE for use with --daemon
On Wed, 14 Nov 2012 08:44:41 -0600 Serge Hallyn wrote: > Quoting Natanael Copa (nc...@alpinelinux.org): > > Add option to create a pidfile for lxc-start daemon. This is helpful > > for init scripts and process monitors. > > Why only when daemonizing? Someone could presumably first lxc-start > by hand in the foreground, then another admin walks in and restarts > the sysvinit lxc job? I assume 'someone' starting with lxc-start instead of via sysvinit (or any other init) would not think of appening --pidfile option, but sure, I think you have a valid point. I'll prepare a new patch. -nc -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] [PATCH] lxc-destroy: make it work with busybox
Quoting Natanael Copa (nc...@alpinelinux.org): > On Wed, 14 Nov 2012 08:51:07 -0600 > Serge Hallyn wrote: > > > Quoting Natanael Copa (nc...@alpinelinux.org): > > > Busybox 'rm' has no support for --one-file-system. We can make it > > > work on busybox with find ... -xdev. > > > > Hm, well it does slow it down a smidgeon, but no real objection > > from me. Still let's if anyone else has a comment. s/ if/ see if/ > Why does it slow down? Did you test it? I only tested it with the time built-in. I don't know what sorts of optimizations rm has built-in, don't care to look into it. -serge -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] using posix shell instead of bash
On Wed, 14 Nov 2012 09:54:58 -0600 Serge Hallyn wrote: > (Note also that lxc-ls may be rewritten in python. Is that a problem > for your use case?) well... The Alpine Linux base system is 6MB excluding kernel. I offer to spend a day or so to save 700kb by getting rid of bash. and now you want pull in python that is at least 36MB + its dependencies... :) I'd rather see Lua, which is even smaller than bash. It's not python but you get pretty much bang for the bucks. -nc -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] using posix shell instead of bash
On Wed, 14 Nov 2012 09:54:58 -0600 Serge Hallyn wrote: > Quoting Natanael Copa (nc...@alpinelinux.org): forgot this... > > Would you be prepared for minor sacrifices to use posix compliant > > shell scripts? > > Someone else can jump in if they object, but I personally don't. Are > you willing to subscribe to github.com/lxc/lxc#staging commits and > watch for new commits re-breaking posix compliance? yes. -nc -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] using posix shell instead of bash
On Wed, 14 Nov 2012 13:50:54 -0500 "Michael H. Warfield" wrote: > Converting from bash to ash (which is very sh like) isn't too bad if > you are not making extensive use of arrays and string functions. It's > probably doable (having done it myself with some fairly sophisticated > bash scripts dealing with LUKS encryption and file systems). I would > start by trying to run it under busybox ash and see what breaks. I looked over the scripts this morning. I could not find any arrays, one or 2 bash specific variable expansion, and one pipe redirect iirc. The biggest thing was getopt longopts but I have a plan for that (as i posted in the diff). The code is also clean and nice. I would not suggested this if the changes would been intrusive or if the code was messy. -nc -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] using posix shell instead of bash
Quoting Natanael Copa (nc...@alpinelinux.org): > On Wed, 14 Nov 2012 09:54:58 -0600 > Serge Hallyn wrote: > > > (Note also that lxc-ls may be rewritten in python. Is that a problem > > for your use case?) > > well... The Alpine Linux base system is 6MB excluding kernel. I offer > to spend a day or so to save 700kb by getting rid of bash. > > and now you want pull in python that is at least 36MB + its > dependencies... :) That's what I figured :) I just wasn't sure if you already ahd python or not. This means we'll want to keep a (simple) sh-based lxc-ls, at least available. > I'd rather see Lua, which is even smaller than bash. It's not python > but you get pretty much bang for the bucks. If you write the lua api bindings, that'd be great :) thanks, -serge -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] using posix shell instead of bash
Quoting Natanael Copa (nc...@alpinelinux.org): > On Wed, 14 Nov 2012 09:54:58 -0600 > Serge Hallyn wrote: > > > Quoting Natanael Copa (nc...@alpinelinux.org): > > forgot this... > > > > Would you be prepared for minor sacrifices to use posix compliant > > > shell scripts? > > > > Someone else can jump in if they object, but I personally don't. Are > > you willing to subscribe to github.com/lxc/lxc#staging commits and > > watch for new commits re-breaking posix compliance? > > yes. Cool, thanks - though I didn't know about checkbashisms (which Stephane pointed out). With that, we can automate that checking at build time (heck at check-in time), which makes me happy :) -serge -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel
Re: [lxc-devel] Lxc-devel Digest, Vol 51, Issue 10
Hello all, I use following way to start a container as a daemon: lxc-start –n -d and then connect to it using lxc-console: lxc-console -n But there is a problem: When execute " lxc-console -n ", then it will come with "lxc-console: 'ctx1' is stopped" Anyone has ideas about this? From: lxc-devel-requ...@lists.sourceforge.net [lxc-devel-requ...@lists.sourceforge.net] Sent: Wednesday, November 14, 2012 2:19 PM To: lxc-devel@lists.sourceforge.net Subject: Lxc-devel Digest, Vol 51, Issue 10 Send Lxc-devel mailing list submissions to lxc-devel@lists.sourceforge.net To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/lxc-devel or, via email, send a message with subject or body 'help' to lxc-devel-requ...@lists.sourceforge.net You can reach the person managing the list at lxc-devel-ow...@lists.sourceforge.net When replying, please edit your Subject line so it is more specific than "Re: Contents of Lxc-devel digest..." Today's Topics: 1. Re: [PATCH] Fix package name needed for building docs with RPM (St?phane Graber) 2. [PATCH] Fix checkconfig to handle kernel memory cgroupname change (Dwight Engen) 3. Re: using posix shell instead of bash (Michael H. Warfield) 4. Re: using posix shell instead of bash (St?phane Graber) 5. Re: [PATCH] lxc-destroy: make it work with busybox (Natanael Copa) 6. Re: [PATCH] lxc-start: add option -p, --pidfile=FILE for use with --daemon (Natanael Copa) -- Message: 1 Date: Wed, 14 Nov 2012 10:55:50 -0500 From: St?phane Graber Subject: Re: [lxc-devel] [PATCH] Fix package name needed for building docs with RPM To: Dwight Engen Cc: lxc-devel@lists.sourceforge.net Message-ID: <50a3bf06.1040...@ubuntu.com> Content-Type: text/plain; charset="iso-8859-1" On 11/14/2012 10:44 AM, Dwight Engen wrote: > Tested on Oracle Linux 6 and Fedora 17 > > Signed-off-by: Dwight Engen Acked-by: St?phane Graber And applied to staging branch. > --- > lxc.spec.in |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/lxc.spec.in b/lxc.spec.in > index 10b7254..7998cfd 100644 > --- a/lxc.spec.in > +++ b/lxc.spec.in > @@ -30,7 +30,7 @@ Group: Applications/System > License: LGPL > BuildRoot: %{_tmppath}/%{name}-%{version}-build > Requires: libcap > -BuildRequires: libcap libcap-devel docbook2x > +BuildRequires: libcap libcap-devel docbook2X > > %description > > -- St?phane Graber Ubuntu developer http://www.ubuntu.com -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 899 bytes Desc: OpenPGP digital signature -- Message: 2 Date: Wed, 14 Nov 2012 12:03:56 -0500 From: Dwight Engen Subject: [lxc-devel] [PATCH] Fix checkconfig to handle kernel memory cgroup name change To: lxc-devel@lists.sourceforge.net Message-ID: <20121114120356.7c6bf...@delphi.home> Content-Type: text/plain; charset=US-ASCII The kernel config option for the memory cgroup was changed in 3.6 from CONFIG_CGROUP_MEM_RES_CTLR to CONFIG_MEMCG with commit c255a458. Signed-off-by: Dwight Engen --- src/lxc/lxc-checkconfig.in | 25 +++-- 1 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/lxc/lxc-checkconfig.in b/src/lxc/lxc-checkconfig.in index 8c2b5e5..8263c17 100644 --- a/src/lxc/lxc-checkconfig.in +++ b/src/lxc/lxc-checkconfig.in @@ -68,6 +68,15 @@ print_cgroups() { } CGROUP_MNT_PATH=`print_cgroups cgroup /proc/self/mounts | head -1` +KVER_MAJOR=$($GREP '^# Linux' $CONFIG | \ +sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/') +if [[ $KVER_MAJOR == 2 ]]; then +KVER_MINOR=$($GREP '^# Linux' $CONFIG | \ +sed -r 's/.* 2.6.([0-9]{2}).*/\1/') +else +KVER_MINOR=$($GREP '^# Linux' $CONFIG | \ +sed -r 's/.* [0-9]\.([0-9]{1,3})\.[0-9]{1,3}.*/\1/') +fi echo -n "Cgroup: " && is_enabled CONFIG_CGROUPS yes @@ -80,22 +89,18 @@ fi echo -n "Cgroup device: " && is_enabled CONFIG_CGROUP_DEVICE echo -n "Cgroup sched: " && is_enabled CONFIG_CGROUP_SCHED echo -n "Cgroup cpu account: " && is_enabled CONFIG_CGROUP_CPUACCT -echo -n "Cgroup memory controller: " && is_enabled CONFIG_CGROUP_MEM_RES_CTLR +echo -n "Cgroup memory controller: " +if [ $KVER_MAJOR -ge 3 -a $KVER_MINOR -ge 6 ]; then +is_enabled CONFIG_MEMCG +else +is_enabled CONFIG_CGROUP_MEM_RES_CTLR +fi is_set CONFIG_SMP && echo -n "Cgroup cpuset: " && is_enabled CONFIG_CPUSETS echo echo "--- Misc ---" echo -n "Veth pair device: " && is_enabled CONFIG_VETH echo -n "Macvlan: " && is_enabled CONFIG_MACVLAN echo -n "Vlan: " && is_enabled CONFIG_VLAN_8021Q -KVER_MAJOR=$($GREP '^# Linux' $CONFIG | \ -sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/') -if [[ $KVER_MAJOR == 2 ]]; then -KVER_MINOR=$($GREP '^# Linux'