FreeBSD – How to use Meta Ports to install group of ports

bsd-daemon-logo


Often, after a fresh new installation of FreeBSD, we have a set of programs we want to install. The conventional method would be installing it one by one in /usr/ports. Today, we will use meta ports to install the set of applications by just one “make install clean” rather then “cd” into individual directories and do “make install clean” for every ports.


Meta ports are, as the name implies, ports file that describe about the program we are installing. The ports file describe where & what to install for this ports to work. A sample of “where” would be “where to download the source“, “where to install it” and so on. As for “what“, it would be “what to install to fulfill the dependencies“. In this post, we will take advantage of this “what“. We will define the dependencies as the list of programs we want to install so that the ports will install it.


This is an example of how to do it :


In this example, the meta ports named “listport” will install “bash“, “vim“, “unzip” and “rsync” :

1. Make a temporary directory for the meta ports :

mkdir ~/listport;cd ~/listport

2. Create a file call “Makefile”, include the following as contents :

# list of ports
# 20090825

PORTNAME=       listport
PORTVERSION=    1.0
CATEGORIES=     misc

MASTER_SITES=
DISTFILES=

MAINTAINER=     psybermonkey

RUN_DEPENDS=bash:${PORTSDIR}/shells/bash 
RUN_DEPENDS=vim:${PORTSDIR}/editors/vim 
RUN_DEPENDS=unzip:${PORTSDIR}/archivers/unzip 
RUN_DEPENDS=rsync:${PORTSDIR}/net/rsync 

NO_WRKSUBDIR=   YES
NO_BUILD=       YES

do-install:

.include <bsd.port.mk>

3. Create a file call “pkg-descr” and put some description in it.

4. Install the meta ports :

make install clean


After the list of ports have successfully installed, remove the meta ports :

1. Remove the temporary directory :

rm -rf ~/listport

2. Un-install the meta ports :

pkg_delete listport-1.0


During the process of un-installing the meta ports, error messages similar to below might appear :

pkg_delete: couldn't open dependency file /var/db/pkg/sudo-1.6.3.7_2/+REQUIRED_BY'

Ignore the error.


Ciao !!!

More post - related

Please sponsor my coffee if you find my posts worth reading, thanks!

3 Comments

  1. Posted August 30, 2009 at 14:57 | Permalink

    Nice trick!

  2. Posted September 4, 2009 at 13:10 | Permalink

    “Makefile”, line 23: .include filename must be delimited by ‘”‘ or ‘<'
    make: fatal errors encountered — cannot continue

  3. Posted September 5, 2009 at 00:37 | Permalink

    Hi Edmondas,
    Glad you like it. Thanks for submitting this post to FreeBSD News . I hope everyone over there enjoy it. :)

    Hi Jason,
    There was some text miss out after the “.include” parameter in the “Makefile” which i have fixed. Please try to copy the text and create the Makefile then run it again and see if it works. Do let me know if some thing breaks again. :p

2 Trackbacks

  1. By Metaportų kūrimas | FreeBSD.lt on August 30, 2009 at 15:01

    [...] Plačiau [...]

  2. [...] The conventional method would be installing it one by one in /usr/ports. Today, we will use meta ports to install the set of applications by just one “make install clean” rather then “cd” into individual directories and do [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*
-->
Improve the web with Nofollow Reciprocity.