[PATCH openbmc v6 10/18] initfs: update: add option to perform checks but skip actual update

Andrew Jeffery andrew at aj.id.au
Thu Jun 23 15:12:40 AEST 2016


On Wed, 2016-06-22 at 19:30 -0500, OpenBMC Patches wrote:
> From: "Milton D. Miller II" <miltonm at us.ibm.com>
> 
> Provide a way to check if update is likely to succeed without
> attempting actual updates.
> 
> This will check the image names correspond to mtd partition names,
> and will be enhanced with additional checking for file size and
> individual partition mounts.
> 
> This is not called --dry-run because it will still do file save
> and restore if those are enabled.

Is save/restore useful if nothing's going to change - as in, why not
make it a true dry-run? Or are you concerned about adding more logic to
prevent the save/restore from happening?

Cheers,

Andrew

> 
> Signed-off-by: Milton Miller <miltonm at us.ibm.com>
> ---
>  .../obmc-phosphor-initfs/files/obmc-update.sh      | 31 +++++++++++++---------
>  1 file changed, 19 insertions(+), 12 deletions(-)
> 
> diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
> index 4249161..4442e5b 100755
> --- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
> +++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
> @@ -57,6 +57,7 @@ upper=$rwdir/cow
>  save=/run/save/${upper##*/}
>  
>  mounted=
> +doflash=y
>  doclean=
>  dosave=y
>  dorestore=y
> @@ -88,6 +89,9 @@ do
>  	--restore-files)
>  		dorestore=y
>  		shift ;;
> +	--no-flash)
> +		doflash=
> +		shift ;;
>  	--copy-files)
>  		toram=y
>  		shift ;;
> @@ -133,18 +137,21 @@ do
>  	fi
>  done
>  
> -for f in $image*
> -do
> -	if test ! -s $f
> -	then
> -		echo "Skipping empty update of ${f#$image}."
> -		rm $f
> -		continue
> -	fi
> -	m=$(findmtd ${f#$image})
> -	echo "Updating ${f#$image}..."
> -	flashcp -v $f /dev/$m && rm $f
> -done
> +if test -n "$doflash"
> +then
> +	for f in $image*
> +	do
> +		if test ! -s $f
> +		then
> +			echo "Skipping empty update of ${f#$image}."
> +			rm $f
> +			continue
> +		fi
> +		m=$(findmtd ${f#$image})
> +		echo "Updating ${f#$image}..."
> +		flashcp -v $f /dev/$m && rm $f
> +	done
> +fi
>  
>  if test -d $save -a "x$toram" = xy
>  then
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20160623/b498e187/attachment.sig>


More information about the openbmc mailing list