Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Dec 2011 14:10:57 -0500
From:      Mehmet Erol Sanliturk <m.e.sanliturk@gmail.com>
To:        FreeBSD Ports List <freebsd-ports@freebsd.org>
Subject:   Global and User package database
Message-ID:  <CAOgwaMvoHakdYpGNhYdswvTb5xnGBWfMmp4hpC9U3he4SYtWEg@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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



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