Dave Miner wrote:
> 
> Please review the webrev at
> 
> http://cr.opensolaris.org/~dminer/dc_1441/
> 
> which addresses
> 
> 1441 usbgen should calculate size of USB image automatically
> http://defect.opensolaris.org/bz/show_bug.cgi?id=1441
> 
> 927 USB image should be 444
> http://defect.opensolaris.org/bz/show_bug.cgi?id=927
> 
> 1442 pkgs.txt needs to include "entire" incorporation package
> http://defect.opensolaris.org/bz/show_bug.cgi?id=1442

> -mkfile -n $USB_SIZE $USB_FILE
> +# Compute size for USB image; use ISO + 20% to account for smaller block
> +# size on UFS and the log.  Round to nearest kbyte as lofiadm demands 
> +# size be a multiple of 512
> +USB_SIZE=`ls -l $ISO_FILE | nawk '{print int($5 * 1.2/1024)}'`

1. Please declare "USB_SIZE" as an integer variable ("float" won't work
since the script uses "bash" which makes things a bit more compliciated
in this case), e.g. ...
-- snip --
integer USB_SIZE
-- snip --
(as a result the input value can only be a number and the whole thing
will be a bit faster)

2. Please use shell builtin math, e.g. for "bash" it may be...
-- snip --
set -- $(ls -l /usr/bin/ls) ; (( USB_SIZE=( ($5 * 12)/(10*1024) + 1) ))
-- snip -- 
... and for ksh93 it may be...
-- snip --
set -- $(ls -l /usr/bin/ls) ; (( USB_SIZE=( int($5 * 1.2/1024.) ) ))
-- snip -- 

> +mkfile -n ${USB_SIZE}k $USB_FILE

Uhm... please use quotes around "$USB_FILE" and shell builtin math may
(or may not) be better, e.g. ...
-- snip --
mkfile -n $(( USB_SIZE * 1024)) $USB_FILE
-- snip --

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)

Reply via email to