From owner-freebsd-ports@FreeBSD.ORG Thu Dec 15 19:36:23 2011 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2184C1065672 for ; Thu, 15 Dec 2011 19:36:23 +0000 (UTC) (envelope-from m.e.sanliturk@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id D981C8FC14 for ; Thu, 15 Dec 2011 19:36:22 +0000 (UTC) Received: by ghrr19 with SMTP id r19so2603265ghr.13 for ; Thu, 15 Dec 2011 11:36:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=tjQbf+vItyhz+6kSxBB0nFURpe+lgVRVPu7spk+Xz/s=; b=ffwjs7FUl1DRCpHWIRcDMUm2Lq5ORKCNW8aoGsySKx7JUOCnLEeiZmOJY6DeUlQV8f Vd3AY0hzOqrCexwI3YKiEc22qd6WZkdkB2qeYipj+q8AEY1ntIH8YPvlBTWCOT0GO73c YxKLngfgT/kAcK2YW7YFDi4Q0HJnL3/jTCmEc= MIME-Version: 1.0 Received: by 10.50.173.74 with SMTP id bi10mr4049218igc.4.1323976257468; Thu, 15 Dec 2011 11:10:57 -0800 (PST) Received: by 10.42.166.201 with HTTP; Thu, 15 Dec 2011 11:10:57 -0800 (PST) Date: Thu, 15 Dec 2011 14:10:57 -0500 Message-ID: From: Mehmet Erol Sanliturk To: FreeBSD Ports List Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Global and User package database X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Dec 2011 19:36:23 -0000 Dear All , In the new PkgNG : https://github.com/pkgng/pkgng/blob/master/pkg/add.c the following statement is written : if (geteuid() != 0) { warnx("adding packages can only be done as root"); return (EX_NOPERM); } Instead of the above statement , is it possible to use a statement as follows ( which it may be defined as a function to be called from all the related functions / programs ) : if (geteuid() == 0) { package_db_path = ... global path name ... , etc. ; PKGDB_PLACE = PKGDB_DEFAULT ... etc. } else { package_db_path = ... local path name , ie. in $HOME about user path name ... , etc. ; PKGDB_PLACE = PKGDB_USER ... etc. } if (pkgdb_open(&db, PKGDB_PLACE) != EPKG_OK) { return (EX_IOERR); } ( Replace PKGDB_PLACE by a suitable name ... ) In that way , it will be possible to install packages into user home directory , instead of global package directory . For security concerns , user-installed packages will not be usable globally , or convenient only for the user . Thank you very much . Mehmet Erol Sanliturk