I like it, if someone who is fluent in ksh line noise could please
verify and commit, that would be awesome, thanks.

On Fri, Nov 01, 2019 at 09:37:04PM -0400, trondd wrote:
> Anthony Coulter <b...@anthonycoulter.name> wrote:
> 
> > Hello @tech,
> > 
> > When I manually upgrade OpenBSD using bsd.rd, I have to set http_proxy
> > to fetch the file sets. When I reboot after installing, fw_update
> > succeeds because theinstall script was clever enough to export
> > http_proxy in /etc/rc.firsttime.
> > 
> > Unfortunately sysupgrade(8) does not remember that http_proxy was set
> > when it fetched the file sets, and so when I run sysupgrade I have to
> > either wait for fw_update to manually time out on first reboot, or kill
> > it manually with ^C.
> > 
> > Adding the line:
> > 
> > [ ${http_proxy} ] && echo "export http_proxy=${http_proxy}" 
> > >>/etc/rc.firsttime
> > 
> > to a spot near the bottom of /usr/sbin/sysupgrade fixes my fw_update
> > problem, at least until the upgrade restores all of my files to their
> > stock defaults. Is this something we could integrate into the official
> > repository?
> > 
> > Thanks and regards,
> > Anthony Coulter
> 
> Here it is in patch form in case there is interest.  This also pulls in the
> quote function from install.sub to make sure a proxy username or password is
> quoted properly.  I haven't tested this since I could only use it at work.
> 
> Tim.
> 
> 
> Index: sysupgrade.sh
> ===================================================================
> RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v
> retrieving revision 1.29
> diff -u -p -r1.29 sysupgrade.sh
> --- sysupgrade.sh     26 Oct 2019 04:04:20 -0000      1.29
> +++ sysupgrade.sh     2 Nov 2019 00:39:05 -0000
> @@ -73,6 +73,16 @@ rmel() {
>       echo -n "$_c"
>  }
>  
> +# Prints the supplied parameters properly escaped for future sh/ksh parsing.
> +# Quotes are added if needed, so you should not do that yourself.
> +quote() (
> +     # Since this is a subshell we won't pollute the calling namespace.
> +     for _a; do
> +             alias Q=$_a; _a=$(alias Q); print -rn -- " ${_a#Q=}"
> +     done | sed '1s/ //'
> +     echo
> +)
> +
>  RELEASE=false
>  SNAP=false
>  FORCE=false
> @@ -199,6 +209,9 @@ if ! ${KEEP}; then
>  rm -f /home/_sysupgrade/{${CLEAN}}
>  __EOT
>  fi
> +
> +[[ -n $http_proxy ]] &&
> +     quote export "http_proxy=$http_proxy" >>/etc/rc.firsttime
>  
>  install -F -m 700 bsd.rd /bsd.upgrade
>  sync
> 

-- 
I'm not entirely sure you are real.

Reply via email to