Pkg install from release CD using FreeBSD provided repo

Peter Ross Peter.Ross at alumni.tu-berlin.de
Fri Feb 14 04:29:04 UTC 2014


Hi,

after having a +1 from a German mailing list and the suggestion to send it 
to the appropriate mailing list (I think freebsd-ports is the one?)

a suggestion for the installation from CD

1. Include a local binary way to install pkg
2. Ask for a proxy server when setting up a new FreeBSD machine
   (write it in the environment section of pkg.conf
    as well as setting the http_proxy environment variable)
3. Ask whether you want to use binary packages and write a FreeBSD.conf
   for the appropriate repository to download from
4. Download the content from the repo at the first pkg command so
   commands as "pkg search" work immediately.

Point 2, 3 and 4 sound quite "trivial", I think, it is more of whether it 
is the right way to do.

For step 1 I provide a "minimal ports tree" with all what's needed to 
compile pkg. See below for details.

I suggest it after my own install experience for FreeBSD 10.0. I am a 
sysadmin who is using the ports collection for our servers,

whoever, this time I wanted to try a binary install for a desktop, I found 
it too cumbersome, as a novice I would have given up..

Sitting in the office (and behind a firewall and having a proxy) I wanted 
to setup a new desktop.

Shiny new pkg tools - better than apt.. cool! Yes, it works well, much 
better than the old stuff. Thanks!

Okay, do I need ports? No (I think - I want binaries). I just use pkg 
afterwards. Good.

Problem 1: pkg is just the stub.. and wants to get it from a FreeBSD 
server.. well - stuck (the firewall)

Well, I guess "http_proxy=..; export http_proxy" may help - yes, it does. 
(But I am a sysadmin - what if I do not have this knowledge?)

Problem 2: "pkg search perl" - nothing.

Google, google.. okay, the announcement and writing a repository 
configuration.

Problem 3: ""pkg search perl" - still no output.

pkg repo/upgrade/update/updating.. all: no.

Looking at the repo website: Yes, it's there.

"pkg install 0verkill" (the first package I see - magic, it downloads the 
repository content and more, and now "pkg search" and others work!

Thay are all problems you can solve. But I do not think they should be the 
first FreeBSD experience.

Another mailing list member had a similar disappointing start with FreeBSD 
10.

Hence the suggestion above.

What do you think?

Sorry if I am stirring the pot again.. I found some "mails related to the 
pkg stub but I did not find something similar to my suggestion.

I am happy for any other way that may prevent an experience as I just had.

Here my workaround to bootstrap ppkg locally (tested for FreeBSD 9):

1. create_pkg_bootstrap.sh

# Creates bootstrap package used by add_packages.sh

# Assumes succesful pkg build in ports tree
# Parameter: pkg name (pkg-${version})

if [ "X${1}" = "X" ]; then
    echo "Please specify pkg name (pkg-version)"
    exit 1
fi

cd /usr/ports
rm -f /usr/ports/ports-mgmt/pkg/work/.install_done.pkg._usr_local
tar -czf /usr/ports/packages/$1.tgz ports-mgmt/pkg Mk \
Templates/BSD.local.dist Tools/scripts/security-check.awk

2. Use the pkg tar ball to install pkg

bootstrap_pkg()
{
       echo "Bootstrap pkg"
       tmp_ports_dir=`mktemp -d /tmp/${APP}.ports.XXXXXX`
       cd ${tmp_ports_dir}
       tar -xzvf /usr/ports/packages/pkg*.tgz
       cd ports-mgmt/pkg
       make install PORTSDIR=${tmp_ports_dir}
       echo "Packages installed: "
       pkg info -a
       rm -rf ${tmp_ports_dir}
}

I am pretty sure that may need some polish before it can grace an official 
installation CD (or there is something better).. but it may be a starting 
point.

Regards
Peter


More information about the freebsd-ports mailing list