]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
devtool: deploy-target: Avoid unnecessary dependency on awk on the target
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>
Fri, 30 Sep 2016 19:53:40 +0000 (21:53 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 4 Oct 2016 23:17:29 +0000 (00:17 +0100)
Relying on that awk is installed on the target just to extract the
fourth column (i.e., the free volume size) from `df -P` is an
unnecessary dependency for devtool deploy-target. As it is already
using sed to mangle the output from `df -P`, this can easily be
modified to only extract the free volume size.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/devtool/deploy.py

index fb84f2dd08545c816d4e1fb417b851f94a92e24a..c4c7bf6c732cd01dbd61d6a23862ac3f311804a4 100644 (file)
@@ -85,7 +85,7 @@ def _prepare_remote_script(deploy, verbose=False, dryrun=False, undeployall=Fals
             lines.append('do')
             lines.append('    checkpath=`dirname "$checkpath"`')
             lines.append('done')
-            lines.append('freespace=`df -P $checkpath | sed "1d" | awk \'{ print $4 }\'`')
+            lines.append(r'freespace=$(df -P $checkpath | sed -nre "s/^(\S+\s+){3}([0-9]+).*/\2/p")')
             # First line of the file is the total space
             lines.append('total=`head -n1 $3`')
             lines.append('if [ $total -gt $freespace ] ; then')