From: Elan Ruusamäe Date: Mon, 18 Nov 2013 23:23:33 +0000 (+0200) Subject: use awk, instead of 'grep | awk' X-Git-Tag: lxc-1.0.0.beta1~107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=853d58fdf5af0960b7b6edc9dea0fadddb8535f1;p=thirdparty%2Flxc.git use awk, instead of 'grep | awk' Signed-off-by: Elan Ruusamäe Acked-by: Stéphane Graber --- diff --git a/templates/lxc-altlinux.in b/templates/lxc-altlinux.in index c8de4e44f..559ba75e8 100644 --- a/templates/lxc-altlinux.in +++ b/templates/lxc-altlinux.in @@ -427,7 +427,7 @@ fi # check for 'lxc.rootfs' passed in through default config by lxc-create if [ -z "$rootfs_path" ]; then if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then - rootfs_path=`grep 'lxc.rootfs =' $path/config | awk -F= '{ print $2 }'` + rootfs_path=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $path/config) else rootfs_path=$path/$name/rootfs fi diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in index 25125e4c5..23d654e0d 100644 --- a/templates/lxc-busybox.in +++ b/templates/lxc-busybox.in @@ -341,7 +341,7 @@ fi config="$path/config" if [ -z "$rootfs" ]; then if grep -q '^lxc.rootfs' $config 2>/dev/null ; then - rootfs=`grep 'lxc.rootfs =' $config | awk -F= '{ print $2 }'` + rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config) else rootfs=$path/rootfs fi diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in index 645fe8d73..cd69cebe8 100644 --- a/templates/lxc-debian.in +++ b/templates/lxc-debian.in @@ -383,7 +383,7 @@ fi config="$path/config" if [ -z "$rootfs" ]; then if grep -q '^lxc.rootfs' $config 2>/dev/null ; then - rootfs=`grep 'lxc.rootfs =' $config | awk -F= '{ print $2 }'` + rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config) else rootfs=$path/rootfs fi diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in index 747bfd5a3..eaa7ce479 100644 --- a/templates/lxc-fedora.in +++ b/templates/lxc-fedora.in @@ -1030,7 +1030,7 @@ if [ -z "$rootfs_path" ]; then rootfs_path=$path/rootfs # check for 'lxc.rootfs' passed in through default config by lxc-create if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then - rootfs_path=`grep 'lxc.rootfs =' $path/config | awk -F= '{ print $2 }'` + rootfs_path=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $path/config) fi fi config_path=$default_path/$name diff --git a/templates/lxc-openmandriva.in b/templates/lxc-openmandriva.in index e51333cf9..3a1fa2734 100644 --- a/templates/lxc-openmandriva.in +++ b/templates/lxc-openmandriva.in @@ -420,7 +420,7 @@ fi # check for 'lxc.rootfs' passed in through default config by lxc-create if [ -z "$rootfs_path" ]; then if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then - rootfs_path=`grep 'lxc.rootfs =' $path/config | awk -F= '{ print $2 }'` + rootfs_path=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $path/config) else rootfs_path=$path/$name/rootfs fi diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in index c8004fd30..88f7742ab 100644 --- a/templates/lxc-opensuse.in +++ b/templates/lxc-opensuse.in @@ -390,7 +390,7 @@ fi config="$path/config" if [ -z "$rootfs" ]; then if grep -q '^lxc.rootfs' $config 2>/dev/null ; then - rootfs=`grep 'lxc.rootfs =' $config | awk -F= '{ print $2 }'` + rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config) else rootfs=$path/rootfs fi diff --git a/templates/lxc-plamo.in b/templates/lxc-plamo.in index fa05cd130..bc4f80bca 100644 --- a/templates/lxc-plamo.in +++ b/templates/lxc-plamo.in @@ -367,7 +367,7 @@ dlcache=$cache/cache-${prog##*-}-$release-$arch rtcache=$cache/rootfs-${prog##*-}-$release-$arch if [ -z "$rootfs" ] ; then if grep -q "^lxc.rootfs" $path/config ; then - rootfs=`grep "^lxc.rootfs" $path/config | awk -F= '{print $2}'` + rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $path/config) else rootfs=$path/rootfs fi diff --git a/templates/lxc-sshd.in b/templates/lxc-sshd.in index 0d4a50273..622f8220b 100644 --- a/templates/lxc-sshd.in +++ b/templates/lxc-sshd.in @@ -237,7 +237,7 @@ fi config="$path/config" if [ -z "$rootfs" ]; then if grep -q '^lxc.rootfs' $config 2>/dev/null ; then - rootfs=`grep 'lxc.rootfs =' $config | awk -F= '{ print $2 }'` + rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config) else rootfs=$path/rootfs fi diff --git a/templates/lxc-ubuntu-cloud.in b/templates/lxc-ubuntu-cloud.in index aeadc2dbd..09c662627 100644 --- a/templates/lxc-ubuntu-cloud.in +++ b/templates/lxc-ubuntu-cloud.in @@ -293,7 +293,7 @@ fi config="$path/config" if [ -z "$rootfs" ]; then if grep -q '^lxc.rootfs' $config 2>/dev/null ; then - rootfs=`grep 'lxc.rootfs =' $config | awk -F= '{ print $2 }'` + rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config) else rootfs=$path/rootfs fi diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in index 3e296d83f..eb8cdebfb 100644 --- a/templates/lxc-ubuntu.in +++ b/templates/lxc-ubuntu.in @@ -669,7 +669,7 @@ config="$path/config" # if $rootfs exists here, it was passed in with --rootfs if [ -z "$rootfs" ]; then if grep -q '^lxc.rootfs' $config 2>/dev/null ; then - rootfs=`grep 'lxc.rootfs =' $config | awk -F= '{ print $2 }'` + rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config) else rootfs=$path/rootfs fi