diff options
-rw-r--r-- | sci-libs/indilib/files/indiserver.conf | 39 | ||||
-rw-r--r-- | sci-libs/indilib/files/indiserver.sh | 42 |
2 files changed, 81 insertions, 0 deletions
diff --git a/sci-libs/indilib/files/indiserver.conf b/sci-libs/indilib/files/indiserver.conf new file mode 100644 index 0000000..d49a468 --- /dev/null +++ b/sci-libs/indilib/files/indiserver.conf @@ -0,0 +1,39 @@ +# This is configuration file for indiserver init script +# +# INDISERVER_OPTS can be used to set flags and options passed to the indiserver binary. +# Available options are +# +# -p <number> Sets the number TCP/IP port number indiserver will listen to. +# Default value is 7624 if not set. +# +# -v, -vv, -vvv Increase verbosity of the output. +# +# -l <dir> Sets the directory where the log will be created. File will +# be named YYYY-MM-DD.islog (this cannot be changed). Use +# app-admin/logrotate to automatically remove old logs if necessary +# +# -m <number> If the client is <number> of MBs behind the server, it should +# be killed. Defaults value is 64. +# +# If you want to use indiserver with the -f flag enabled see INDISERVER_FIFO variable. + +INDISERVER_OPTS="-l /var/log/ -v" + +# You should set INDISERVER_DRIVERS variable to include any driver you want to use, unless +# you use dynamic startup and shutdown of drivers (see the description to the -f option). +# You can get all available drivers by issuing command ls -al /usr/bin/indi_*. Just include +# filenames of the binary drivers you want to use. + +INDISERVER_DRIVERS="" + +# If you want to use indiserver in fifo mode for dynamic startup and shutdown of +# drivers, set the absolute path to the FIFO file (pipe). Init script will create this file +# automaticaly and pass the -f option to the indiserver binary. + +INDISERVER_FIFO="" + +# Configure owner of the indiserver process. This must be existing user account. If you use devices +# connected by USB and serial link this user has to be member of the usb and uucp groups. Defaults to +# indiserver created when sci-libs/indilib has been installed. + +INDISERVER_USER=""
\ No newline at end of file diff --git a/sci-libs/indilib/files/indiserver.sh b/sci-libs/indilib/files/indiserver.sh new file mode 100644 index 0000000..ddedfdf --- /dev/null +++ b/sci-libs/indilib/files/indiserver.sh @@ -0,0 +1,42 @@ +#!/sbin/runscript + +if [ ! "${INDISERVER_USER}" ]; then + INDISERVER_USER="indiserver" +fi + +description="indiserver - INDI astronomical control library server" +command="/usr/bin/indiserver" +command_args="${INDISERVER_OPTS} ${INDISERVER_DRIVERS}" +pidfile="/var/run/indiserver.pid" +start_stop_daemon_args="--pidfile ${pidfile} --make-pidfile --background --user ${INDISERVER_USER}" + +start_pre() { + IFS=' ' read -ra DRIVER <<< "${INDISERVER_DRIVERS}" + for file in "${DRIVER[@]}"; do + if [ ! -x /usr/bin/"${file}" ]; then + eerror "Driver ${file} not found. Check configuration file." + exit 1 + fi + done + if [ "${INDISERVER_FIFO}" ]; then + INDISERVER_OPTS="-f ${INDISERVER_FIFO} ${INDISERVER_OPTS}" + if [ ! -p "${INDISERVER_FIFO}" ]; then + if ! su -m "${INDISERVER_USER}" -c "/usr/bin/mkfifo \"${INDISERVER_FIFO}\""; then + eerror "Could not create FIFO file in ${INDISERVER_FIFO}!" + eerror "indiserver is started with user ${INDISERVER_USER}" + eerror "Check permissions or unset INDISERVER_FIFO in config." + exit 1 + fi + else + ewarn "Strange. FIFO file ${INDISERVER_FIFO} already exists" + fi + fi + return 0 + } + +stop_post() { + if [ -p "${INDISERVER_FIFO}" ]; then + rm -rf "${INDISERVER_FIFO}" + fi + return 0 + }
\ No newline at end of file |