Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Feb 2005 10:42:04 -0600
From:      Scot Hetzel <swhetzel@gmail.com>
To:        Ion-Mihai Tetcu <itetcu@people.tecnik93.com>
Cc:        ports@freebsd.org
Subject:   Re: @unexec equivalent in Makefile ?
Message-ID:  <790a9fff050216084266bb5a40@mail.gmail.com>
In-Reply-To: <20050216154212.55c3fe88@it.buh.cameradicommercio.ro>
References:  <20050216154212.55c3fe88@it.buh.cameradicommercio.ro>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 16 Feb 2005 15:42:12 +0200, Ion-Mihai Tetcu
<itetcu@people.tecnik93.com> wrote:
> Hi,
> 
> I have a port that installs 8 files (3 of them being PORTDOCS), so I
> rather not use a pkg-plist file. But I need to remove a .conf file on
> deinstall if it's identical to the distributed one, and I'm not aware of
> a way to do it in the Makefile; we don't have pre|post-deinstall targets
> and using a pkg-deinstall doesn't make sense just for this.
> 
You don't need to worry about deinstall targets in the Makefile, as
pkg_delete is called to remove your port.

Just place an @unexec to remove the file in the ports pkg-plist, for
example the www/apache13 port has the following 3 lines for it's
etc/apache/access.conf file:

@unexec if cmp -s %D/etc/apache/access.conf
%D/etc/apache/access.conf-dist; then rm -f %D/etc/apache/access.conf;
fi
etc/apache/access.conf-dist
@exec [ -f %B/access.conf ] || cp %B/%f %B/access.conf

You just need to make your port install the *.conf-dist file, and then
test if the *.conf file(s), and create them if they don't exist, in
the Makefile's post-install target:

post-install:
.for conffile in test.conf test2.conf
    if [ ! -f ${PREFIX}/etc/${conffile} ]; then \
        cp ${PREFIX}/etc/${conffile}-dist ${PREFIX}/etc/${conffile} ; \
    fi
.endfor

Scot



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?790a9fff050216084266bb5a40>