On Sat, May 09, 2020 at 10:51:49PM +0000, Mikolaj Kucharski wrote:
> 
> A bit of explanation with `cat -n install.sub | expand -t 2`
> 
> 
>   1599  
>   1600      # Fetch and verify the set files.
>   1601      for _f in BUILDINFO $_get_sets; do
>   1602        $UU && reset_watchdog
>   1603  
> 
> I've put BUILDINFO, but I guess it could be added directly to
> $_get_sets. However I think it needs to be added after baseXX.tgz set,
> so directory /var/db is created before ftp tries to copy it into
> /mnt/var/db.

I confirmed today, this is the case. Directory /mnt/var/db needs to
exist before BUILDINFO is put in place and I'm using extraction of
baseXX.tgz to make sure /mnt/var/db is created in advance.

> 
>   1663  
>   1664    # Install the set files.
>   1665    for _f in $_get_sets BUILDINFO; do
>   1666      $UU && reset_watchdog
>   1667      _fsrc="$_src/$_f"
> 
> I'm adding it at the end here, to make sure it's before baseXX.tgz, per
> above explanation about /var/db.
> 
>   1672      # Extract the set files and put the kernel files in place.
>   1673      case $_f in
> 
> I just need a basename of the set and I think using $_f doesn't
> introduce any breakage.
> 
> I've tested below diff by fresh install of OpenBSD on amd64. It works
> for me, file /mnt/var/db/installed.BUILDINFO is created during install
> and after reboot file /var/db/installed.BUILDINFO is present on disk.
> 
> Here is output of the part which diff modifies:
> 
> Set name(s)? (or 'abort' or 'done') [done]
> Get/Verify SHA256.sig   100% |**************************|  2141       00:00
> Signature Verified
> Get/Verify BUILDINFO    100% |**************************|    54       00:00
> Get/Verify bsd          100% |**************************| 18117 KB    02:30
> Get/Verify bsd.rd       100% |**************************| 10109 KB    00:29
> Get/Verify base67.tgz   100% |**************************|   238 MB    13:57
> Get/Verify comp67.tgz   100% |**************************| 74451 KB    02:54
> Get/Verify man67.tgz    100% |**************************|  7464 KB    00:19
> Get/Verify game67.tgz   100% |**************************|  2745 KB    00:07
> Get/Verify xbase67.tgz  100% |**************************| 22912 KB    00:58
> Get/Verify xshare67.tgz 100% |**************************|  4499 KB    00:10
> Get/Verify xfont67.tgz  100% |**************************| 39342 KB    01:30
> Get/Verify xserv67.tgz  100% |**************************| 16767 KB    00:32
> Installing bsd          100% |**************************| 18117 KB    00:01
> Installing bsd.rd       100% |**************************| 10109 KB    00:00
> Installing base67.tgz   100% |**************************|   238 MB    00:28
> Extracting etc.tgz      100% |**************************|   261 KB    00:00
> Installing comp67.tgz   100% |**************************| 74451 KB    00:17
> Installing man67.tgz    100% |**************************|  7464 KB    00:03
> Installing game67.tgz   100% |**************************|  2745 KB    00:00
> Installing xbase67.tgz  100% |**************************| 22912 KB    00:04
> Extracting xetc.tgz     100% |**************************|  7023       00:00
> Installing xshare67.tgz 100% |**************************|  4499 KB    00:03
> Installing xfont67.tgz  100% |**************************| 39342 KB    00:06
> Installing xserv67.tgz  100% |**************************| 16767 KB    00:02
> Installing BUILDINFO    100% |**************************|    54       00:00
> Location of sets? (disk http nfs or 'done') [done]
> 
> 

Below diff fixes upgrade path when BUILDINFO is missing, which can
happen.

Index: distrib/miniroot/install.sub
===================================================================
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.1150
diff -u -p -u -r1.1150 install.sub
--- distrib/miniroot/install.sub        5 Apr 2020 15:15:42 -0000       1.1150
+++ distrib/miniroot/install.sub        10 May 2020 09:27:48 -0000
@@ -1598,7 +1598,7 @@ install_files() {
                        _issue="Signature check of SHA256.sig failed" && break
 
                # Fetch and verify the set files.
-               for _f in $_get_sets; do
+               for _f in BUILDINFO $_get_sets; do
                        $UU && reset_watchdog
 
                        rm -f /tmp/h /tmp/fail
@@ -1662,7 +1662,7 @@ install_files() {
        fi
 
        # Install the set files.
-       for _f in $_get_sets; do
+       for _f in $_get_sets BUILDINFO; do
                $UU && reset_watchdog
                _fsrc="$_src/$_f"
 
@@ -1670,13 +1670,20 @@ install_files() {
                [[ -f $_tmpsrc/$_f ]] && _fsrc="file://$_tmpsrc/$_f"
 
                # Extract the set files and put the kernel files in place.
-               case $_fsrc in
+               case $_f in
                *.tgz)  $_unpriv ftp -D Installing -Vmo - "$_fsrc" |
                                tar -zxphf - -C /mnt &&
                        if [[ $_f == ?(x)base*.tgz && $MODE == install ]]; then
                                ftp -D Extracting -Vmo - \
                                file:///mnt/var/sysmerge/${_f%%base*}etc.tgz |
                                tar -zxphf - -C /mnt
+                       fi
+                       ;;
+               BUILDINFO)
+                       # Keep BUILDINFO for sysupgrade(8).
+                       if [[ -f ${_fsrc#file://} ]]; then
+                               $_unpriv ftp -D Installing -Vmo - \
+                                       "$_fsrc" 
>"/mnt/var/db/installed.BUILDINFO"
                        fi
                        ;;
                *)      # Make a backup of the existing ramdisk kernel in the

-- 
Regards,
 Mikolaj

Reply via email to