On 2025/04/22 17:58, Hugo Osvaldo Barrera wrote: > This is the server component of owntracks, an application to record > locations and routes from a mobile client. See: https://owntracks.org/ > > This is my first port submission, please let me know if anything is off. > > I've bundled a patch with OpenBSD support. I've submitted the same patch > upstream, so it should eventually disappear from the ports tree. > > Cheers, > > -- > Hugo
> diff --git infrastructure/db/user.list infrastructure/db/user.list > index 7b25c24d7a7..44b14157f3f 100644 > --- infrastructure/db/user.list > +++ infrastructure/db/user.list > @@ -410,3 +410,4 @@ id user group port > 899 _openhab _openhab misc/openhab > 900 _z2m _z2m comms/zigbee2mqtt > 901 _ergo _ergo net/ergo > +902 _ot-recorder _ot-recorder sysutils/owntracks-recorder > diff --git sysutils/owntracks-recorder/Makefile > sysutils/owntracks-recorder/Makefile > new file mode 100644 > index 00000000000..3b9ff7d065c > --- /dev/null > +++ sysutils/owntracks-recorder/Makefile > @@ -0,0 +1,36 @@ > +# Use /usr/ports/infrastructure/bin/portcheck > + > +COMMENT = Store and access data published by OwnTracks apps > +DISTNAME = recorder-0.9.9 > +PKGNAME= owntracks-recorder-0.9.9 > +DIST_TUPLE += github owntracks recorder 0.9.9 . don't set DISTNAME with DIST_TUPLE > +CATEGORIES = sysutils > +HOMEPAGE = https://github.com/owntracks/recorder > +MAINTAINER = Hugo Osvaldo Barrera <h...@whynothugo.nl> > + > +# GPLv2+ > +PERMIT_PACKAGE = Yes > +PERMIT_DISTFILES = Yes drop PERMIT_DISTFILES if PERMIT_PACKAGE=Yes > +WANTLIB = c m pthread config curl lmdb mosquitto > +BUILD_DEPENDS = databases/lmdb misc/findutils > +LIB_DEPENDS = devel/libconfig net/curl > +LIB_DEPENDS += databases/lmdb net/mosquitto one line per dependency don't list something in both BUILD_DEPENDS and LIB_DEPENDS e.g. BUILD_DEPENDS = misc/findutils LIB_DEPENDS = databases/lmdb \ devel/libconfig \ net/curl \ net/mosquitto > +pre-build: > + sed \ > + -e 's@OPENBSD ?= no@OPENBSD = yes@' \ > + -e 's@CONFIGFILE = .*@CONFIGFILE = > /etc/owntracks-recorder.conf@' \ > + -e 's@DOCROOT = .*@DOCROOT = /var/www/owntracks-recorder@' \ > + -e 's@STORAGEDEFAULT = .*@STORAGEDEFAULT = > /var/db/owntracks-recorder@' \ > + ${WRKDIST}/config.mk.in \ > + > ${WRKDIST}/config.mk use a patch instead of this sed substitution > + ln -sf /usr/local/bin/gfind ${WRKDIR}/bin/find > + > +post-install: > + install -D ${WRKINST}/etc/owntracks-recorder.conf \ > + > ${PREFIX}/share/examples/owntracks-recorder/owntracks-recorder.conf mv is probably better > @@ -0,0 +1,88 @@ > +From 515463957742bbdc302327ff214a11ead809d975 Mon Sep 17 00:00:00 2001 > +From: Hugo Osvaldo Barrera <h...@whynothugo.nl> > +Date: Sat, 1 Mar 2025 14:19:41 +0000 > +Subject: [PATCH] Add support for OpenBSD > +Patch-Source: https://github.com/owntracks/recorder/pull/523/ > + > +--- > + Makefile | 4 ++++ > + config.mk.in | 3 +++ > + util.c | 26 ++++++++++++++++++++++++-- > + 3 files changed, 31 insertions(+), 2 deletions(-) patches in ports should be generated with "make update-patches" which looks for files named XX.orig.port, compares them to XX, and creates patches with a specific format and filenames etc (normally you copy the file to have an .orig.port suffix, edit, run "make update-patches") you can convert from this by doing "make patch" with your patch in place, remove the patch, then "make update-patches" (and add in the information from the comments again) > +diff --git a/Makefile b/Makefile > +index 3cdc8f8..300e357 100644 > +--- Makefile > ++++ Makefile > +@@ -61,6 +61,10 @@ ifeq ($(WITH_HTTP),yes) > + OTR_EXTRA_OBJS += mongoose.o http.o > + endif > + > ++ifeq ($(OPENBSD),yes) > ++ CFLAGS += -DOPENBSD > ++endif it's pointless setting -DOPENBSD like this, __OpenBSD__ is already defined > + ifeq ($(WITH_TOURS),yes) > + CFLAGS += -DWITH_TOURS > + OTR_EXTRA_OBJS += > +diff --git a/config.mk.in b/config.mk.in > +index ec0394e..2eb2c98 100644 > +--- config.mk.in > ++++ config.mk.in > +@@ -33,6 +33,9 @@ FREEBSD ?= no > + # > + # -- end FreeBSD > + > ++# Replace "no" with "yes" for OpenBSD > ++OPENBSD ?= no same > + INSTALLDIR = /usr/local > + > + # Do you want support for MQTT? > +diff --git a/util.c b/util.c > +index 5429048..323eb21 100644 > +--- util.c > ++++ util.c > +@@ -33,8 +33,12 @@ > + #include <stdarg.h> > + #include <math.h> > + #ifdef WITH_TOURS > ++#ifdef OPENBSD > ++# include <uuid.h> > ++#else this approach with an "if $some_os [...]" isn't the best idea really, but without autoconf/cmake/similar it's a bit of a pain to avoid, so I'd probably use #ifdef __OpenBSD__ > + # include <uuid/uuid.h> > + #endif > ++#endif > + #include "udata.h" > + > + #ifndef LINESIZE > +@@ -672,9 +676,27 @@ char *uuid4() > + { > + static char uustr[37]; > + uuid_t uu; > ++#ifdef OPENBSD > ++ uint32_t status; > ++ char *temp_uustr; > ++ > ++ uuid_create(&uu, &status); > ++ if (status != uuid_s_ok) { > ++ printf("could not create uuid\n"); > ++ return (uustr); > ++ } > + > +- uuid_generate(uu); > +- uuid_unparse_lower(uu, uustr); > ++ uuid_to_string(&uu, &temp_uustr, &status); > ++ if (status != uuid_s_ok) { > ++ printf("could not stringify uuid\n"); > ++ return (uustr); > ++ } > ++ strlcpy(uustr, temp_uustr, 37); > ++ free(temp_uustr); > ++#else > ++ uuid_generate(uu); > ++ uuid_unparse_lower(uu, uustr); > ++#endif this patch is harder to read than it should be because you haven't preserved the whitespace as-is (it was using space characters, you changed to tabs). I would probably wrap the #ifdef around the whole function, that would mean a bit of duplication, but it's easier to read > + > + return (uustr); > + } > diff --git sysutils/owntracks-recorder/pkg/DESCR > sysutils/owntracks-recorder/pkg/DESCR > new file mode 100644 > index 00000000000..8de246332d6 > --- /dev/null > +++ sysutils/owntracks-recorder/pkg/DESCR > @@ -0,0 +1,2 @@ > +Interactive Unix filter for command-line that can be used with any list; > files, > +command history, processes, hostnames, bookmarks, git commits, etc. this would read better slightly rewrapped: Interactive Unix filter for command-line that can be used with any list; files, command history, processes, hostnames, bookmarks, git commits, etc. > diff --git sysutils/owntracks-recorder/pkg/PLIST > sysutils/owntracks-recorder/pkg/PLIST > new file mode 100644 > index 00000000000..305d63a0f5d > --- /dev/null > +++ sysutils/owntracks-recorder/pkg/PLIST > @@ -0,0 +1,326 @@ > +@newgroup _ot-recorder:902 > +@newuser _ot-recorder:902:_ot-recorder::Owntracks > Recorder:/nonexistent:/sbin/nologin > +@rcscript ${RCDIR}/ot_recorder > +@bin bin/ocat > +@bin sbin/ot-recorder > +share/examples/owntracks-recorder/ > +share/examples/owntracks-recorder/owntracks-recorder.conf > +@sample ${SYSCONFDIR}/owntracks-recorder.conf > +@cwd /usr/share > +owntracks/ > +owntracks/recorder/ > +owntracks/recorder/timezone16.bin that should be somewhere under the default prefix (i.e. /usr/local/share/owntracks not /usr/share/owntracks) and don't use @cwd > +@cwd /var/db > +@mode 770 > +@owner _ot-recorder > +@group _ot-recorder > +owntracks-recorder/ that location is ok, but also don't use @cwd @mode 770 @owner _ot-recorder @group _ot-recorder @sample /var/db/owntracks-recorder/ > +@cwd /var/www this is a fairly reasonable way to handle /var/www files in general, but I question whether /var/www is the right place for these, assuming they're served by the owntracks-recorder program itself then somewhere under /usr/local might be a better choice > +@mode 440 > +@owner www > +@group www > +owntracks-recorder/ a directory with mode 440 is no good, unless there are secrets then the default permissions are fine there they should not be owned by "www". having them owned by root would probably be best. > +owntracks-recorder/index.html > +owntracks-recorder/last/ > +owntracks-recorder/last/index.html > +owntracks-recorder/last/last.html > +owntracks-recorder/last/manifest.json > +owntracks-recorder/last/map_google.js > +owntracks-recorder/last/map_leaflet.js > +owntracks-recorder/last/websock.js > +owntracks-recorder/map/ > +owntracks-recorder/map/index.html > +owntracks-recorder/map/map_google.js > +owntracks-recorder/map/map_leaflet.js > +owntracks-recorder/owntracks.xsl > +owntracks-recorder/static/ > +owntracks-recorder/static/datatables/ > +owntracks-recorder/static/datatables/css/ > +owntracks-recorder/static/datatables/css/jquery.dataTables.min.css > +owntracks-recorder/static/datatables/images/ > +owntracks-recorder/static/datatables/images/sort_asc.png > +owntracks-recorder/static/datatables/images/sort_asc_disabled.png > +owntracks-recorder/static/datatables/images/sort_both.png > +owntracks-recorder/static/datatables/images/sort_desc.png > +owntracks-recorder/static/datatables/images/sort_desc_disabled.png > +owntracks-recorder/static/datatables/js/ > +owntracks-recorder/static/datatables/js/jquery.dataTables.min.js > +owntracks-recorder/static/datatables/js/jquery.min.js > +owntracks-recorder/static/defaultface.svg > +owntracks-recorder/static/flags/ > +owntracks-recorder/static/flags/AD.png > +owntracks-recorder/static/flags/AE.png > +owntracks-recorder/static/flags/AF.png > +owntracks-recorder/static/flags/AG.png > +owntracks-recorder/static/flags/AI.png > +owntracks-recorder/static/flags/AL.png > +owntracks-recorder/static/flags/AM.png > +owntracks-recorder/static/flags/AN.png > +owntracks-recorder/static/flags/AO.png > +owntracks-recorder/static/flags/AQ.png > +owntracks-recorder/static/flags/AR.png > +owntracks-recorder/static/flags/AS.png > +owntracks-recorder/static/flags/AT.png > +owntracks-recorder/static/flags/AU.png > +owntracks-recorder/static/flags/AW.png > +owntracks-recorder/static/flags/AX.png > +owntracks-recorder/static/flags/AZ.png > +owntracks-recorder/static/flags/BA.png > +owntracks-recorder/static/flags/BB.png > +owntracks-recorder/static/flags/BD.png > +owntracks-recorder/static/flags/BE.png > +owntracks-recorder/static/flags/BF.png > +owntracks-recorder/static/flags/BG.png > +owntracks-recorder/static/flags/BH.png > +owntracks-recorder/static/flags/BI.png > +owntracks-recorder/static/flags/BJ.png > +owntracks-recorder/static/flags/BL.png > +owntracks-recorder/static/flags/BM.png > +owntracks-recorder/static/flags/BN.png > +owntracks-recorder/static/flags/BO.png > +owntracks-recorder/static/flags/BR.png > +owntracks-recorder/static/flags/BS.png > +owntracks-recorder/static/flags/BT.png > +owntracks-recorder/static/flags/BW.png > +owntracks-recorder/static/flags/BY.png > +owntracks-recorder/static/flags/BZ.png > +owntracks-recorder/static/flags/CA.png > +owntracks-recorder/static/flags/CC.png > +owntracks-recorder/static/flags/CD.png > +owntracks-recorder/static/flags/CF.png > +owntracks-recorder/static/flags/CG.png > +owntracks-recorder/static/flags/CH.png > +owntracks-recorder/static/flags/CI.png > +owntracks-recorder/static/flags/CK.png > +owntracks-recorder/static/flags/CL.png > +owntracks-recorder/static/flags/CM.png > +owntracks-recorder/static/flags/CN.png > +owntracks-recorder/static/flags/CO.png > +owntracks-recorder/static/flags/CR.png > +owntracks-recorder/static/flags/CU.png > +owntracks-recorder/static/flags/CV.png > +owntracks-recorder/static/flags/CW.png > +owntracks-recorder/static/flags/CX.png > +owntracks-recorder/static/flags/CY.png > +owntracks-recorder/static/flags/CZ.png > +owntracks-recorder/static/flags/DE.png > +owntracks-recorder/static/flags/DJ.png > +owntracks-recorder/static/flags/DK.png > +owntracks-recorder/static/flags/DM.png > +owntracks-recorder/static/flags/DO.png > +owntracks-recorder/static/flags/DZ.png > +owntracks-recorder/static/flags/EC.png > +owntracks-recorder/static/flags/EE.png > +owntracks-recorder/static/flags/EG.png > +owntracks-recorder/static/flags/EH.png > +owntracks-recorder/static/flags/ER.png > +owntracks-recorder/static/flags/ES.png > +owntracks-recorder/static/flags/ET.png > +owntracks-recorder/static/flags/EU.png > +owntracks-recorder/static/flags/FI.png > +owntracks-recorder/static/flags/FJ.png > +owntracks-recorder/static/flags/FK.png > +owntracks-recorder/static/flags/FM.png > +owntracks-recorder/static/flags/FO.png > +owntracks-recorder/static/flags/FR.png > +owntracks-recorder/static/flags/GA.png > +owntracks-recorder/static/flags/GB.png > +owntracks-recorder/static/flags/GD.png > +owntracks-recorder/static/flags/GE.png > +owntracks-recorder/static/flags/GG.png > +owntracks-recorder/static/flags/GH.png > +owntracks-recorder/static/flags/GI.png > +owntracks-recorder/static/flags/GL.png > +owntracks-recorder/static/flags/GM.png > +owntracks-recorder/static/flags/GN.png > +owntracks-recorder/static/flags/GQ.png > +owntracks-recorder/static/flags/GR.png > +owntracks-recorder/static/flags/GS.png > +owntracks-recorder/static/flags/GT.png > +owntracks-recorder/static/flags/GU.png > +owntracks-recorder/static/flags/GW.png > +owntracks-recorder/static/flags/GY.png > +owntracks-recorder/static/flags/HK.png > +owntracks-recorder/static/flags/HN.png > +owntracks-recorder/static/flags/HR.png > +owntracks-recorder/static/flags/HT.png > +owntracks-recorder/static/flags/HU.png > +owntracks-recorder/static/flags/Hello.txt > +owntracks-recorder/static/flags/IC.png > +owntracks-recorder/static/flags/ID.png > +owntracks-recorder/static/flags/IE.png > +owntracks-recorder/static/flags/IL.png > +owntracks-recorder/static/flags/IM.png > +owntracks-recorder/static/flags/IN.png > +owntracks-recorder/static/flags/IQ.png > +owntracks-recorder/static/flags/IR.png > +owntracks-recorder/static/flags/IS.png > +owntracks-recorder/static/flags/IT.png > +owntracks-recorder/static/flags/JE.png > +owntracks-recorder/static/flags/JM.png > +owntracks-recorder/static/flags/JO.png > +owntracks-recorder/static/flags/JP.png > +owntracks-recorder/static/flags/KE.png > +owntracks-recorder/static/flags/KG.png > +owntracks-recorder/static/flags/KH.png > +owntracks-recorder/static/flags/KI.png > +owntracks-recorder/static/flags/KM.png > +owntracks-recorder/static/flags/KN.png > +owntracks-recorder/static/flags/KP.png > +owntracks-recorder/static/flags/KR.png > +owntracks-recorder/static/flags/KW.png > +owntracks-recorder/static/flags/KY.png > +owntracks-recorder/static/flags/KZ.png > +owntracks-recorder/static/flags/LA.png > +owntracks-recorder/static/flags/LB.png > +owntracks-recorder/static/flags/LC.png > +owntracks-recorder/static/flags/LI.png > +owntracks-recorder/static/flags/LICENSE.txt > +owntracks-recorder/static/flags/LK.png > +owntracks-recorder/static/flags/LR.png > +owntracks-recorder/static/flags/LS.png > +owntracks-recorder/static/flags/LT.png > +owntracks-recorder/static/flags/LU.png > +owntracks-recorder/static/flags/LV.png > +owntracks-recorder/static/flags/LY.png > +owntracks-recorder/static/flags/MA.png > +owntracks-recorder/static/flags/MC.png > +owntracks-recorder/static/flags/MD.png > +owntracks-recorder/static/flags/ME.png > +owntracks-recorder/static/flags/MF.png > +owntracks-recorder/static/flags/MG.png > +owntracks-recorder/static/flags/MH.png > +owntracks-recorder/static/flags/MK.png > +owntracks-recorder/static/flags/ML.png > +owntracks-recorder/static/flags/MM.png > +owntracks-recorder/static/flags/MN.png > +owntracks-recorder/static/flags/MO.png > +owntracks-recorder/static/flags/MP.png > +owntracks-recorder/static/flags/MQ.png > +owntracks-recorder/static/flags/MR.png > +owntracks-recorder/static/flags/MS.png > +owntracks-recorder/static/flags/MT.png > +owntracks-recorder/static/flags/MU.png > +owntracks-recorder/static/flags/MV.png > +owntracks-recorder/static/flags/MW.png > +owntracks-recorder/static/flags/MX.png > +owntracks-recorder/static/flags/MY.png > +owntracks-recorder/static/flags/MZ.png > +owntracks-recorder/static/flags/NA.png > +owntracks-recorder/static/flags/NC.png > +owntracks-recorder/static/flags/NE.png > +owntracks-recorder/static/flags/NF.png > +owntracks-recorder/static/flags/NG.png > +owntracks-recorder/static/flags/NI.png > +owntracks-recorder/static/flags/NL.png > +owntracks-recorder/static/flags/NO.png > +owntracks-recorder/static/flags/NP.png > +owntracks-recorder/static/flags/NR.png > +owntracks-recorder/static/flags/NU.png > +owntracks-recorder/static/flags/NZ.png > +owntracks-recorder/static/flags/OM.png > +owntracks-recorder/static/flags/PA.png > +owntracks-recorder/static/flags/PE.png > +owntracks-recorder/static/flags/PF.png > +owntracks-recorder/static/flags/PG.png > +owntracks-recorder/static/flags/PH.png > +owntracks-recorder/static/flags/PK.png > +owntracks-recorder/static/flags/PL.png > +owntracks-recorder/static/flags/PN.png > +owntracks-recorder/static/flags/PR.png > +owntracks-recorder/static/flags/PS.png > +owntracks-recorder/static/flags/PT.png > +owntracks-recorder/static/flags/PW.png > +owntracks-recorder/static/flags/PY.png > +owntracks-recorder/static/flags/QA.png > +owntracks-recorder/static/flags/RO.png > +owntracks-recorder/static/flags/RS.png > +owntracks-recorder/static/flags/RU.png > +owntracks-recorder/static/flags/RW.png > +owntracks-recorder/static/flags/SA.png > +owntracks-recorder/static/flags/SB.png > +owntracks-recorder/static/flags/SC.png > +owntracks-recorder/static/flags/SD.png > +owntracks-recorder/static/flags/SE.png > +owntracks-recorder/static/flags/SG.png > +owntracks-recorder/static/flags/SH.png > +owntracks-recorder/static/flags/SI.png > +owntracks-recorder/static/flags/SK.png > +owntracks-recorder/static/flags/SL.png > +owntracks-recorder/static/flags/SM.png > +owntracks-recorder/static/flags/SN.png > +owntracks-recorder/static/flags/SO.png > +owntracks-recorder/static/flags/SR.png > +owntracks-recorder/static/flags/SS.png > +owntracks-recorder/static/flags/ST.png > +owntracks-recorder/static/flags/SV.png > +owntracks-recorder/static/flags/SY.png > +owntracks-recorder/static/flags/SZ.png > +owntracks-recorder/static/flags/TC.png > +owntracks-recorder/static/flags/TD.png > +owntracks-recorder/static/flags/TF.png > +owntracks-recorder/static/flags/TG.png > +owntracks-recorder/static/flags/TH.png > +owntracks-recorder/static/flags/TJ.png > +owntracks-recorder/static/flags/TK.png > +owntracks-recorder/static/flags/TL.png > +owntracks-recorder/static/flags/TM.png > +owntracks-recorder/static/flags/TN.png > +owntracks-recorder/static/flags/TO.png > +owntracks-recorder/static/flags/TR.png > +owntracks-recorder/static/flags/TT.png > +owntracks-recorder/static/flags/TV.png > +owntracks-recorder/static/flags/TW.png > +owntracks-recorder/static/flags/TZ.png > +owntracks-recorder/static/flags/UA.png > +owntracks-recorder/static/flags/UG.png > +owntracks-recorder/static/flags/US.png > +owntracks-recorder/static/flags/UY.png > +owntracks-recorder/static/flags/UZ.png > +owntracks-recorder/static/flags/VA.png > +owntracks-recorder/static/flags/VC.png > +owntracks-recorder/static/flags/VE.png > +owntracks-recorder/static/flags/VG.png > +owntracks-recorder/static/flags/VI.png > +owntracks-recorder/static/flags/VN.png > +owntracks-recorder/static/flags/VU.png > +owntracks-recorder/static/flags/WF.png > +owntracks-recorder/static/flags/WS.png > +owntracks-recorder/static/flags/YE.png > +owntracks-recorder/static/flags/YT.png > +owntracks-recorder/static/flags/ZA.png > +owntracks-recorder/static/flags/ZM.png > +owntracks-recorder/static/flags/ZW.png > +owntracks-recorder/static/flags/__.png > +owntracks-recorder/static/index.html > +owntracks-recorder/static/leaflet/ > +owntracks-recorder/static/leaflet/images/ > +owntracks-recorder/static/leaflet/images/layers-2x.png > +owntracks-recorder/static/leaflet/images/layers.png > +owntracks-recorder/static/leaflet/images/marker-icon-2x.png > +owntracks-recorder/static/leaflet/images/marker-icon.png > +owntracks-recorder/static/leaflet/images/marker-shadow.png > +owntracks-recorder/static/leaflet/leaflet.css > +owntracks-recorder/static/leaflet/leaflet.js > +owntracks-recorder/static/leaflet/leaflet.js.map > +owntracks-recorder/static/recorder.png > +owntracks-recorder/table/ > +owntracks-recorder/table/config.js > +owntracks-recorder/table/index.html > +owntracks-recorder/table/otable.css > +owntracks-recorder/test-ws.html > +owntracks-recorder/test.txt > +owntracks-recorder/utils/ > +owntracks-recorder/utils/config.js > +owntracks-recorder/utils/debug.js > +owntracks-recorder/utils/index.html > +owntracks-recorder/utils/map.css > +owntracks-recorder/utils/map.js > +owntracks-recorder/utils/map_google.js > +owntracks-recorder/utils/map_leaflet.js > +owntracks-recorder/utils/misc.js > +owntracks-recorder/utils/network.js > +owntracks-recorder/views/ > +owntracks-recorder/views/jane.json.sample > +owntracks-recorder/views/leafletmap.html > +owntracks-recorder/views/vmap.html > diff --git sysutils/owntracks-recorder/pkg/ot_recorder.rc > sysutils/owntracks-recorder/pkg/ot_recorder.rc > new file mode 100644 > index 00000000000..8e460df29cd > --- /dev/null > +++ sysutils/owntracks-recorder/pkg/ot_recorder.rc > @@ -0,0 +1,12 @@ > +#!/bin/ksh > + > +daemon="${TRUEPREFIX}/sbin/ot-recorder" > +daemon_flags="" > +daemon_user="_ot-recorder" > + > +. /etc/rc.d/rc.subr > + > +rc_bg=YES > +rc_reload=NO > + > +rc_cmd $1