On 2024/09/11 10:04, David Uhden Collado wrote: > Thank you for taking the time to check out my port. > > > > 3. Configuration files are placed in the files directory because, by >> > > > default, the program generates them and the data directories in the same > > > location as the executable. To integrate the software into the system and > > > prevent this behavior, I created these configuration files, which are > > > simply the program's default configuration with modified paths for the > > > configuration files and data storage. > > > > are these not files which the program is meant to update itself > > after learning about trackers etc from the network? > > Yes, I think it is better to let the program generate the configuration > files in the home directory of the user running the daemon. > > > > > : BUILD_DEPENDS = devel/git > > > > that only seems used in the Makefile in the distro, whuch you aren't > > using. (also even in that case it's only used if .git exists, which it > > doesn't). > > > > : USE_GMAKE = Yes > > > > unused in your port, you are using go.port.mk pieces to do the build and > > ignoring upstream's Makefile > > > > : SEPARATE_BUILD= Yes > > > > already set by go.port.mk > > Removed > > > > > : do-install: > > : ${INSTALL_PROGRAM} ${MODGO_WORKSPACE}/bin/XD ${PREFIX}/bin > > : ${INSTALL_DATA_DIR} ${SYSCONFDIR}/xd > > > > if that actually works for you, you're buulding ports as root. > > do not do that. > > > I didn't know it was so important to build ports with doas or sudo as a > normal user. As I said before, the documentation is not clear on this.
The recommended method is to set PORTS_PRIVSEP=Yes and SUDO in mk.conf and set directory permissions accordingly. That way a dedicated user account is used without access to e.g. files in your homedir unless they're world-readable. Thrre are some alternative ways to do things that require less setup. Running things directly as root is the worst possible way. > > /pobj/xd-torrent-0.4.6/bin/install -d -m 755 /etc/xd > > install: /etc/xd: Permission denied > > *** Error 1 in . (Makefile:23 'do-install') > > *** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:3141 > > '/pobj/xd-torrent-0.4.6/fake-amd64/.fake_done': @cd > > /usr/ports/mystuff/net/x...) > > *** Error 2 in /usr/ports/mystuff/net/xd-torrent > > (/usr/ports/infrastructure/mk/bsd.port.mk:2704 'fake': > > @lock=xd-torrent-0.4.6; export _LOC...) > > > > : ${INSTALL_DATA} ${FILESDIR}/*.ini ${SYSCONFDIR}/xd/ > > > > same - plus if you are building as root, that would install files into > > /etc on the build machine, a port should not write outside of either > > WRKDIR or /tmp at all during build. > > What would be the right way to do it? I wrote the right way imnediately after: > > that should be installed into a dir like ${PREFIX}/share/examples/xd-torrent > > for @sample to copy from > > : ${INSTALL_DATA_DIR} ${LOCALSTATEDIR}/xd/metadata > > : ${INSTALL_DATA_DIR} ${LOCALSTATEDIR}/xd/downloads > > : ${INSTALL_DATA_DIR} ${LOCALSTATEDIR}/xd/seeding > > > > same, this is writing to /var on the build machine during build. > > > > you don't need these at all, just create the dirs at package install > > time via @sample. > > So all new directories have to be created using the PLIST file? I have seen > ports that do this directly from the Makefile, in which cases should the > Makefile be used and in which cases PLIST? dirs under prefix: INSTALL_DATA_DIR dirs outside prefix: @sample > > : @rcscript ${RCDIR}/xd > > : @bin bin/XD > > : bin/XD-CLI > > : @sample ${SYSCONFDIR}/xd/ > > : @sample ${SYSCONFDIR}/xd/torrents.ini > > : @sample ${SYSCONFDIR}/xd/trackers.ini > > > > read about @sample in pkg_create(8) to see what's wrong here. > > I've read several times the section that talks about how the @sample option > works in the packing-list (PLIST) and I can't see what's wrong here. Could > you tell me? "Last preceding @file item is a sample configuration file, to be copied to filename at pkg_add(1) time and to be removed at pkg_delete(1) time." the last preceding file item is bin/XD-CLI. > On the other hand, there is no man page called "pkg_create" in > section 8, only in section 1. ah yes, bad memory, pkg_create feels like a section 8 page to me and I didn't check.