From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 13 21:54:27 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 596FF106566C; Thu, 13 Mar 2008 21:54:27 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from cp65.agava.net (cp65.agava.net [89.108.66.215]) by mx1.freebsd.org (Postfix) with ESMTP id C52DC8FC12; Thu, 13 Mar 2008 21:54:26 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from [213.148.20.85] (helo=hive.panopticon) by cp65.agava.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1JZudL-000IsC-VY; Fri, 14 Mar 2008 00:06:40 +0300 Received: from hades.panopticon (hades.panopticon [192.168.0.32]) by hive.panopticon (Postfix) with ESMTP id E59176E94; Fri, 14 Mar 2008 00:02:00 +0300 (MSK) Received: by hades.panopticon (Postfix, from userid 1000) id 572E01702F; Fri, 14 Mar 2008 00:02:42 +0300 (MSK) Date: Fri, 14 Mar 2008 00:02:42 +0300 From: Dmitry Marakasov To: Ivan Voras Message-ID: <20080313210242.GA55395@hades.panopticon> Mail-Followup-To: Ivan Voras , freebsd-ports@freebsd.org, freebsd-hackers@freebsd.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cp65.agava.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [26 6] X-AntiAbuse: Sender Address Domain - amdmi3.ru X-Source: X-Source-Args: X-Source-Dir: Cc: freebsd-hackers@freebsd.org, freebsd-ports@freebsd.org Subject: Re: Transferring ports X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Mar 2008 21:54:27 -0000 * Ivan Voras (ivoras@freebsd.org) wrote: > I have an idea and a request for people familiar with ports & pkgdb > infrastructure: a utility (preferably written in C, Python or as a shell > script) that would transfer *installed* ports from one system tree to > the other, including their dependencies. It would transfer only some > ports, specified on the command line. There's no way to do it clearly. Not only such utility will have to deal with dependencies anyway, but also there are ports that do more than just copy files on installation (such as registering uids/gids, handling user-modified configs nicely etc.). > The details: imagine there are two or more full FreeBSD installation > trees in the file system (e.g. complete jails). The utility would > transfer (installed) packages from one tree to the other. The easy, > brute-force way would be to generate package files (tbz) from the > installed tree and then install them to the other tree, but I can't do > that because of performance and disk space reasons. I think that the easiest and most correct way will be to use packages. You can share packages/ directory between jails via nullfs (or between hosts via nfs) - single set of packages surely will take no more space than a single set of installed ports in a jail. And the only performance overhead is bzipping a package one time and bunzipping number_of_jails times. And actually, what you want is done pretty easily, like this: JAIL=/path/to/target/jail pkg_info -q -L [...] | while read file; do mkdir -p $JAIL/`dirname "$file"` cp -pP "$file" $JAIL/"$file" done (this is just a scratch, use with care) > Is there a utility that would do that, and if not, does anyone have the > time to write one? Actually, I've already had an idea of utility with pretty similar functionality for a long time. The utility would copy directory hierarchies recursively based on file include/exclude list, like this: +/{etc,bin,sbin,lib} +/usr -/usr/local +/usr/local/{bin,sbin,libexec,share,lib} -/usr/share/locale +/usr/share/locale/ru_RU* so `my_cool_copy_utility / /path/to/jail` will copy /etc,/bin,/sbin,/lib and /usr dirs to jail, but in /usr/share/locale will only copy russian locales, but no others, and in usr/local it won't copy man, include and other dirs not needed in a jail. The purpose is similar - creating jails out of host system in fast and easy way, possibility to strip everything unneeded (useful for secure minimal jails or flash/livecd/embedded installations of minimal size) and add something extra, like stuff from /usr/local without installing full packages in a jail, or, say, copying over additional tree of jail-specific changes (mostly stuff under /etc and /usr/local/etc). Such an utility is something I still might start working on. -- Dmitry A. Marakasov | jabber: amdmi3@jabber.ru amdmi3@amdmi3.ru | http://www.amdmi3.ru