From: Peter Kjellerstedt Date: Fri, 30 Sep 2016 19:53:40 +0000 (+0200) Subject: devtool: deploy-target: Avoid unnecessary dependency on awk on the target X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~23949 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bab454b0bf0075fbb2a5de06286a9da1df2adc6;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git devtool: deploy-target: Avoid unnecessary dependency on awk on the target 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 Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py index fb84f2dd085..c4c7bf6c732 100644 --- a/scripts/lib/devtool/deploy.py +++ b/scripts/lib/devtool/deploy.py @@ -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')