diff --git a/misc/openhab/Makefile b/misc/openhab/Makefile index b80db1631d25..9b212e8642e9 100644 --- a/misc/openhab/Makefile +++ b/misc/openhab/Makefile @@ -1,78 +1,78 @@ PORTNAME= openhab PORTVERSION= 4.1.3 -PORTREVISION= 0 +PORTREVISION= 1 CATEGORIES= misc java MASTER_SITES= https://openhab.jfrog.io/artifactory/libs-release-local/org/openhab/distro/openhab/${PORTVERSION}/ DISTNAME= openhab-${PORTVERSION} MAINTAINER= netchild@FreeBSD.org COMMENT= Vendor and technology agnostic open source smart-home software WWW= https://www.openhab.org/ LICENSE= EPL LICENSE_FILE= ${WRKSRC}/LICENSE.TXT USES= cpe zip USE_JAVA= yes JAVA_VERSION= 17 JAVA_RUN= yes USE_RC_SUBR= openhab SUB_FILES= pkg-message NO_WRKSUBDIR= yes NO_ARCH= yes USERS= openhab GROUPS= openhab PLIST_SUB= PORTVERSION=${PORTVERSION} post-patch: @${REINPLACE_CMD} -e "s:%%LOCALBASE%%:${LOCALBASE}:g" ${WRKSRC}/runtime/bin/setenv do-build: .for conf in services/runtime.cfg services/addons.cfg html/index.html transform/en.map transform/de.map ${MV} ${WRKSRC}/conf/${conf} ${WRKSRC}/conf/${conf}.sample .endfor ${RM} -r ${WRKSRC}/runtime/bin/contrib ${RM} ${WRKSRC}/*.ps1 ${WRKSRC}/*.bat ${WRKSRC}/runtime/bin/*.ps1 ${WRKSRC}/runtime/bin/*.bat \ ${WRKSRC}/runtime/bin/*.psm1 \ ${WRKSRC}/runtime/bin/setenv.bak \ ${WRKSRC}/runtime/bin/setenv.orig do-install: ${MKDIR} ${STAGEDIR}${PREFIX}/etc/${PORTNAME} ${MKDIR} ${STAGEDIR}${PREFIX}/libexec/${PORTNAME} ${MKDIR} ${STAGEDIR}${PREFIX}/share/${PORTNAME} ${MKDIR} ${STAGEDIR}/var/log/${PORTNAME} ${MKDIR} ${STAGEDIR}/var/db/${PORTNAME} ${MKDIR} ${STAGEDIR}/var/db/${PORTNAME}/home ${MKDIR} ${STAGEDIR}/var/db/${PORTNAME}/persistence ${MKDIR} ${STAGEDIR}/var/db/${PORTNAME}/persistence/db4o ${MKDIR} ${STAGEDIR}/var/db/${PORTNAME}/persistence/rrd4j ${MKDIR} ${STAGEDIR}/var/db/${PORTNAME}/persistence/mapdb ${MKDIR} ${STAGEDIR}/var/db/${PORTNAME}/backups ${MKDIR} ${STAGEDIR}/var/db/${PORTNAME}/userdata ${MKDIR} ${STAGEDIR}/var/db/${PORTNAME}/userdata/etc ${MKDIR} ${STAGEDIR}/var/db/${PORTNAME}/userdata/etc/scripts ${MKDIR} ${STAGEDIR}/var/db/${PORTNAME}/userdata/tmp ${MKDIR} ${STAGEDIR}/var/run/${PORTNAME} (cd ${WRKSRC}/conf && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/etc/${PORTNAME}) (cd ${WRKSRC} && ${COPYTREE_BIN} runtime ${STAGEDIR}${PREFIX}/libexec/${PORTNAME}) (cd ${WRKSRC} && ${COPYTREE_BIN} addons ${STAGEDIR}${PREFIX}/libexec/${PORTNAME}) .for script in start.sh start_debug.sh ${INSTALL_SCRIPT} ${WRKSRC}/${script} ${STAGEDIR}${PREFIX}/libexec/${PORTNAME}/ .endfor (cd ${WRKSRC}/userdata && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/share/${PORTNAME}) gen-plist: ${FIND} ${STAGEDIR} -type f | sed -e "s:${STAGEDIR}${PREFIX}/::g ; s:${PORTVERSION}:%%PORTVERSION%%:g" | sort -u | grep libexec/ >pkg-plist.new echo '@owner openhab' >>pkg-plist.new echo '@group openhab' >>pkg-plist.new ${FIND} ${STAGEDIR}${DATADIR} -type f | sed -E -e "s:${STAGEDIR}${DATADIR}/(.*):@sample %%DATADIR%%/\\1 /var/db/openhab/userdata/\\1:g ; s:${PORTVERSION}:%%PORTVERSION%%:g" | sort -u >>pkg-plist.new ${FIND} ${STAGEDIR}${ETCDIR} -type d | sort -u | sed -e "s:${STAGEDIR}${ETCDIR}:@dir %%ETCDIR%%:g ; s:${PORTVERSION}:%%PORTVERSION%%:g" >>pkg-plist.new ${FIND} ${STAGEDIR}${ETCDIR} -type f | sort -u | sed -E -e "s:${STAGEDIR}${ETCDIR}/:%%ETCDIR%%/:g ; s:${PORTVERSION}:%%PORTVERSION%%:g ; s:(.*.sample)$:@sample(openhab,openhab,640) \\1:" >>pkg-plist.new ${FIND} ${STAGEDIR}/var/db/${PORTNAME} -type d | sort -ru | sed -e "s:${STAGEDIR}:@dir :g" >>pkg-plist.new echo "@dir /var/log/${PORTNAME}" >>pkg-plist.new echo "@dir /var/run/${PORTNAME}" >>pkg-plist.new .include diff --git a/misc/openhab/files/openhab.in b/misc/openhab/files/openhab.in index 7acec2be6e34..eab88273ea97 100644 --- a/misc/openhab/files/openhab.in +++ b/misc/openhab/files/openhab.in @@ -1,118 +1,119 @@ #!/bin/sh # # PROVIDE: openhab # REQUIRE: LOGIN # KEYWORD: shutdown # # Add these lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # # openhab_enable (bool): Set to NO by default. # Set it to YES to enable openhab. # openhab_user (username): Set to openhab by default. # openhab_group (groupname): Set to openhab by default. # openhab_http_port (port): Set to 8080 by default. # openhab_https_port (port): Set to 8443 by default. # openhab_listen_address (IP): Set to 0.0.0.0 for http/https by default. # openhab_backup_dir (path): Set to /var/db/openhab/backups by default. # openhab_java_opts (string): Empty by default. You can add additional java # options like -Duser.timezone=Europe/Berlin and/or # -Dgnu.io.rxtx.SerialPorts=/dev/cuau0 # -Dsun.nio.fs.watchservice=polling # openhab_home_dir (path): Set to %%PREFIX%%/libexec/openhab by default. # openhab_conf_dir (path): Set to %%PREFIX%%/etc/openhab by default. # openhab_runtime_dir (path): Set to %%PREFIX%%/libexec/openhab/runtime by default. # openhab_userdata_dir (path): Set to /var/db/openhab/userdata by default. # openhab_log_dir (path): Set to /var/log/openhab by default. . /etc/rc.subr case $0 in /etc/rc*) # during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown), # so get the name of the script from $_file name=$_file ;; *) name=$0 ;; esac name=${name##*/} rcvar=${name}_enable load_rc_config "${name}" eval "${rcvar}=\${${rcvar}:-'NO'}" +eval "${name}_svcj_options=\${${name}_svcj_options:-'net_basic'}" eval "_openhab_user=\${${name}_user:-'openhab'}" eval "_openhab_group=\${${name}_group:-'openhab'}" eval "_openhab_http_port=\${${name}_http_port:-'8080'}" eval "_openhab_https_port=\${${name}_https_port:-'8443'}" eval "_openhab_listen_address=\${${name}_listen_address:-'0.0.0.0'}" eval "_openhab_backup_dir=\${${name}_backup_dir:-'/var/db/openhab/backups'}" eval "_openhab_home_dir=\${${name}_home_dir:-'%%PREFIX%%/libexec/openhab'}" eval "_openhab_conf_dir=\${${name}_conf_dir:-'%%PREFIX%%/etc/openhab'}" eval "_openhab_runtime_dir=\${${name}_runtime_dir:-'%%PREFIX%%/libexec/openhab/runtime'}" eval "_openhab_userdata_dir=\${${name}_userdata_dir:-'/var/db/openhab/userdata'}" eval "_openhab_log_dir=\${${name}_log_dir:-'/var/log/openhab'}" eval "_openhab_piddir=\${${name}_piddir:-/var/run/${name}}" eval "_openhab_java_opts=\${${name}_java_opts:-''}" export OPENHAB_USER="${_openhab_user}" export OPENHAB_GROUP="${_openhab_group}" export OPENHAB_HTTP_PORT="${_openhab_http_port}" export OPENHAB_HTTPS_PORT="${_openhab_https_port}" export OPENHAB_HTTP_ADDRESS="${_openhab_listen_address}" export OPENHAB_BACKUPS="${openhab_backup_dir}" export EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/cuau0 -Dsun.nio.fs.watchservice=polling ${_openhab_java_opts}" export OPENHAB_HOME="${_openhab_home_dir}" export OPENHAB_CONF="${_openhab_conf_dir}" export OPENHAB_RUNTIME="${_openhab_runtime_dir}" export OPENHAB_USERDATA="${_openhab_userdata_dir}" export OPENHAB_LOGDIR="${_openhab_log_dir}" # for UTF-8 encoding, language can be set inside openhab: export LC_ALL=en_US.UTF-8 export JAVA_VERSION=17 pidfile=${_openhab_piddir}/${name}.pid start_precmd="openhab_prestart" command=/usr/sbin/daemon command_args="-u ${_openhab_user} -p ${pidfile} -c -t openhab ${OPENHAB_HOME}/start.sh server" openhab_prestart() { # Make sure we have our RUNDIR, even if it's on a tmpfs install -d -o ${_openhab_user} -g ${_openhab_group} -m 0755 "${_openhab_piddir}" install -d -o ${_openhab_user} -g ${_openhab_group} -m 0755 "${_openhab_log_dir}" } openhab_stop() { su -m ${_openhab_user} -c "${OPENHAB_RUNTIME}/bin/stop" if [ -e ${pidfile} ]; then wait_for_pids $(cat ${pidfile}) fi } openhab_status() { case "$(${OPENHAB_RUNTIME}/bin/status 2>&1)" in "Not Running ...") echo ${name} is not running, ;; "Running ...") echo ${name} is running. ;; esac } stop_cmd="openhab_stop" status_cmd="openhab_status" run_rc_command "$1"