On 2019/04/29 00:21, Marco Bonetti wrote:
> > > +++ usr.sbin/sysupgrade/sysupgrade.sh     27 Apr 2019 11:54:48 -0000
> > > @@ -110,7 +110,19 @@ fi
> > >  
> > >  cd ${SETSDIR}
> > >  
> > > -unpriv -f SHA256.sig ftp -Vmo SHA256.sig ${URL}SHA256.sig
> > > +unpriv -f SHA256.sig.tmp ftp -Vmo SHA256.sig.tmp ${URL}SHA256.sig
> > > +TMP_SHA=$(sha256 -q SHA256.sig.tmp)
> > > +
> > > +unpriv touch SHA256.sig
> > > +CUR_SHA=$(sha256 -q SHA256.sig)
> > > +
> > > +if [[ "${TMP_SHA}" = "${CUR_SHA}" ]]; then
> > 
> > Why compare checksums?
> > 
> >     if cmp -s SHA256.sig SHA256.sig.tmp; then
> 
> cmp exits 1 on different files, thus killing the script

That's not the case:

     -e      Errexit.  Exit the shell immediately should an error occur or a
             command fail.  For pipelines and && and || constructs, only exit
             if the last component fails.  Errexit is ignored for while,
             until, if, and elif lists and pipelines beginning ‘!’.

Reply via email to