[lxc-devel] [PATCH] use susv3 head arguments

Bogdan Purcareata bogdan.purcareata at freescale.com
Thu Jan 30 17:07:21 UTC 2014


Without enabling INCLUDE_SUSv2 in busybox, we need to use head's -n argument,
rather than -#.

Signed-off-by: Christopher Larson <kergoth at gmail.com>
---
 src/lxc/lxc-checkconfig.in | 2 +-
 src/tests/lxc-test-ubuntu  | 2 +-
 templates/lxc-alpine.in    | 2 +-
 templates/lxc-oracle.in    | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/lxc/lxc-checkconfig.in b/src/lxc/lxc-checkconfig.in
index b49e76e..5e35a81 100644
--- a/src/lxc/lxc-checkconfig.in
+++ b/src/lxc/lxc-checkconfig.in
@@ -77,7 +77,7 @@ print_cgroups() {
   awk '$1 !~ /#/ && $3 == mp { print $2; } ; END { exit(0); } '  "mp=$1" "$2" ;
 }
 
-CGROUP_MNT_PATH=`print_cgroups cgroup /proc/self/mounts | head -1`
+CGROUP_MNT_PATH=`print_cgroups cgroup /proc/self/mounts | head -n 1`
 KVER_MAJOR=$($GREP '^# Linux' $CONFIG | \
     sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/')
 if [ "$KVER_MAJOR" = "2" ]; then
diff --git a/src/tests/lxc-test-ubuntu b/src/tests/lxc-test-ubuntu
index be69eec..01eb056 100755
--- a/src/tests/lxc-test-ubuntu
+++ b/src/tests/lxc-test-ubuntu
@@ -59,7 +59,7 @@ for template in ubuntu ubuntu-cloud; do
 	lxc-wait -n $name -s RUNNING || FAIL "waiting for $template container to run"
 
 	for tries in `seq 1 20`; do
-		lxcip=$(lxc-info -i -n $name -H | head -1)
+		lxcip=$(lxc-info -i -n $name -H | head -n 1)
 		[ -z "$lxcip" ] || break
 		sleep 1
 	done
diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in
index ec6b802..70da08d 100644
--- a/templates/lxc-alpine.in
+++ b/templates/lxc-alpine.in
@@ -189,7 +189,7 @@ EOF
     if [ "$nics" -eq 1 ] && ! grep -q "^lxc.network.hwaddr" $path/config; then
         # see http://sourceforge.net/tracker/?func=detail&aid=3411497&group_id=163076&atid=826303
         hwaddr="fe:$(dd if=/dev/urandom bs=8 count=1 2>/dev/null |od -t x8 | \
-                      head -1 |awk '{print $2}' | cut -c1-10 |\
+                      head -n 1 |awk '{print $2}' | cut -c1-10 |\
                       sed 's/\(..\)/\1:/g; s/.$//')"
         echo "lxc.network.hwaddr = $hwaddr" >> $path/config
     fi
diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in
index 80c2df2..40fe5c0 100644
--- a/templates/lxc-oracle.in
+++ b/templates/lxc-oracle.in
@@ -382,7 +382,7 @@ container_config_create()
     # generate a hwaddr for the container with a high mac address
     # see http://sourceforge.net/tracker/?func=detail&aid=3411497&group_id=163076&atid=826303
     local hwaddr="fe:`dd if=/dev/urandom bs=8 count=1 2>/dev/null |od -t x8 | \
-                      head -1 |awk '{print $2}' | cut -c1-10 |\
+                      head -n 1 |awk '{print $2}' | cut -c1-10 |\
                       sed 's/\(..\)/\1:/g; s/.$//'`"
     cat <<EOF >> $cfg_dir/config || die "unable to create $cfg_dir/config"
 # Container configuration for Oracle Linux $container_release_major.$container_release_minor
-- 
1.8.5.3




More information about the lxc-devel mailing list