-
Notifications
You must be signed in to change notification settings - Fork 223
Update Debian Package Services and Config Directory #1855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 14 commits
9d6b770
693dc63
14d6d7e
2758515
48d7dfb
12090e6
84282f4
9ffb314
896b13f
bd89102
e905f02
d24b096
886c092
24d2cec
977dca8
b31073a
146a9d1
8729000
1740d5a
0bf40e7
b66a17a
f903797
938733c
5111428
dab152a
0f3cf4b
c4c97a2
46cb35e
66ba156
c6a521a
cc2be83
f134516
4e6477a
23e29c3
60f615f
3a3db2e
28469df
059bc44
8015767
49d4d44
2abcdb8
cb606a0
dda1a02
26844bb
e83dca1
8aacbd4
41df99d
5a46575
ccb128e
30906cf
c00183a
08d6a95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| etc/ola | ||
| usr/bin | ||
| usr/lib | ||
| usr/share |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,16 +17,11 @@ DAEMON=/usr/bin/$NAME | |
| PIDFILE=/var/run/$CMD.pid | ||
| DESC="OLA RDM Test Server" | ||
| USER=olad | ||
| DAEMON_ARGS="--world-writable" | ||
|
|
||
| # Reads config file (will override defaults above) | ||
| [ -r /etc/default/ola-rdm-tests ] && . /etc/default/ola-rdm-tests | ||
|
|
||
| if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] ; then | ||
| DAEMON_ARGS="--world-writeable" | ||
| elif [ "$1" = "start" ] || [ "$1" = "stop" ] ; then | ||
| echo "The init script is currently inactive;\nuse \"dpkg-reconfigure ola-rdm-tests\" to change this." >&2 | ||
| fi | ||
|
|
||
|
Comment on lines
-24
to
-29
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know how major an issue we feel this is, but it will be a breaking change for anyone using our version of the deb build/init script. I don't believe it's been in Debian's shipped version for ages (ever?). We could split this in half so the additions were in 0.11.0 and the removal/tidying was in whatever we call the next version...
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my rationale at the start of the PR. The Debian build in this repo had been nonfunctional for so long that there is no way anyone is using it. |
||
| [ -x "$DAEMON" ] || exit 0 | ||
|
|
||
| . /lib/lsb/init-functions | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| [Unit] | ||
| Description=Open Lighting Architecture RDM Test Server | ||
| Documentation=man:olad(1) | ||
DaAwesomeP marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| After=network.target remote-fs.target olad.service | ||
| Wants=olad.service | ||
|
|
||
| [Service] | ||
| User=olad | ||
| Environment=RDM_TEST_SERVER_OPTS="--world-writable" | ||
yoe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ExecStart=/usr/bin/rdm_test_server.py $RDM_TEST_SERVER_OPTS | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target | ||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| etc/ola | ||
| usr/bin | ||
| usr/lib | ||
| usr/share/olad/www | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,16 +17,13 @@ PIDFILE=/var/run/$NAME.pid | |
| DESC="OLA daemon" | ||
| USER=olad | ||
| LOG_LEVEL=3 | ||
| CONFIG_DIR="/var/lib/ola/conf" | ||
| CONFIG_DIR="/etc/ola" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will be a bigger breaking change for those users!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same applies here. I am quite confident that nobody is using our deb package over the Debian one. |
||
| OLAD_OPTS="" | ||
|
|
||
| # Reads config file (will override defaults above) | ||
| [ -r /etc/default/ola ] && . /etc/default/ola | ||
|
|
||
| if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] ; then | ||
| DAEMON_ARGS="--syslog --log-level $LOG_LEVEL --config-dir $CONFIG_DIR" | ||
| elif [ "$1" = "start" ] || [ "$1" = "stop" ] ; then | ||
| echo "The init script is currently inactive;\nuse \"dpkg-reconfigure ola\" to change this." >&2 | ||
| fi | ||
| DAEMON_ARGS="--syslog --log-level $LOG_LEVEL --config-dir $CONFIG_DIR $OLAD_OPTS" | ||
|
|
||
| [ -x "$DAEMON" ] || exit 0 | ||
|
|
||
|
|
@@ -43,12 +40,10 @@ case "$1" in | |
| ;; | ||
| stop) | ||
| # master switch | ||
| if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] ; then | ||
| log_daemon_msg "Stopping $DESC" "$NAME" | ||
| /sbin/start-stop-daemon --stop --pidfile $PIDFILE --chuid $USER --exec $DAEMON --retry 10 | ||
| /bin/rm -f $PIDFILE | ||
| log_end_msg $? | ||
| fi | ||
| log_daemon_msg "Stopping $DESC" "$NAME" | ||
| /sbin/start-stop-daemon --stop --pidfile $PIDFILE --chuid $USER --exec $DAEMON --retry 10 | ||
| /bin/rm -f $PIDFILE | ||
| log_end_msg $? | ||
| ;; | ||
| reload|force-reload|restart) | ||
| $0 stop && $0 start | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should also consider what other settings we should merge in from https://github.com/OpenLightingProject/ola/pull/1444/files#diff-f6474409cdd97933e66d7f3eb687aa1bc0c23b9a6785394a5a1eb884a00d7d29 initially, versus possibly wait for the notify stuff in the next release?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR has been open for nearly 3 years, so I'd like to just get this going and come back to the other parts.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also discussed this here in this PR: #1855 (comment) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [Unit] | ||
| Description=Open Lighting Architecture daemon | ||
| Documentation=man:olad(1) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add these in a followup PR? I want to avoid tacking on anything else to this PR since it has been open so long. Separately, I think these links should go in the man page instead of in the Systemd service. That way you see them no matter how you get to the docs on Debian. Also means fewer places to keep them updated. |
||
| After=network.target remote-fs.target network-online.target | ||
| Wants=network-online.target | ||
|
|
||
| [Service] | ||
| User=olad | ||
| Environment=LOG_LEVEL=3 | ||
| Environment=CONFIG_DIR=/etc/ola | ||
| Environment=OLAD_OPTS= | ||
| ExecStart=/usr/bin/olad --log-level $LOG_LEVEL --config-dir $CONFIG_DIR $OLAD_OPTS | ||
| Restart=on-failure | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,74 +1,15 @@ | ||
| #!/bin/sh -e | ||
| # postinst script for ola | ||
|
|
||
| conffile="/etc/default/ola" | ||
|
|
||
| update_config_file() { | ||
| db_field=$1 | ||
| config_field=$2 | ||
|
|
||
| RET=false | ||
| db_get $db_field | ||
| if [ -n "$RET" ] ; then | ||
| if grep -q "^$config_field" $conffile ; then | ||
| # keep any admin changes, while replacing the variable content | ||
| sed "s/^[ ]*$config_field=\".*\"/$config_field=\"$RET\"/" < $conffile > $conffile.new && | ||
| mv $conffile.new $conffile | ||
| else | ||
| echo "$config_field=\"$RET\"" >> $conffile | ||
| fi | ||
| fi | ||
| } | ||
|
|
||
| # Source debconf library -- we have a Depends line | ||
| # to make sure it is there... | ||
| . /usr/share/debconf/confmodule | ||
| db_version 2.0 | ||
|
|
||
| case "$1" in | ||
| configure) | ||
| if [ -f $conffile ] ; then | ||
| sed -i -e 's/^[ ]*DAEMON/RUN_DAEMON/g' $conffile | ||
| else | ||
| cat << EOF > $conffile | ||
| # Defaults for ola initscript (/etc/init.d/ola) | ||
| # This is a POSIX shell fragment | ||
|
|
||
| # [automatically edited by postinst, do not change line format ] | ||
|
|
||
| # ola daemon switch. If set to true, olad will run. | ||
| RUN_DAEMON="true" | ||
| EOF | ||
| fi | ||
|
|
||
| update_config_file ola/daemon RUN_DAEMON | ||
|
|
||
| db_stop | ||
| ;; | ||
|
|
||
| abort-upgrade|abort-remove|abort-deconfigure) | ||
| ;; | ||
|
|
||
| *) | ||
| echo "postinst called with unknown argument \`$1'" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| #create the olad user, add it to groups | ||
| getent passwd olad > /dev/null || adduser --system --no-create-home olad | ||
| getent passwd olad > /dev/null || adduser --system --home /usr/lib/olad --no-create-home olad | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need to specify a home despite not creating one?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the Linux user still has a directory associated with it even a directory is not created. By default this is |
||
| getent group olad > /dev/null || addgroup --system olad | ||
| groups olad | grep dialout > /dev/null || adduser olad dialout | ||
| groups olad | grep plugdev > /dev/null || adduser olad plugdev | ||
|
|
||
| # setup the config dir | ||
| CONF_DIR=/var/lib/ola | ||
| if [ ! -d ${CONF_DIR} ]; then | ||
| mkdir -p ${CONF_DIR}; | ||
| chown -R olad:olad ${CONF_DIR}; | ||
| chmod g+s ${CONF_DIR}; | ||
| fi; | ||
|
|
||
| chown -R olad:olad /etc/ola | ||
| chmod g+s /etc/ola | ||
|
|
||
| # dh_installdeb will replace this with shell code automatically | ||
| # generated by other debhelper scripts. | ||
|
|
||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.