Tab/spaces consistency for templates

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
Stéphane Graber 2013-11-25 11:57:34 -05:00
parent f7f1ba77b7
commit c01c25fcdd
No known key found for this signature in database
GPG Key ID: C638974D64792D67
6 changed files with 42 additions and 37 deletions

View File

@ -300,7 +300,7 @@ while [ $# -gt 0 ]; do
optarg_check $opt "$1" optarg_check $opt "$1"
arch=$1 arch=$1
shift shift
;; ;;
--) --)
break;; break;;
--*=*) --*=*)
@ -335,12 +335,17 @@ lxc_arch=$arch
apk_arch=$arch apk_arch=$arch
case "$arch" in case "$arch" in
i[3-6]86) i[3-6]86)
apk_arch=x86;; apk_arch=x86
x86) ;;
lxc_arch=i686;; x86)
x86_64|"") ;; lxc_arch=i686
*) die "unsupported architecture: $arch";; ;;
x86_64|"")
;;
*)
die "unsupported architecture: $arch"
;;
esac esac
: ${APK:=apk} : ${APK:=apk}

View File

@ -181,7 +181,7 @@ install_openmandriva()
echo "Checking cache download in $cache/rootfs ... " echo "Checking cache download in $cache/rootfs ... "
if [ ! -e "$cache/rootfs" ]; then if [ ! -e "$cache/rootfs" ]; then
echo $cache/rootfs echo $cache/rootfs
create_chroot_openmandriva create_chroot_openmandriva
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed to download 'openmandriva basesystem-minimal'" echo "Failed to download 'openmandriva basesystem-minimal'"
@ -349,9 +349,9 @@ if [ -f /etc/lsb-release ]; then
if [ "$DISTRIB_ID" = "OpenMandrivaLinux" ]; then if [ "$DISTRIB_ID" = "OpenMandrivaLinux" ]; then
release=openmandriva2013.0 release=openmandriva2013.0
elif [ "$DISTRIB_ID" = "RosaDesktop.Fresh" ]; then elif [ "$DISTRIB_ID" = "RosaDesktop.Fresh" ]; then
release=rosa2012.1 release=rosa2012.1
else else
echo "This is not an OpenMandriva or ROSA release" echo "This is not an OpenMandriva or ROSA release"
exit 1 exit 1
fi fi
fi fi
@ -366,7 +366,7 @@ do
-P|--profile) profile=$2; shift 2;; -P|--profile) profile=$2; shift 2;;
-c|--clean) clean=$2; shift 2;; -c|--clean) clean=$2; shift 2;;
-R|--release) release=$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;; -4|--ipv4) ipv4=$2; shift 2;;
-6|--ipv6) ipv6=$2; shift 2;; -6|--ipv6) ipv6=$2; shift 2;;
-g|--gw) gw=$2; shift 2;; -g|--gw) gw=$2; shift 2;;

View File

@ -246,29 +246,29 @@ copy_configuration()
name=$3 name=$3
if grep -q "^lxc.network.type" $path/config; then if grep -q "^lxc.network.type" $path/config; then
TYPE=$(sed '/^#/d; /lxc.network.type/!d; s/.*=[ \t]*//' $path/config) TYPE=$(sed '/^#/d; /lxc.network.type/!d; s/.*=[ \t]*//' $path/config)
grep -q "^lxc.network.ipv4" $path/config grep -q "^lxc.network.ipv4" $path/config
IPV4_NOT_CONFIGURED=$? IPV4_NOT_CONFIGURED=$?
if [ ! grep -q "^lxc.network.*.gateway" $path/config ]; then 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) [ $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 [ "$TYPE" = "veth" -o "$TYPE" = "macvlan" ]; then
if [ $IPV4_NOT_CONFIGURED -eq 0 -a "$IPV4" != "0.0.0.0" ]; then if [ $IPV4_NOT_CONFIGURED -eq 0 -a "$IPV4" != "0.0.0.0" ]; then
# set default route # set default route
IP=$(/sbin/ip route | awk '/default/ { print $3 }') IP=$(/sbin/ip route | awk '/default/ { print $3 }')
echo "lxc.network.ipv4.gateway = $IP " >> $path/config echo "lxc.network.ipv4.gateway = $IP " >> $path/config
else else
# set network as dhcp # set network as dhcp
sed -i -e 's/BOOTPROTO=.*/BOOTPROTO=dhcp/' $rootfs/etc/sysconfig/network/ifcfg-eth0 sed -i -e 's/BOOTPROTO=.*/BOOTPROTO=dhcp/' $rootfs/etc/sysconfig/network/ifcfg-eth0
fi fi
fi fi
fi fi
if [ "$TYPE" != "empty" ]; then if [ "$TYPE" != "empty" ]; then
echo "#remove next line if host DNS configuration should not be available to container" >> $path/config 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 echo "lxc.mount.entry = /etc/resolv.conf etc/resolv.conf none bind,ro 0 0" >> $path/config
fi fi
else else
echo 'lxc.network.type = empty' >> $path/config echo 'lxc.network.type = empty' >> $path/config
fi fi
grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config

View File

@ -67,7 +67,7 @@ container_rootfs_configure()
if [ -e $container_rootfs/etc/selinux/config ]; then if [ -e $container_rootfs/etc/selinux/config ]; then
sed -i 's|SELINUX=enforcing|SELINUX=disabled|' $container_rootfs/etc/selinux/config sed -i 's|SELINUX=enforcing|SELINUX=disabled|' $container_rootfs/etc/selinux/config
else else
mkdir -p $container_rootfs/etc/selinux mkdir -p $container_rootfs/etc/selinux
echo "SELINUX=disabled" >$container_rootfs/etc/selinux/config echo "SELINUX=disabled" >$container_rootfs/etc/selinux/config
fi 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 sed -i 's|session[ \t]*required[ \t]*pam_selinux.so[ \t]*close|#session required pam_selinux.so close|' $container_rootfs/etc/pam.d/login

View File

@ -220,7 +220,7 @@ send host-name "<hostname>";
EOF EOF
ifconfig eth0 up ifconfig eth0 up
dhclient eth0 -cf /dhclient.conf dhclient eth0 -cf /dhclient.conf
echo "Container IP address:" echo "Container IP address:"
ifconfig eth0 |grep inet ifconfig eth0 |grep inet
fi fi

View File

@ -404,9 +404,9 @@ copy_configuration $path $rootfs $name $arch $release
"$CLONE_HOOK_FN" "${cloneargs[@]}" "$rootfs" "$CLONE_HOOK_FN" "${cloneargs[@]}" "$rootfs"
if [ $mapped_uid -ne -1 ]; then if [ $mapped_uid -ne -1 ]; then
chown $mapped_uid $path/config chown $mapped_uid $path/config
chown -R $mapped_uid $STATE_DIR chown -R $mapped_uid $STATE_DIR
chown -R $mapped_uid $cache chown -R $mapped_uid $cache
fi fi
echo "Container $name created." echo "Container $name created."