|
FreeBSD Ports and Packages Installation and upgrading of ports and packages on FreeBSD. |
|
Thread Tools | Display Modes |
|
||||
setting $PKGDIR screws up port installations
I just switched my laptop from PC-BSD 1.5.1.x to FreeBSD 7.0-Release and I noticed something odd.
I setenv PKGDIR to a safe spot and went about installing packages and ports through a shell script but, when it tried to install some apps via ports with PKGDIR set, they would barf pkg-descr not found style messages. Doing it by hand using makes -i/-k switches things worked (but probably not smart), things also worked perfectly *normal* when the PKGDIR environment variable was not set when I went to install individual ports. I found this kinda odd because I don't recall the ports(7) manual saying it honoured PKGDIR. However, /usr/ports/*.mk has a concept of ${PKGDIR}/pkg-* when looking for files such as pkg-descr, pkg-plist, and such. Grr !
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|||
I do this the following way since 5.1 with no hassle
file:/etc/fstab Code:
/space2/ports /usr/ports nullfs rw,noatime 0 0 Code:
PORTSDIR=/space2/ports Code:
PACKAGES?= /space1/packages WRKDIR?= /build_space/PORTBUILD/${PORTNAME}_${PORTVERSION} DISTDIR?= /big_space/distfiles .if ${HOSTNAME} != "MachineWithAllTheDistfiles" MASTER_SITE_BACKUP=ftp://MachineWithAllTheDistfiles/pub/distfiles/${DIST_SUBDIR}/ MASTER_SITE_OVERRIDE?=${MASTER_SITE_BACKUP} .endif So i have one central machine that updates every subscribed machine with rsync and portsnap gets all installed ports with the command # pkg_info -qoa and fetch new distfiles from all collected ports |
|
||||
Snippet from my /etc/make.conf
PORTSDIR=/data/fbsd/ports/ WRKDIRPREFIX=/sandbox/obj/ DISTDIR=/data/distfiles/ PACKAGES=/data/fbsd/packages/ I prefer to set WRKDIRPREFIX to WRKDIR as some sourrces are sensitive. /sandbox and /data are slices /sandox is just that, I can newfs the whole slice fatster than a make clean In fact, I share those slices. My OpenBSD /etc/mk.conf snippet : PORTSDIR=/data/obsd/ports DISTDIR=/data/distfiles PACKAGE_REPOSITORY=/data/obsd/packages44 PKG_CACHE=/data/obsd/packages44 WRKOBJDIR=/sandbox/pobj MAKEOBJDIR=/sandbox/sobj XSRCDIR=/data/obsd/xenocara XOBJDIR=/sandbox/xobj
__________________
da more I know I know I know nuttin' |
|
||||
Quote:
When I first planned out the operation, I checked the manual for two reasons: 0/ What environment variable controls where packages can be saved? -- found 1/ What environment variables effect port builds -- found but incomplete When I have issues with ports, I just go to the Makefiles and trace my fingers along the code until I find my way. In this case, I was adding packages in sequence via bourne shell script and stopping to install ports in a sub shell when necessary (no package available or out of date). And found no logical reason to poke around the ports systems internal makefile, since I would naturally look in the end user documentation on orts and pkg_* for how to avoid shooting myself in the foot with environment variables ^_^ My systems almost fully operational and ready to rock & roll. Just a few more things to install via ports (with PKGDIR unset) and a kernel to compile and volia. While the saved packages get off loaded to be placed in cold storage in, just in case I need a backup of 4 hours worth of fetching at a later date .
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
||||
OK!
With pkg_add you may define an alternative directory PKGDIR to save the packages to. While PKG_PATH is where pkg_add expects to find the packages. The value of the PKG_PATH is used if a given package cannot be found. The environment variable should be a series of entries separated by colons. Each entry consists of a directory name. Hence, $PKGDIR has to be added (or prepended) to the directories list, default /usr/ports/packages. Why use an alternative to PKG_PATH ? Errr ... Yup! PKGDIR can be a CDROM, files saved rw to PKG_PATH, PKGDIR a ro CDROM, or the other way, and vice versa. While PACKAGESITE should be set to a "mirror_close_to_you" for remote install. PACKAGESITE only understands URL and fetch, while PKG_PATH only reads directories. Now I understand why there is a subdirectory /usr/ports/ports-mgmt in FreeBSD tree. Yeesh! Glad my default OS is OpenBSD
__________________
da more I know I know I know nuttin' Last edited by lvlamb; 26th June 2008 at 10:45 PM. |
|
||||
PKGDIR has different meanings for ports and packages.
From /usr/ports/Mk/bsd.port.mk Code:
# PKGDIR - A directory containing any package creation files. # Default: ${MASTERDIR} [...] PATCHDIR?= ${MASTERDIR}/files FILESDIR?= ${MASTERDIR}/files SCRIPTDIR?= ${MASTERDIR}/scripts PKGDIR?= ${MASTERDIR} [...] DESCR?= ${PKGDIR}/pkg-descr PLIST?= ${PKGDIR}/pkg-plist PKGINSTALL?= ${PKGDIR}/pkg-install PKGDEINSTALL?= ${PKGDIR}/pkg-deinstall PKGREQ?= ${PKGDIR}/pkg-req PKGMESSAGE?= ${PKGDIR}/pkg-message [...] If you want to use a different package directory for ports, use PACKAGES. Code:
# PACKAGES - A top level directory where all packages go (rather than # going locally to each port). # Default: ${PORTSDIR}/packages Code:
[/usr/src/usr.sbin/pkg_install]% find . -type f -exec grep -H PKGDIR {} \; ./add/pkg_add.1:.Ev PKGDIR ./add/pkg_add.1:.Ev PKGDIR ./info/pkg_info.1:.Ev PKGDIR ./info/pkg_info.1:.It Ev PKGDIR ./lib/url.c: tmp = getenv("PKGDIR"); Code:
if (keep_package) { tmp = getenv("PKGDIR"); strlcpy(pkg, tmp ? tmp : ".", sizeof(pkg)); tmp = basename(fname); strlcat(pkg, "/", sizeof(pkg)); strlcat(pkg, tmp, sizeof(pkg)); if ((pkgfd = open(pkg, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1) { printf("Error: Unable to open %s\n", pkg); perror("open"); return NULL; } } I know, this is not the best design choice ... And maybe renaming one of the variables might be a good idea...
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. |
|
||||
or adding it to the bloody manual page along with any friends it might have ;-)
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Setting up nameservers | paran0iaX | OpenBSD General | 11 | 13th March 2009 12:16 PM |
getting and setting time from router | michaelrmgreen | General software and network | 1 | 5th February 2009 01:58 PM |
help for setting ezjail? | bgobs | FreeBSD General | 13 | 15th June 2008 10:50 AM |
Setting Up MPD | benjgvps | FreeBSD General | 0 | 21st May 2008 12:20 PM |
thanks for setting this up | DraconianTimes | Off-Topic | 8 | 5th May 2008 08:14 AM |