From owner-freebsd-questions@FreeBSD.ORG Tue Jan 24 13:39:58 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B515106564A for ; Tue, 24 Jan 2012 13:39:58 +0000 (UTC) (envelope-from max@mxcrypt.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id F391C8FC08 for ; Tue, 24 Jan 2012 13:39:57 +0000 (UTC) Received: by vbbfa15 with SMTP id fa15so887503vbb.13 for ; Tue, 24 Jan 2012 05:39:57 -0800 (PST) Received: by 10.52.88.144 with SMTP id bg16mr1068502vdb.64.1327412397355; Tue, 24 Jan 2012 05:39:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.118.144 with HTTP; Tue, 24 Jan 2012 05:39:26 -0800 (PST) In-Reply-To: References: <4F1DA620.4040207@infracaninophile.co.uk> From: Maxim Khitrov Date: Tue, 24 Jan 2012 08:39:26 -0500 Message-ID: To: freebsd-questions@freebsd.org X-Gm-Message-State: ALoCoQluazYj+mfp2cJ6u8x5gatSVctWpYatdf6uxNh+ogrr39khjAYpVgd56c8bJxkpbUF81on8 Content-Type: text/plain; charset=UTF-8 Subject: Re: Applying local patches after updating FreeBSD source X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2012 13:39:58 -0000 On Mon, Jan 23, 2012 at 2:13 PM, Maxim Khitrov wrote: > On Mon, Jan 23, 2012 at 1:25 PM, Matthew Seaman > wrote: >> On 23/01/2012 18:03, Maxim Khitrov wrote: >>> Hi all, >>> >>> When I need to apply a custom patch to a port, I can set EXTRA_PATCHES >>> make variable in /usr/local/etc/ports.conf (when using portconf), and >>> the patch will be automatically applied whenever that port is built. >>> Is there equivalent functionality for building FreeBSD world and >>> kernel? >>> >>> When I run 'make update' in /usr/src, csup overwrites all local >>> changes. There is a LOCAL_PATCHES variable, but it seems to apply only >>> to 'make release'. >>> >>> If possible, I would like to avoid writing custom scripts for updating >>> and building world, because at some point I will forget to use the >>> script and build everything without the patches. How can I preserve >>> the current behavior of running 'make update && make buildworld >>> buildkernel' while automatically applying custom patches in between? >> >> Check the system sources out of svn? >> >> This way, you can apply your patches and the result is automatically >> merged when you update the sources by 'svn up' -- unless there has been >> a conflicting commit to the same file, when you may be required to >> intervene manually. > > I don't have subversion installed on any of my servers and that's a > dependency that I would prefer to do without. > > Are there any changes I could make to /etc/make.conf that would allow > me to execute an arbitrary command after the 'update' task is > finished? > > - Max For anyone else that might be interested in doing this, the solution is to create a shell script that is executed instead of csup when running 'make update'. The script to execute is specified in /etc/make.conf: SUP=/root/bin/csup-src I'm pretty sure that this is safe to do. Just in case, the script checks the current working directory to make sure that patches are only applied when updating /usr/src. You could also perform this check in make.conf. The script template is below. Feel free to adapt it for your own needs. ---- #!/bin/sh /usr/bin/csup "$@" || exit test "`pwd`" = '/usr/obj/usr/src' || exit 0 cd /usr/src echo '--------------------------------------------------------------' echo '>>> Applying local patches' echo '--------------------------------------------------------------' # ---- - Max