Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jun 2020 13:10:51 +0000 (UTC)
From:      Koichiro Iwao <meta@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r539808 - in head/net/librespeed-go: . files
Message-ID:  <202006221310.05MDApGP025736@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: meta
Date: Mon Jun 22 13:10:51 2020
New Revision: 539808
URL: https://svnweb.freebsd.org/changeset/ports/539808

Log:
  net/librespeed-go: Update to 1.0.1 etc
  
  While here, refrain from running with root privileges as it is not necessary
  and adjust directory permissions.
  
  PR:		247353
  Submitted by:	Dries Michiels <driesm.michiels@gmail.com> (maintainer)
  Reviewed by:	meta (myself)

Deleted:
  head/net/librespeed-go/files/patch-settings.toml
Modified:
  head/net/librespeed-go/Makefile
  head/net/librespeed-go/distinfo
  head/net/librespeed-go/files/librespeed-go.in
  head/net/librespeed-go/files/pkg-message.in
  head/net/librespeed-go/pkg-plist

Modified: head/net/librespeed-go/Makefile
==============================================================================
--- head/net/librespeed-go/Makefile	Mon Jun 22 13:00:24 2020	(r539807)
+++ head/net/librespeed-go/Makefile	Mon Jun 22 13:10:51 2020	(r539808)
@@ -2,7 +2,7 @@
 
 PORTNAME=	librespeed-go
 DISTVERSIONPREFIX=	v
-DISTVERSION=	1.0.0
+DISTVERSION=	1.0.1
 CATEGORIES=	net www
 
 MAINTAINER=	driesm.michiels@gmail.com
@@ -43,21 +43,31 @@ GH_TUPLE=	etcd-io:bbolt:v1.3.3:etcd_io_bbolt/vendor/go
 		spf13:viper:v1.6.2:spf13_viper/vendor/github.com/spf13/viper \
 		subosito:gotenv:v1.2.0:subosito_gotenv/vendor/github.com/subosito/gotenv
 
-GO_TARGET=	./:${PREFIX}/libexec/librespeed-go/librespeed-go
+USERS=		librespeed
+GROUPS=		librespeed
 
 SUB_FILES=	pkg-message
+PLIST_SUB=	LIBRESPEED_USER=${USERS} LIBRESPEED_GROUP=${GROUPS}
+SUB_LIST=	LIBRESPEED_USER=${USERS} LIBRESPEED_GROUP=${GROUPS} PORTNAME=${PORTNAME}
 
 OPTIONS_DEFINE=	EXAMPLES
 
 post-patch:
 	${REINPLACE_CMD} -e 's|"."|"${ETCDIR}"|g' ${WRKSRC}/config/config.go
+	${REINPLACE_CMD} -e 's|"./assets"|"${WWWDIR}"|g' ${WRKSRC}/config/config.go
 
+pre-install:
+	${REINPLACE_CMD} -e 's|"./assets"|"${WWWDIR}"|g' ${WRKSRC}/settings.toml
+	${REINPLACE_CMD} -e 's|"speedtest.db"|"/var/db/${PORTNAME}/speedtest.db"|g' ${WRKSRC}/settings.toml
+
 post-install:
-	${MKDIR} ${STAGEDIR}${PREFIX}/libexec/${PORTNAME}/assets
-	${CP} -a ${WRKSRC}/assets/*.js ${STAGEDIR}${PREFIX}/libexec/librespeed-go/assets
-	${CP} -a ${WRKSRC}/assets/*.ttf ${STAGEDIR}${PREFIX}/libexec/librespeed-go/assets
+	${MKDIR} ${STAGEDIR}${WWWDIR}
+	${CP} -a ${WRKSRC}/assets/*.js ${STAGEDIR}${WWWDIR}
+	${CP} -a ${WRKSRC}/assets/*.ttf ${STAGEDIR}${WWWDIR}
 	${MKDIR} ${STAGEDIR}${ETCDIR}
 	${INSTALL_DATA} ${WRKSRC}/settings.toml ${STAGEDIR}${ETCDIR}/settings.toml.sample
+	${MKDIR} ${STAGEDIR}/var/db/${PORTNAME}
+	${MKDIR} ${STAGEDIR}/var/run/${PORTNAME}
 
 post-install-EXAMPLES-on:
 	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}

Modified: head/net/librespeed-go/distinfo
==============================================================================
--- head/net/librespeed-go/distinfo	Mon Jun 22 13:00:24 2020	(r539807)
+++ head/net/librespeed-go/distinfo	Mon Jun 22 13:10:51 2020	(r539808)
@@ -1,6 +1,6 @@
-TIMESTAMP = 1591867495
-SHA256 (librespeed-speedtest-go-v1.0.0_GH0.tar.gz) = 8d9c572bc06d0994f01757496016b180e61ab422ecc9c03a13f1bdab9bbd766a
-SIZE (librespeed-speedtest-go-v1.0.0_GH0.tar.gz) = 2232423
+TIMESTAMP = 1592422992
+SHA256 (librespeed-speedtest-go-v1.0.1_GH0.tar.gz) = 1f8bfc80326af71e27f65716c35cc09c642f7424849f013dbe566826d3dfd31e
+SIZE (librespeed-speedtest-go-v1.0.1_GH0.tar.gz) = 2233115
 SHA256 (etcd-io-bbolt-v1.3.3_GH0.tar.gz) = 089ae9a1651531dcac069370212abfe16e83af1c6f331d59e0154fa64fe9b120
 SIZE (etcd-io-bbolt-v1.3.3_GH0.tar.gz) = 94626
 SHA256 (fsnotify-fsnotify-v1.4.7_GH0.tar.gz) = b7530d973d0ab0e58ad8ce1b9a4b963d6f57b3d72f2f9e13d49846976361b1cd

Modified: head/net/librespeed-go/files/librespeed-go.in
==============================================================================
--- head/net/librespeed-go/files/librespeed-go.in	Mon Jun 22 13:00:24 2020	(r539807)
+++ head/net/librespeed-go/files/librespeed-go.in	Mon Jun 22 13:10:51 2020	(r539808)
@@ -2,7 +2,7 @@
 
 # $FreeBSD$
 #
-# PROVIDE: librespeed-go
+# PROVIDE: %%PORTNAME%%
 # REQUIRE: SERVERS
 # KEYWORD: shutdown
 #
@@ -10,13 +10,15 @@
 # to enable this service:
 #
 # librespeed_go_enable:		Set to NO by default.
-#				Set it to YES to enable librenms
+#				Set it to YES to enable librespeed-go
 # librespeed_go_pid:		Path of the pid file.
-#				Default /var/run/librenms/librenms.pid
+#				Default /var/run/%%PORTNAME%%/%%PORTNAME%%.pid
+# librespeed_go_user:		The user account used to run the daemon.
+#				Default: %%LIBRESPEED_USER%%
+# librespeed_go_group:		The group used to run the daemon.
+#				Default: %%LIBRESPEED_GROUP%%
 # librespeed_go_daemonflags:	Flags passed to daemon(8)
 #				Default -f which prevents any logging
-# librespeed_go_chdir:		Dir to run the daemon in
-# 				Default /usr/local/libexec/librespeed-go
 
 . /etc/rc.subr
 
@@ -27,12 +29,13 @@ command="/usr/sbin/daemon"
 load_rc_config $name
 
 : ${librespeed_go_enable:="NO"}
-: ${librespeed_go_pid:="/var/run/librespeed-go.pid"}
+: ${librespeed_go_pid:="/var/run/%%PORTNAME%%/%%PORTNAME%%.pid"}
+: ${librespeed_go_user:="%%LIBRESPEED_USER%%"}
+: ${librespeed_go_group:="%%LIBRESPEED_GROUP%%"}
 : ${librespeed_go_daemonflags:="-f"}
-: ${librespeed_go_chdir:="%%PREFIX%%/libexec/librespeed-go"}
 
 pidfile="$librespeed_go_pid"
-procname="%%PREFIX%%/libexec/librespeed-go/librespeed-go"
+procname="%%PREFIX%%/bin/%%PORTNAME%%"
 command_args="$librespeed_go_daemonflags -p $pidfile $procname"
 
 run_rc_command "$1"

Modified: head/net/librespeed-go/files/pkg-message.in
==============================================================================
--- head/net/librespeed-go/files/pkg-message.in	Mon Jun 22 13:00:24 2020	(r539807)
+++ head/net/librespeed-go/files/pkg-message.in	Mon Jun 22 13:10:51 2020	(r539808)
@@ -1,23 +1,36 @@
 [
 { type: install
   message: <<EOM
-Copy your preferred example from %%PREFIX%%/share/examples/librespeed-go to %%PREFIX%%/libexec/librespeed-go/assets/index.html.
+Copy your preferred example from %%EXAMPLESDIR%% to
+%%WWWDIR%%/index.html.
 To use the backend feature, be sure to copy a -full example.
-	cd %%PREFIX%%/share/examples/librespeed-go
-	cp -a example-singleServer-full.html %%PREFIX%%/libexec/librespeed-go/assets/index.html
+	cd %%EXAMPLESDIR%%
+	cp -a example-singleServer-full.html %%WWWDIR%%/index.html
 
 To automatically start librespeed-go at boot time:
-# sysrc librespeed_go_enable="YES"
+        sysrc librespeed_go_enable="YES"
 
 To start the service directly:
-# service librespeed-go start
+        service librespeed-go start
+
+By default, librespeed-go daemon runs under user privilege so it cannot listen
+on the standard http port 80/tcp. You can expose 80/tcp to the daemon using
+packet forwarding by ipfw like below (recommended):
+	ipfw add fwd 127.0.0.1,8989 tcp from any to me 80 in
+
+Alternatively, you can configure the daemon to listen on 80/tcp if it is
+running with root privileges. 
+	sysrc librespeed_go_user=root
+
 EOM
 }
 { type: remove
   message: <<EOM
-If you are uninstalling librespeed-go permanently,
-and you do *NOT* want to retain the speedtest database and other your configured landing page,
-you should manually remove /var/db/speedtest.db, and %%PREFIX%%/libexec/librespeed-go.
+If you are uninstalling librespeed-go permanently, and you do *NOT* want to
+retain the speedtest database and other your configured landing page, you
+should manually remove folliwing directories:
+    - /var/db/librespeed-go
+    - %%WWWDIR%%
 EOM
 }
 ]

Modified: head/net/librespeed-go/pkg-plist
==============================================================================
--- head/net/librespeed-go/pkg-plist	Mon Jun 22 13:00:24 2020	(r539807)
+++ head/net/librespeed-go/pkg-plist	Mon Jun 22 13:10:51 2020	(r539808)
@@ -1,9 +1,5 @@
+bin/librespeed-go
 @sample %%ETCDIR%%/settings.toml.sample
-libexec/librespeed-go/assets/NotoSansDisplay-Light.ttf
-libexec/librespeed-go/assets/NotoSansDisplay-Medium.ttf
-libexec/librespeed-go/assets/speedtest.js
-libexec/librespeed-go/assets/speedtest_worker.js
-libexec/librespeed-go/librespeed-go
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/example-multipleServers-full.html
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/example-multipleServers-pretty.html
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/example-singleServer-basic.html
@@ -13,3 +9,12 @@ libexec/librespeed-go/librespeed-go
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/example-singleServer-gauges.html
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/example-singleServer-pretty.html
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/example-singleServer-progressBar.html
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/index.html
+%%WWWDIR%%/NotoSansDisplay-Light.ttf
+%%WWWDIR%%/NotoSansDisplay-Medium.ttf
+%%WWWDIR%%/speedtest.js
+%%WWWDIR%%/speedtest_worker.js
+@owner %%LIBRESPEED_USER%%
+@group %%LIBRESPEED_GROUP%%
+@dir /var/db/librespeed-go
+@dir /var/run/librespeed-go



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