Hi Antoine, do you have any feedback on the rc.d parts please?
Do you think the variabke setting bits are alright for rc.d or would
they be better split off to a different script?


----- Forwarded message from Stuart Henderson <s...@spacehopper.org> -----

From: Stuart Henderson <s...@spacehopper.org>
Date: Mon, 26 Feb 2024 18:10:57 +0000
To: Chaz Kettleson <c...@pyr3x.com>
Cc: A Tammy <openbsd.po...@aisha.cc>, Kirill Bychkov <ki...@linklevel.net>,
        ports@openbsd.org
Subject: Re: [NEW]: misc/openhab - open Home Automation Bus (openHAB)
Mail-Followup-To: Chaz Kettleson <c...@pyr3x.com>, A Tammy
        <openbsd.po...@aisha.cc>, Kirill Bychkov <ki...@linklevel.net>,
        ports@openbsd.org

Here are some tweaks on top (sent as a diff for commentary and a new
tar).

I'd like the opinion of someone with a hand in the rc.d system to
comment on that part. Maybe they'll be ok with it, but it's a bit
complicated and not something that I think we do in any other ports.
On the other hand I'm not sure I can think of a nice alternative..

: diff --git a/misc/openhab/Makefile b/misc/openhab/Makefile
: index 3ff4984..dc582de 100644
: --- a/misc/openhab/Makefile
: +++ b/misc/openhab/Makefile
: @@ -28,16 +28,12 @@ pre-extract:
:       @mkdir ${WRKDIST}
:  
:  do-install:
: -     ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/${PKGSTEM}/
: +     ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/openhab/

the ${PKGSTEM} indirection isn't really useful imho and makes it harder
to read, I've replaced with openhab throughout

: -     ${INSTALL_DATA} ${FILESDIR}/${PKGSTEM}.conf \
: -             ${PREFIX}/share/examples/${PKGSTEM}/
: -     ${INSTALL_DATA_DIR} ${PREFIX}/libexec/${PKGSTEM}/
: -     @cd ${WRKDIST} && openrsync --rsync-path=openrsync -a \
: -             --exclude={'./conf','./userdata'} . 
${PREFIX}/libexec/${PKGSTEM}/
: -     ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/${PKGSTEM}/etc/
: -     @cd ${WRKDIST}/conf && pax -rw . 
${PREFIX}/share/examples/${PKGSTEM}/etc/
: -     ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/${PKGSTEM}/var/
: -     @cd ${WRKDIST}/userdata && pax -rw . \
: -             ${PREFIX}/share/examples/${PKGSTEM}/var/
: +     ${INSTALL_DATA} ${FILESDIR}/openhab.conf \
: +             ${PREFIX}/share/examples/openhab/
: +     ${INSTALL_DATA_DIR} ${PREFIX}/libexec/openhab/
: +     cd ${WRKDIST} && pax -rw . ${PREFIX}/libexec/openhab/
: +     mv ${PREFIX}/libexec/openhab/conf ${PREFIX}/share/examples/openhab/
: +     mv ${PREFIX}/libexec/openhab/userdata ${PREFIX}/share/examples/openhab/

not really a fan of using openrsync to copy files around, so I've
replaced it by copying all files with pax to libexec, then moving the
couple of dirs which should end up in examples. I kept the original
dir names and adjusted PLIST to match.

: diff --git a/misc/openhab/pkg/PLIST b/misc/openhab/pkg/PLIST
: index 1e76d42..8144a30 100644
: --- a/misc/openhab/pkg/PLIST
: +++ b/misc/openhab/pkg/PLIST
: @@ -1,6 +1,5 @@
: -@newgroup _openhab:896
: -@newuser _openhab:896:_openhab::openHAB user:/nonexistent:/sbin/nologin
: +@newgroup _openhab:897
: +@newuser _openhab:897:_openhab::openHAB user:/nonexistent:/sbin/nologin

896 is taken now, switch to 897

: -@exec-add usermod -G dialer _openhab

I don't think the package should auto-add itself to what in some
circumstances could be a sensitive group. Could maybe be suggested
in the readme (I haven't done so myself because I don't know which
circumstances need it and I think that should be explained).

:  @rcscript ${RCDIR}/openhab
:  libexec/openhab/
:  libexec/openhab/LICENSE.TXT
: @@ -1225,203 +1224,203 @@ libexec/openhab/start_debug.sh
:  share/doc/pkg-readmes/${PKGSTEM}
:  share/examples/openhab/
:  @sample ${SYSCONFDIR}/openhab/
: -share/examples/openhab/etc/
: +share/examples/openhab/conf/
...
<snip mechanical changes relating to paths in share/examples>

: diff --git a/misc/openhab/pkg/openhab.rc b/misc/openhab/pkg/openhab.rc
: index ea7a859..4284a62 100644
: --- a/misc/openhab/pkg/openhab.rc
: +++ b/misc/openhab/pkg/openhab.rc
: @@ -1,7 +1,7 @@
:  #!/bin/ksh
:  
: -JAVA="$(${LOCALBASE}/bin/javaPathHelper -c ${PKGSTEM})"
: -JAVA_HOME="$(${LOCALBASE}/bin/javaPathHelper -h ${PKGSTEM})"
: +JAVA="$(${LOCALBASE}/bin/javaPathHelper -c openhab)"
: +JAVA_HOME="$(${LOCALBASE}/bin/javaPathHelper -h openhab)"

avoid indirection again

:  # Read configuration variable file if it is present
:  if [ -r /etc/openhab.conf ]; then
: @@ -13,12 +13,12 @@ if [ -z "${EXTRA_JAVA_OPTS}" ];           then 
EXTRA_JAVA_OPTS="-Dsun.nio.fs.watchservice
:  if [ -z "${OPENHAB_HTTP_ADDRESS}" ]; then OPENHAB_HTTP_ADDRESS="127.0.0.1"; 
fi
:  if [ -z "${OPENHAB_HTTP_PORT}" ];    then OPENHAB_HTTP_PORT=8080; fi
:  if [ -z "${OPENHAB_HTTPS_PORT}" ];   then OPENHAB_HTTPS_PORT=8443; fi
: -if [ -z "${OPENHAB_HOME}" ];         then 
OPENHAB_HOME="${PREFIX}/libexec/${PKGSTEM}"; fi
: -if [ -z "${OPENHAB_CONF}" ];         then 
OPENHAB_CONF="${SYSCONFDIR}/${PKGSTEM}"; fi
: +if [ -z "${OPENHAB_HOME}" ];         then 
OPENHAB_HOME="${PREFIX}/libexec/openhab"; fi
: +if [ -z "${OPENHAB_CONF}" ];         then 
OPENHAB_CONF="${SYSCONFDIR}/openhab"; fi
:  if [ -z "${OPENHAB_RUNTIME}" ];              then 
OPENHAB_RUNTIME="${OPENHAB_HOME}/runtime"; fi
: -if [ -z "${OPENHAB_USERDATA}" ];     then 
OPENHAB_USERDATA="/var/db/${PKGSTEM}"; fi
: +if [ -z "${OPENHAB_USERDATA}" ];     then 
OPENHAB_USERDATA="/var/db/openhab"; fi
:  if [ -z "${OPENHAB_BACKUPS}" ];              then 
OPENHAB_BACKUPS="${OPENHAB_USERDATA}/backups"; fi
: -if [ -z "${OPENHAB_LOGDIR}" ];               then 
OPENHAB_LOGDIR="/var/log/${PKGSTEM}"; fi
: +if [ -z "${OPENHAB_LOGDIR}" ];               then 
OPENHAB_LOGDIR="/var/log/openhab"; fi
:  
:  ENV="JAVA_HOME=${JAVA_HOME} \
:       EXTRA_JAVA_OPTS=\"${EXTRA_JAVA_OPTS}\" \




----- End forwarded message -----

Attachment: openhab.tgz
Description: application/tar-gz

Reply via email to