From c01c25fcdd1e0cacad8075bcfcef4c8e8d4b8cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Mon, 25 Nov 2013 11:57:34 -0500 Subject: [PATCH] Tab/spaces consistency for templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- templates/lxc-alpine.in | 19 ++++++++++------ templates/lxc-openmandriva.in | 8 +++---- templates/lxc-opensuse.in | 42 +++++++++++++++++------------------ templates/lxc-oracle.in | 2 +- templates/lxc-sshd.in | 2 +- templates/lxc-ubuntu-cloud.in | 6 ++--- 6 files changed, 42 insertions(+), 37 deletions(-) diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in index 258eed4c5..56236a4cc 100644 --- a/templates/lxc-alpine.in +++ b/templates/lxc-alpine.in @@ -300,7 +300,7 @@ while [ $# -gt 0 ]; do optarg_check $opt "$1" arch=$1 shift - ;; + ;; --) break;; --*=*) @@ -335,12 +335,17 @@ lxc_arch=$arch apk_arch=$arch case "$arch" in - i[3-6]86) - apk_arch=x86;; - x86) - lxc_arch=i686;; - x86_64|"") ;; - *) die "unsupported architecture: $arch";; + i[3-6]86) + apk_arch=x86 + ;; + x86) + lxc_arch=i686 + ;; + x86_64|"") + ;; + *) + die "unsupported architecture: $arch" + ;; esac : ${APK:=apk} diff --git a/templates/lxc-openmandriva.in b/templates/lxc-openmandriva.in index 70c3a21e4..75d310a99 100644 --- a/templates/lxc-openmandriva.in +++ b/templates/lxc-openmandriva.in @@ -181,7 +181,7 @@ install_openmandriva() echo "Checking cache download in $cache/rootfs ... " if [ ! -e "$cache/rootfs" ]; then - echo $cache/rootfs + echo $cache/rootfs create_chroot_openmandriva if [ $? -ne 0 ]; then echo "Failed to download 'openmandriva basesystem-minimal'" @@ -349,9 +349,9 @@ if [ -f /etc/lsb-release ]; then if [ "$DISTRIB_ID" = "OpenMandrivaLinux" ]; then release=openmandriva2013.0 elif [ "$DISTRIB_ID" = "RosaDesktop.Fresh" ]; then - release=rosa2012.1 + release=rosa2012.1 else - echo "This is not an OpenMandriva or ROSA release" + echo "This is not an OpenMandriva or ROSA release" exit 1 fi fi @@ -366,7 +366,7 @@ do -P|--profile) profile=$2; shift 2;; -c|--clean) clean=$2; shift 2;; -R|--release) release=$2; shift 2;; - -a|--arch) arch=$2; shift 2;; + -a|--arch) arch=$2; shift 2;; -4|--ipv4) ipv4=$2; shift 2;; -6|--ipv6) ipv6=$2; shift 2;; -g|--gw) gw=$2; shift 2;; diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in index 88f7742ab..f28ae22d1 100644 --- a/templates/lxc-opensuse.in +++ b/templates/lxc-opensuse.in @@ -246,29 +246,29 @@ copy_configuration() name=$3 if grep -q "^lxc.network.type" $path/config; then - TYPE=$(sed '/^#/d; /lxc.network.type/!d; s/.*=[ \t]*//' $path/config) - grep -q "^lxc.network.ipv4" $path/config - IPV4_NOT_CONFIGURED=$? + TYPE=$(sed '/^#/d; /lxc.network.type/!d; s/.*=[ \t]*//' $path/config) + grep -q "^lxc.network.ipv4" $path/config + IPV4_NOT_CONFIGURED=$? - if [ ! grep -q "^lxc.network.*.gateway" $path/config ]; then - [ $IPV4_NOT_CONFIGURED -eq 0 ] && IPV4=$(sed '/^#/d; /lxc.network.ipv4/!d; /gateway/d; s/.*=[ \t]*//; s/\([[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\).*/\1/' $path/config) - if [ "$TYPE" = "veth" -o "$TYPE" = "macvlan" ]; then - if [ $IPV4_NOT_CONFIGURED -eq 0 -a "$IPV4" != "0.0.0.0" ]; then - # set default route - IP=$(/sbin/ip route | awk '/default/ { print $3 }') - echo "lxc.network.ipv4.gateway = $IP " >> $path/config - else - # set network as dhcp - sed -i -e 's/BOOTPROTO=.*/BOOTPROTO=dhcp/' $rootfs/etc/sysconfig/network/ifcfg-eth0 - fi - fi - fi - if [ "$TYPE" != "empty" ]; then - echo "#remove next line if host DNS configuration should not be available to container" >> $path/config - echo "lxc.mount.entry = /etc/resolv.conf etc/resolv.conf none bind,ro 0 0" >> $path/config - fi + if [ ! grep -q "^lxc.network.*.gateway" $path/config ]; then + [ $IPV4_NOT_CONFIGURED -eq 0 ] && IPV4=$(sed '/^#/d; /lxc.network.ipv4/!d; /gateway/d; s/.*=[ \t]*//; s/\([[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\).*/\1/' $path/config) + if [ "$TYPE" = "veth" -o "$TYPE" = "macvlan" ]; then + if [ $IPV4_NOT_CONFIGURED -eq 0 -a "$IPV4" != "0.0.0.0" ]; then + # set default route + IP=$(/sbin/ip route | awk '/default/ { print $3 }') + echo "lxc.network.ipv4.gateway = $IP " >> $path/config + else + # set network as dhcp + sed -i -e 's/BOOTPROTO=.*/BOOTPROTO=dhcp/' $rootfs/etc/sysconfig/network/ifcfg-eth0 + fi + fi + fi + if [ "$TYPE" != "empty" ]; then + echo "#remove next line if host DNS configuration should not be available to container" >> $path/config + echo "lxc.mount.entry = /etc/resolv.conf etc/resolv.conf none bind,ro 0 0" >> $path/config + fi else - echo 'lxc.network.type = empty' >> $path/config + echo 'lxc.network.type = empty' >> $path/config fi grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in index 8770e70da..0552aabf1 100644 --- a/templates/lxc-oracle.in +++ b/templates/lxc-oracle.in @@ -67,7 +67,7 @@ container_rootfs_configure() if [ -e $container_rootfs/etc/selinux/config ]; then sed -i 's|SELINUX=enforcing|SELINUX=disabled|' $container_rootfs/etc/selinux/config else - mkdir -p $container_rootfs/etc/selinux + mkdir -p $container_rootfs/etc/selinux echo "SELINUX=disabled" >$container_rootfs/etc/selinux/config fi sed -i 's|session[ \t]*required[ \t]*pam_selinux.so[ \t]*close|#session required pam_selinux.so close|' $container_rootfs/etc/pam.d/login diff --git a/templates/lxc-sshd.in b/templates/lxc-sshd.in index 622f8220b..b8df78f07 100644 --- a/templates/lxc-sshd.in +++ b/templates/lxc-sshd.in @@ -220,7 +220,7 @@ send host-name ""; EOF ifconfig eth0 up dhclient eth0 -cf /dhclient.conf - echo "Container IP address:" + echo "Container IP address:" ifconfig eth0 |grep inet fi diff --git a/templates/lxc-ubuntu-cloud.in b/templates/lxc-ubuntu-cloud.in index 09c662627..3042d89a7 100644 --- a/templates/lxc-ubuntu-cloud.in +++ b/templates/lxc-ubuntu-cloud.in @@ -404,9 +404,9 @@ copy_configuration $path $rootfs $name $arch $release "$CLONE_HOOK_FN" "${cloneargs[@]}" "$rootfs" if [ $mapped_uid -ne -1 ]; then - chown $mapped_uid $path/config - chown -R $mapped_uid $STATE_DIR - chown -R $mapped_uid $cache + chown $mapped_uid $path/config + chown -R $mapped_uid $STATE_DIR + chown -R $mapped_uid $cache fi echo "Container $name created."