Welcome to CRUX bug tracking.
FS#1111 - Stop using a hard coded repository base directory
Attached to Project:
CRUX
Opened by Thomas Penteker (teK) - Friday, 02 January 2015, 00:16 GMT
Last edited by Tim Biermann (tb) - Thursday, 24 June 2021, 11:24 GMT
Opened by Thomas Penteker (teK) - Friday, 02 January 2015, 00:16 GMT
Last edited by Tim Biermann (tb) - Thursday, 24 June 2021, 11:24 GMT
|
DetailsI just realised that we are setting the *local* repo dir in each .httpup file
shipped by crux.nu/portdb, like: ROOT_DIR=/usr/ports/mechaniputer etc. /usr/bin/ports explicitly sets PORTS_DIR="/usr/ports" and uses it for everything but ports -u, afaics, e.g.: port_version=`cd $PORTS_DIR/$port; . Pkgfile; echo $version-$release` I propose to a) make PORTS_DIR configurable. For now this could happen in /etc/pkgmk.conf b) comment out the destination/ROOT_DIR parts in the .rsync/.httpup files served and let the system default be /usr/ports but allow users to override this on a per repo basis (just like it is today) c) update the ports man page, post to the ML d) adjust /etc/ports/drivers/{rsync,httpup} e) adjust ports(1) to honor the different base dirs for --list and --diff The only issue I see is with older versions of ports and recently downloaded repos files from crux.nu/portdb, where the neither the repo file nor ports sets the target directory for the synced repository during ports -u. Please comment. |
This task depends upon
Note: other CRUX tools might have /usr/ports hard coded !
What's the advantage of using other directories than /usr/ports ?
I see no advantage having different base directory for ports, as the symlinks gives enough flexibility, but only as long as the ports tool remain for root use only. I see no reason not to allow users to update, build and install ports to ~/bin. But this might be another issue.
FS#1852had been implemented, they might have been able to do so.> I see no advantage having different base directory for ports, as the symlinks gives enough flexibility, but only as long as the ports tool remain for root use only.
Restricting to UID 0 the use of 'ports -u' (but not 'ports -d' or 'ports -l') goes hand-in-hand with hard-coding the base directory. Note that the test for UID=0 can be satisfied without being real root; either by running 'fakeroot ports -u' or by switching to a new "user namespace" where one's actual UID is mapped to UID 0. Likewise the permissions and ownership of the base directory can be changed by the knowledgeable user, so nothing is lost by keeping it hard-coded in our tools. As long as we ship a set of tools whose defaults are internally consistent, we won't be flooded by support requests from less experienced users.
> I see no reason not to allow users to update, build and install ports to ~/bin.
Grabbing a random example from the portdb for illustration purposes, is this what you had in mind?
httpup sync https://raw.githubusercontent.com/akosela/crux-ports/master/#atari800 atari800
cd atari800 && pkgmk -d
mkdir -p $HOME/var/lib/pkg; touch $HOME/var/lib/pkg/db
pkgadd -r $HOME atari800*.pkg.gz
The last command probably needs to be prefaced by fakeroot (because pkgadd also performs a UID check), but installations to the $HOME of a regular user are outside the scope of the current ticket. This example just illustrates that the low-level {sync,build,install} tools can be exercised just fine by a regular user; it's only the high-level scripts like /usr/bin/ports and /etc/ports/drivers/{git,httpup,rsync} that would need to be customized for use by a regular user. I for one appreciate this separation. Keeping the base directory hard-coded in our high-level scripts, yet configurable by each syncfile that they parse, undermines this separation, which is one puzzling aspect of seeing absolute paths in /etc/ports/*.{rsync,httpup} and perhaps the motivation for the current ticket.