From owner-freebsd-questions@FreeBSD.ORG Tue Oct 8 11:12:49 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 5BB4EC7B for ; Tue, 8 Oct 2013 11:12:49 +0000 (UTC) (envelope-from ftp51246-2575596@sh4-5.1blu.de) Received: from sh4-5.1blu.de (sh4-5.1blu.de [178.254.11.41]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 234AB293A for ; Tue, 8 Oct 2013 11:12:48 +0000 (UTC) Received: from ftp51246-2575596 by sh4-5.1blu.de with local (Exim 4.76) (envelope-from ) id 1VTVH0-00047I-Pl for freebsd-questions@freebsd.org; Tue, 08 Oct 2013 13:16:18 +0200 Date: Tue, 8 Oct 2013 13:16:18 +0200 From: Matthias Apitz To: freebsd-questions@freebsd.org Subject: install packages with pkg_add(1) into another file system Message-ID: <20131008111618.GA9957@sh4-5.1blu.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: FreeBSD 7.0-RELEASE (i386) User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Matthias Apitz List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Oct 2013 11:12:49 -0000 Hello, I have prepared a boot-able USB-key (to be exactly a disk image of it) the usual way: # dd if=/dev/zero of=da0 bs=8m count=1868 # mdconfig -a -t vnode -f da0 md0 # fdisk -I md0 # fdisk -B md0 # bsdlabel -w md0s1 auto # bsdlabel -B md0s1 # bsdlabel -e md0s1 # edit the disk label and change partition "a" from "unused" to "4.2BSD" # newfs /dev/md0s1a # mount /dev/md0s1a /mnt # cd /usr/src now we can install world an kernel: # make installworld DESTDIR=/mnt # make installkernel DESTDIR=/mnt KERNCONF=GENERIC INSTALL_NODEBUG=t # make distrib-dirs DESTDIR=/mnt # make distribution DESTDIR=/mnt ... I have compiled ~800 ports (Xorg and KDE4) and after this I've created packages of all the installed ports with pkg_create(1); the resulting xxxx.tgz files are all as well copied to the image into /mnt/PKGDIR. So far so good. Now I want install the packages as well into the image in /mnt. What would be the best method for this? Run pkg_add with the flag --chroot chrootdir, or use chroot(8) directly? Or any other idea? Thanks in advance All this is with 10-CURRENT (base and ports). matthias -- Matthias Apitz | /"\ ASCII Ribbon Campaign: www.asciiribbon.org E-mail: guru@unixarea.de | \ / - No HTML/RTF in E-mail WWW: http://www.unixarea.de/ | X - No proprietary attachments phone: +49-170-4527211 | / \ - Respect for open standards