Pkg 1.4.0 and packaging base system

Jean Milanez Melo jmelo at freebsdbrasil.com.br
Wed Dec 17 12:52:50 UTC 2014


I don’t know if it helps you but i’ve been packing base since FreeBSD 10.0:

# pkg info | grep freebsd
freebsd-base-10.1            FreeBSD Base Package
freebsd-kernel-10.1            FreeBSD Kernel Package

My purpose was create a simple way to deploy updates to my customers with both a custom base and kernel. The way i’m doing is quite simple, but it fits what i need.

I didn’t split base system, but the concept would be the same.  First i use a “release" machine to build world after each update. Then i just point to installworld on a different place, like tmp: make installworld DESTDIR=/tmp/world.

Then i compress everything in /tmp/world as freebsd-base.tar.gz.

My port is like this:

PORTNAME=	freebsd-base
PORTVERSION=	10.1
CATEGORIES=	custom
MASTER_SITES=	#
DISTFILES=	#
EXTRACT_ONLY=	# NONE

MAINTAINER=	jmelo at freebsdbrasil.com.br
COMMENT=	FreeBSD Base Package

NO_MTREE=	yes

SUB_FILES=	pkg-install

NO_BUILD=	yes
NO_WRKSUBDIR=	yes

do-install:
	mkdir -p ${STAGEDIR}${DATADIR}
	@${CP} -r ${FILESDIR}/versions ${STAGEDIR}${DATADIR}/

post-install:
	${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL

.include <bsd.port.mk>

My pkg-plist:

%%DATADIR%%/versions/freebsd-base.sh
%%DATADIR%%/versions/freebsd-base.tar.gz
@dirrmtry %%DATADIR%%/versions
@dirrmtry %%DATADIR%%

In my files dir i have pkg-install.in to PKGINSTALL script execution:

#!/bin/sh

if [ $2 = "POST-INSTALL" ]; then

	for i in `ls  %%DATADIR%%/versions/*.sh` ; do
		sh $i
	done

fi

And freebsd-base.sh contents:

#!/bin/sh
SHAREDIR=/usr/local/share/freebsd-base


		chflags -R nosunlink,noschg /usr/bin /usr/games /usr/include /usr/lib* /usr/sbin /usr/share /lib /bin /sbin /lib /libexec /rescue  > /dev/null 2>&1
		tar zxfvp ${SHAREDIR}/versions/freebsd-base.tar.gz -C / > /dev/null 2>&1
		rm ${SHAREDIR}/versions/freebsd-base.tar.gz > /dev/null 2>&1
		
And finally i add freebsd-base.tar.gz generated on my “release machine” in my versions directory. 

Then just build freebsd-base package using poudriere and make it available for who is using your repository. 

As i said, it's quite simple, but works. Maybe the concept would be used by pkg team. Bryan, if there is something i can help let me know.

> Em 16/12/2014, à(s) 23:16, Bryan Drewery <bdrewery at FreeBSD.org> escreveu:
> 
> On 12/16/2014 5:41 PM, Cassiano Peixoto wrote:
>> Hi guys,
>> 
>> Some weeks ago i read an email sent by bapt about new features to pkg 1.4.0
>> release. One of them was about packaging base system. As 1.4.0 has
>> been releases i'd like know if this feature is already available.
>> 
> 
> The short answer is "no".
> 
> The longer answer is that it is almost trivial to package the base
> system. There are issues with upgrading though with handling config
> files (1.4.0 addresses this). However, even with that, there is no work
> available that you can test for a comprehensive build+install+upgrade
> packaged base. There remains a lot to do this "right" and consider the
> whole picture. There's the issue of splitting up base into components,
> conflicting packages between base and ports, freebsd-update, Security
> Advisories, etc. There's a lot more work to be done IMHO.
> 
> 
> -- 
> Regards,
> Bryan Drewery
> 

--
Atenciosamente
Jean Milanez Melo
FreeBSD Brasil LTDA
Fone: (31) 3516-0800
http://www.freebsdbrasil.com.br <http://www.freebsdbrasil.com.br/>





More information about the freebsd-ports mailing list