From owner-freebsd-ports@FreeBSD.ORG Wed Feb 16 16:42:06 2005 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8E76A16A4CE for ; Wed, 16 Feb 2005 16:42:06 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id EFD5F43D31 for ; Wed, 16 Feb 2005 16:42:05 +0000 (GMT) (envelope-from swhetzel@gmail.com) Received: by wproxy.gmail.com with SMTP id 69so119896wri for ; Wed, 16 Feb 2005 08:42:05 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=A51TNTcVK28jiOY/j9yd0L0yOzDUEZtNsJKoqSnQIMO60aCDIL+pnAXfQZM8Ty3zW39A2H6DgIhPBARXyDnaDwEnDn5LQ3lGE2H7pcOdZzo1xTG6aL6YB4cyMIw5UpFSKyoflMGGY58iI91397wOqONoLqIXuLFt4ghCAlSK5zQ= Received: by 10.54.45.21 with SMTP id s21mr91429wrs; Wed, 16 Feb 2005 08:42:05 -0800 (PST) Received: by 10.54.29.8 with HTTP; Wed, 16 Feb 2005 08:42:04 -0800 (PST) Message-ID: <790a9fff050216084266bb5a40@mail.gmail.com> Date: Wed, 16 Feb 2005 10:42:04 -0600 From: Scot Hetzel To: Ion-Mihai Tetcu In-Reply-To: <20050216154212.55c3fe88@it.buh.cameradicommercio.ro> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20050216154212.55c3fe88@it.buh.cameradicommercio.ro> cc: ports@freebsd.org Subject: Re: @unexec equivalent in Makefile ? X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Scot Hetzel List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Feb 2005 16:42:06 -0000 On Wed, 16 Feb 2005 15:42:12 +0200, Ion-Mihai Tetcu 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