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.en...@oracle.com> --- 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" -- 1.7.11.7 ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel