Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jun 2014 05:11:17 +1000 (EST)
From:      Ian Smith <smithi@nimnet.asn.au>
To:        Matthew Seaman <matthew@FreeBSD.org>
Cc:        Chris Maness <chris@chrismaness.com>, Devin Teske <devin.teske@fisglobal.com>, freebsd-questions@FreeBSD.org
Subject:   Re: No packages with 9.3-RELEASE? [was: Re: Port Changes FAQ]
Message-ID:  <20140620033957.B609@sola.nimnet.asn.au>
In-Reply-To: <53A27C2A.3040501@FreeBSD.org>
References:  <mailman.75.1403006401.89010.freebsd-questions@freebsd.org> <20140619130115.M609@sola.nimnet.asn.au> <53A27C2A.3040501@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 19 Jun 2014 06:59:06 +0100, Matthew Seaman wrote:

 > There will be pkg(8) packages on the DVD installer images.  If that
 > didn't work for you when installing 10.0 that's a bug.  You know that
 > all supported branches have the default package repositories enabled now
 > (including 8.4-RELEASE and 9.2-RELEASE)?  Do you also know how to turn
 > that off? Like this:
 > 
 >   echo 'FreeBSD: { enabled: no}' > /usr/local/etc/pkg/repos/FreeBSD.conf
 > 
 > That should solve the problem with your systems wanting to connect to
 > the net.  However, that 'install packages  from installation media'
 > thing really should just work.

[Devin, I'm hoping you've read this thread to date, rambling and all]

After many hours digging through the bsdinstall and bsdconfig files from 
FreeBSD-10.0-RELEASE-amd64-dvd1-memstick.img - made from and having the 
same contents as FreeBSD-10.0-RELEASE-amd64-dvd1.iso - I'm pretty sure 
I've found the problem.

In /usr/share/bsdconfig/packages/index.subr (tabs lost):
        #
        # Generate $PACKAGESITE variable for pkg(8) based on media type
        #
        local __type __data __site
        device_media get type __type
        device_media get private __data
        case "$__type" in
        $DEVICE_TYPE_DIRECTORY)
                __site="file://$__data/packages/$PKG_ABI" ;;
        $DEVICE_TYPE_FLOPPY)
                __site="file://${__data:-$MOUNTPOINT}/packages/$PKG_ABI" ;;
        $DEVICE_TYPE_FTP)
                f_getvar $VAR_FTP_PATH __site
                __site="$__site/packages/$PKG_ABI" ;;
        $DEVICE_TYPE_HTTP)
                f_getvar $VAR_HTTP_PATH __site
                __site="$__site/$PKG_ABI/latest" ;;
        $DEVICE_TYPE_HTTP_PROXY)
                f_getvar $VAR_HTTP_PROXY_PATH __site
                __site="$__site/packages/$PKG_ABI" ;;
        $DEVICE_TYPE_CDROM)
                __site="file://$MOUNTPOINT/packages/$PKG_ABI"
                export REPOS_DIR="$MOUNTPOINT/packages/repos" ;;
        *) # UFS, DISK, CDROM, USB, DOS, NFS, etc.
                __site="file://$MOUNTPOINT/packages/$PKG_ABI"
        esac

        export PACKAGESITE="$__site"
        f_dprintf "PACKAGESITE=[%s]" "$PACKAGESITE"
        if ! f_eval_catch $__funcname pkg "pkg update"; then
                f_show_err "$msg_unable_to_update_pkg_from_selected_media"
                f_device_shutdown media
                return $FAILURE
        fi

.. which I recall being the (last?) error message I received.  Note that 
unless the media is _detected_ as $DEVICE_TYPE_CDROM, REPOS_DIR is not 
exported as $MOUNTPOINT/packages/repos, so pkg(8) uses its default:

# $FreeBSD: release/10.0.0/etc/pkg/FreeBSD.conf 258710 2013-11-28 14:24:26Z gjb $
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}

.. as it normally would for USB media, assuming this to be a normal 
-memstick.img install, or any of the other media types _selected_ in a 
post-install environment, expecting no packages to be on the media.

dvd1_mnt/packages:
total 2
drwxr-xr-x  2 root  wheel  512 Jan 17 10:22 repos
drwxr-xr-x  3 root  wheel  512 Jan 17 10:22 freebsd:10:x86:64

dvd1_mnt/packages/repos:
total 1
-rw-r--r--  1 root  wheel  285 Jan 17 10:22 FreeBSD_install_cdrom.conf

dvd1_mnt/packages/freebsd:10:x86:64:
total 331
drwxr-xr-x  2 root  wheel   30208 Jan 17 10:22 All
-rw-r--r--  1 root  wheel  253632 Jan 17 10:22 packagesite.txz
-rw-r--r--  1 root  wheel   45496 Jan 17 10:22 digests.txz

dvd1_mnt/packages/freebsd:10:x86:64/All:
total 1688417
-rw-------  1 root  wheel    2070008 Jan  7 02:36 pkg-1.2.4_1.txz
[..]

.. where I needed /packages/repos/FreeBSD_install_cdrom.conf containing:

# $FreeBSD: release/10.0.0/release/scripts/FreeBSD_install_cdrom.conf 259534 2013-12-18 01:27:30Z gjb $
#
# The pkg(8) repository configuration file for the installation DVD.
#
FreeBSD_install_cdrom: {
  url: "file:///dist/packages/${ABI}",
  mirror_type: "none",
  enabled: yes
}

Disabling /etc/package/FreeBSD.conf won't cut it; in this instance we 
need to export REPOS_DIR="$MOUNTPOINT/packages/repos" also so pkg(8) 
knows where to look.

I could just patch that line in /usr/share/bsdconfig/packages/index.subr 
while making the dvd1-memstick.img, but I'm hoping that Devin will come 
up with something more elegant .. hopefully this might work for 9.3-R?

Perhaps? just something as crude as, or along the lines of:

	*) # UFS, DISK, CDROM, USB, DOS, NFS, etc.
		__site="file://$MOUNTPOINT/packages/$PKG_ABI"
 		if [ `du -d1 $MOUNTPOINT/packages` -gt $SOMESIZE ]; then
			# there are significant packages on this media
			export REPOS_DIR="$MOUNTPOINT/packages/repos"			
		fi ;;

.. which would allow the use of packages on any of those media types as 
an alternative to using the online repository - maybe optionally? - but 
at least we (royal plural :) need it for dvd1_to_memstick.sh usage.

cheers, Ian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140620033957.B609>