1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-22 04:17:44 +00:00

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)
This commit is contained in:
Koichiro Iwao 2020-06-22 13:10:51 +00:00
parent c166c42935
commit 4c79763fd4
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=539808
6 changed files with 60 additions and 37 deletions

View File

@ -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.etcd.io/bbolt \
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}

View File

@ -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

View File

@ -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"

View File

@ -1,8 +0,0 @@
--- settings.toml.orig 2020-06-02 10:10:50 UTC
+++ settings.toml
@@ -21,4 +21,4 @@ database_username=""
database_password=""
# if you use `bolt` as database, set database_file to database file location
-database_file="speedtest.db"
+database_file="/var/db/speedtest.db"

View File

@ -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
}
]

View File

@ -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