[lxc-devel] [PATCH] allow multiple types of init scripts to be configured

Stéphane Graber stgraber at ubuntu.com
Mon Jan 6 19:23:31 UTC 2014


On Mon, Jan 06, 2014 at 02:05:12PM -0500, Dwight Engen wrote:
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

I'll just tweak the list of init systems a bit setting Ubuntu to only
upstart for now and Debian to all of them.

I'll also look into upstreaming the Upstart jobs we're currently using
over the next few days.

> ---
>  configure.ac | 42 ++++++++++++++++++++++--------------------
>  1 file changed, 22 insertions(+), 20 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index fb61e26..a200460 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -73,21 +73,10 @@ AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
>  # Check for init system type
>  AC_MSG_CHECKING([for init system type])
>  AC_ARG_WITH([init-script],
> -	    [AC_HELP_STRING([--with-init-script@<:@=TYPE@:>@],
> -			    [Type of init script to install: sysv, systemd, upstart,
> -			     distro, none @<:@default=distro@:>@])],[],[with_init_script=distro])
> +	    [AC_HELP_STRING([--with-init-script@<:@=TYPE@<:@,TYPE,...@:>@@:>@],
> +			    [Type(s) of init script to install: sysv, systemd, upstart,
> +			     distro @<:@default=distro@:>@])],[],[with_init_script=distro])
>  case "$with_init_script" in
> -	sysv)
> -		init_script=sysv
> -		;;
> -	systemd)
> -		init_script=systemd
> -		;;
> -	upstart)
> -		init_script=upstart
> -		;;
> -	none)
> -		;;
>  	distro)
>  		case $with_distro in
>  			fedora)
> @@ -97,7 +86,7 @@ case "$with_init_script" in
>  				init_script=sysv
>  				;;
>  			ubuntu)
> -				init_script=upstart
> +				init_script=sysv,upstart
>  				;;
>  			*)
>  				echo -n "Linux distribution init system unknown, defaulting to sysv"
> @@ -106,12 +95,25 @@ case "$with_init_script" in
>  		esac
>  		;;
>  	*)
> -		AC_MSG_ERROR([Unknown init system type $with_init_script])
> +		init_script=$with_init_script
>  		;;
>  esac
> -AM_CONDITIONAL([INIT_SCRIPT_SYSV], test "$init_script" = "sysv")
> -AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], test "$init_script" = "systemd")
> -AM_CONDITIONAL([INIT_SCRIPT_UPSTART], test "$init_script" = "upstart")
> +
> +# Check valid init systems were given, run in subshell so we don't mess up IFS
> +(IFS="," ; for init_sys in $init_script;
> +do
> +	case "$init_sys" in
> +		none|sysv|systemd|upstart)
> +			;;
> +		*)
> +			exit 1
> +			;;
> +	esac
> +done) || AC_MSG_ERROR([Unknown init system type in $init_script])
> +
> +AM_CONDITIONAL([INIT_SCRIPT_SYSV], [echo "$init_script" |grep -q "sysv"])
> +AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], [echo "$init_script" |grep -q "systemd"])
> +AM_CONDITIONAL([INIT_SCRIPT_UPSTART], [echo "$init_script" |grep -q "upstart"])
>  AC_MSG_RESULT($init_script)
>  
>  # Allow disabling rpath
> @@ -659,7 +661,7 @@ cat << EOF
>  Environment:
>   - compiler: $CC
>   - distribution: $with_distro
> - - init script type: $init_script
> + - init script type(s): $init_script
>   - rpath: $enable_rpath
>   - GnuTLS: $enable_gnutls
>  
> -- 
> 1.8.3.1
> 

-- 
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: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140106/c9ceee29/attachment.pgp>


More information about the lxc-devel mailing list