Question about optional setting of symbolic links

Jonathan Weiss tomonage2 at gmx.de
Mon Jan 10 14:21:46 PST 2005


> On Fri, Jan 07, 2005 at 04:14:34PM +0100, Jonathan Weiss wrote:
>> Hi folks,
>> 
>> 
>> I'm working on a port of foomatic-filters and I want to optionaly set up a
>> symbolic link if CUPS-support is wanted (in order to register foomatic-rip
>> as a filter for cups).
>> 
>> How do I do this?
>> 
>> I looked through the porters handbook and could not find something to
>> symbolic links.
>> 
>> I want to do something like this:
>> 
>> #.if defined(WITH_CUPS)
>> #ln -s /usr/local/bin/foomatic-rip
>> /usr/local/libexec/cups/filter/foomatic-rip
>> #.endif
>> 
>> How do I remove this link later?
> 
> Put it in your plist if you create it.  You could also use pkg-install
> and deinstall scripts to create it if ${LOCALBASE}/libexec/cups/filter/
> exists and destroy it if it exists when you uninstall.  The nice thing
> about that is that the package works without requiring that you depend
> on CUPS.
>
> -- Brooks

My makefile now looks like this:

-----------------------------------------
# New ports collection makefile for:    foomatic-filters
# Date created:                         4 January 2005
# Whom:                                 Jonathan Weiss <tomonage2 at gmx.de
#
# $FreeBSD$
#.if defined(WITH_CUPS)
#${INSTALL_SCRIPT} ${WRKSRC}/foomatic-rip ${PREFIX}/bin/foomatic-22
#ln -s /usr/local/bin/foomatic-rip
/usr/local/libexec/cups/filter/foomatic-rip
#.endif


#

PORTNAME=       foomatic-filters
PORTVERSION=    3.0.2
CATEGORIES=     print
MASTER_SITES=   http://www.linuxprinting.org/download/foomatic/

MAINTAINER=     tomonage2 at gmx.de
COMMENT=        A system for integrating printer drivers with common
spoolers


MAN1=           foomatic-rip.1 foomatic-gswrapper.1
PLIST_FILES=    bin/foomatic-rip etc/filter.conf.example
bin/foomatic-gswrapper

GNU_CONFIGURE=          yes
USE_PERL5=              yes

CONFIGURE_ARGS+=        --prefix=${PREFIX} \
                        --sysconfdir=${PREFIX}/etc

do-install:
        ${INSTALL_SCRIPT} ${WRKSRC}/foomatic-rip ${PREFIX}/bin
        ${INSTALL_SCRIPT} ${WRKSRC}/foomatic-gswrapper ${PREFIX}/bin
        ${INSTALL_DATA} ${WRKSRC}/filter.conf
${PREFIX}/etc/filter.conf.example
        ${INSTALL_MAN} ${WRKSRC}/foomatic-rip.1 ${PREFIX}/man/man1
        ${INSTALL_MAN} ${WRKSRC}/foomatic-gswrapper.1 ${PREFIX}/man/man1
        @if [ -d ${LOCALBASE}/libexec/cups ]; then
\
                ${ECHO} "########################################" ;  \
                ${ECHO} "CUPS detected!" ;  \
                ${ECHO} "Installing foomatic-rip as a cups-filter" ;  \
                ${ECHO} "########################################" ;  \
                /bin/ln -s ${PREFIX}/bin/foomatic-rip
${LOCALBASE}/libexec/cups/filter/foomatic-rip ;  \
        fi

.include <bsd.port.mk>
-----------------------------------------

And my pkg-deinstall script like this:
-----------------------------------------
#!/bin/sh

if [ "$2" != "POST-DEINSTALL" ]; then
    exit 0
fi

if [ -h ${PKG_PREFIX}/libexec/cups/filter/foomatic-rip ]; then  \
        echo "#########################################" ; \
        echo "Deleting foomatic-rip as a cups-filter..." ; \
        echo "#########################################" ; \
        /bin/rm ${PKG_PREFIX}/libexec/cups/filter/foomatic-rip ; \
        exit 0; \ 
fi
-----------------------------------------

Is it ok like this?


Cheers,
Jonathan




More information about the freebsd-ports mailing list