[lxc-devel] oracle template: fixes when using fedora host

Stéphane Graber stgraber at ubuntu.com
Wed Dec 5 22:04:09 UTC 2012


On 12/05/2012 04:25 PM, Dwight Engen wrote:
> Let oracle template work when host is fedora or oracle and the lsb_release
> command is not present. Verify the arch given is valid. Don't add lxc.network
> section again if already present.
> 
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>

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

Looks like my tab/space consistency patch will need a bit of updating
when applying to account for this change, but that's easy enough to do.

Applied to staging.

> ---
>  templates/lxc-oracle.in |   28 +++++++++++++++++++++++-----
>  1 files changed, 23 insertions(+), 5 deletions(-)
> 
> diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in
> index 1720379..39bfc90 100644
> --- a/templates/lxc-oracle.in
> +++ b/templates/lxc-oracle.in
> @@ -270,8 +270,8 @@ EOF
>      # see if the network settings were already specified
>      lxc_network_type=`grep '^lxc.network.type' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
>      if [ -z "$lxc_network_type" -a			\
> -	 $host_distribution = "OracleServer" -o		\
> -	 $host_distribution = "Fedora" ]; then
> +	 \( $host_distribution = "OracleServer" -o	\
> +	    $host_distribution = "Fedora" \) ]; then
>  	    echo "lxc.network.type = veth" >>$cfg_dir/config
>  	    echo "lxc.network.flags = up" >>$cfg_dir/config
>  	    echo "lxc.network.link = virbr0" >>$cfg_dir/config
> @@ -439,7 +439,7 @@ container_rootfs_create()
>  usage()
>  {
>      cat <<EOF
> -  -a|--arch=<arch>        architecture (ie. i686, x86_64)
> +  -a|--arch=<arch>        architecture (ie. i386, x86_64)
>    -R|--release=<release>  release to download for the new container
>    -u|--url=<url>          replace yum repo url (ie. local yum mirror)
>    -t|--templatefs=<path>  copy/clone rootfs at path instead of downloading
> @@ -496,6 +496,12 @@ if [ "$arch" = "i686" ]; then
>      basearch="i386"
>  fi
>  
> +if [ "$arch" != "i386" -a "$arch" != "x86_64" ]; then
> +    echo "Bad architecture given, check lxc-create"
> +    usage
> +    exit 1
> +fi
> +
>  container_rootfs="$cfg_dir/rootfs"
>  
>  if [ -n "$template_rootfs" ]; then
> @@ -514,8 +520,20 @@ if which lsb_release >/dev/null 2>&1; then
>      host_release_major=`echo $host_release_version |awk -F '.' '{print $1}'`
>      host_release_minor=`echo $host_release_version |awk -F '.' '{print $2}'`
>  else
> -    echo "Unable to determine host distribution, ensure lsb_release is installed"
> -    exit 1
> +    if   [ -f /etc/fedora-release ]; then
> +	host_distribution="Fedora"
> +	host_release_version=`cat /etc/fedora-release |awk '{print $3}'`
> +	host_release_major=$host_release_version
> +	host_release_minor=0
> +    elif [ -f /etc/oracle-release ]; then
> +	host_distribution="OracleServer"
> +	host_release_version=`cat /etc/oracle-release |awk '{print $5}'`
> +	host_release_major=`echo $host_release_version |awk -F '.' '{print $1}'`
> +	host_release_minor=`echo $host_release_version |awk -F '.' '{print $2}'`
> +    else
> +	echo "Unable to determine host distribution, ensure lsb_release is installed"
> +	exit 1
> +    fi
>  fi
>  echo "Host is $host_distribution $host_release_version"
>  
> 


-- 
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
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20121205/9e094d68/attachment.pgp>


More information about the lxc-devel mailing list