From owner-freebsd-ports@freebsd.org Wed Jun 27 23:54:31 2018 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 592A7101EE6F for ; Wed, 27 Jun 2018 23:54:31 +0000 (UTC) (envelope-from adamw@adamw.org) Received: from mail-yw0-x22f.google.com (mail-yw0-x22f.google.com [IPv6:2607:f8b0:4002:c05::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E4C557AF60 for ; Wed, 27 Jun 2018 23:54:30 +0000 (UTC) (envelope-from adamw@adamw.org) Received: by mail-yw0-x22f.google.com with SMTP id t18-v6so1340200ywg.2 for ; Wed, 27 Jun 2018 16:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamw-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YdqVps2K9hMPstieguZqg+ezkBTY/9xIRi0N+R+y3ew=; b=i9bXJeI6Z6DpIYmOVqhOpB4bK7B2aOKshja1++QhR6sH+0+N8vdcbO5Q13jLAvpnR3 VU6m3vB4FDUb9EEnYcuAKGumMCAkIrLj565Zn3iCbSC7yCcDL+CfeAkcU9rvG58FwMhF 3rkMAjtX6H4iSf75QfTATIQ1FiEocJe9JGHPmlXlR8bLZgKV9HxYclKYdhVbjYNPpz+B 22fs6wUcCTq/lE+cIq33OET4F3FBwVgkz9xbo7GyCXdymx8DM0sAvXm5rL0pmOkFc5zM K/+ccsDSOaLCzrO5kx72cB7POPAcrKrzDX8qE/zwng+1lZTDIZqBauwkLVFqmp6CCT/9 53Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YdqVps2K9hMPstieguZqg+ezkBTY/9xIRi0N+R+y3ew=; b=umIxZ14yeW7hve7oWTtM2YnSBc07ZmYYKE9s18JUvCDrqBTTeeEcLDptS0wu5LWckv ekovqOpb2lhCktoXoGJWulu1CsyQLQ4uZ5xqbEdp7LWMvHBnNyut8sREqd+rBUAravMl ByT9uLHNChmYpc/rPnRyTa7INiHY7rdy1qsyHyafF7hkDNowCFYxelSzaSP3g+u0uxZB i/L5oyHV/QKpJsmug+5pQf0oclNAD0crpSZxcSBrdrfk0ZxuRRAC67bXRj3Xrac8lDq5 DcWbH0Sli5P5ql4fLh8a6ACdcT65K1HAEHuKb6FvR/zHlyH8M3i7r4ECYnhGe5CbO7+K La6A== X-Gm-Message-State: APt69E0+SR5cRKBkdhA0xVRmjTfbYg42R5MrvpagpogGu4rhJm7f8QmG 7FWzZochFVeL17Flg3vBdAAIz414vx2gieYGzsBRwShTv6M= X-Google-Smtp-Source: AAOMgpcntLd+A1mZREedN9WRkR9Ux3S5a+0dskgXxQUGR1T3VLOYKiTGn/NBP02XeW4Q4FfLmL/ZtrqdQJorgfjLAdo= X-Received: by 2002:a81:a614:: with SMTP id d20-v6mr4110356ywh.487.1530143670087; Wed, 27 Jun 2018 16:54:30 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Adam Weinberger Date: Wed, 27 Jun 2018 17:54:14 -0600 Message-ID: Subject: Re: Any way to prevent do-extract chmod and chown? To: jbwlists@hilltopgroup.com Cc: freebsd-ports@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2018 23:54:31 -0000 On Wed, Jun 27, 2018 at 5:09 PM Joseph Ward wrote: > > Hi everyone, > > I'm creating some internal-only ports and I'm trying to maintain the > permissions and owners of the files present in the distfile.tar.gz when > they get packaged up for install. > > When I "make extract", the "do-extract" target is performing a chmod and > chown on everything, as seen from the following excerpt from the > bsd.port.mk file: > > > .if !target(do-extract) > do-extract: ${EXTRACT_WRKDIR} > @for file in ${EXTRACT_ONLY}; do \ > if ! (cd ${EXTRACT_WRKDIR} && ${EXTRACT_CMD} > ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ > then \ > exit 1; \ > fi; \ > done > @if [ ${UID} = 0 ]; then \ > ${CHMOD} -R ug-s ${WRKDIR}; \ > ${CHOWN} -R 0:0 ${WRKDIR}; \ > fi > .endif > > > Short of commenting those lines out (which I really don't want to do > because I have 0 idea why it's there or what I'd break with other ports) > is there any way at all to maintain the ownership of the files? > > > Thanks, > > Joseph Ward Hi Joseph, Your best bet is to use plist keywords. See https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/plist-keywords.html for details. You can set owner/group on individual files in the pkg-plist: @(ownername,groupname,444) path/to/file Or you can set it on a block of files: @group groupname @owner ownername path/to/file1 path/to/file2 # Adam -- Adam Weinberger adamw@adamw.org https://www.adamw.org