init.d_sobexsrv 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/sbin/openrc-run
  2. # Copyright 1999-2017 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. depend() {
  5. need bluetooth
  6. use logger
  7. }
  8. check_config() {
  9. if [ -z "${USER}" ] ; then
  10. eerror "Please set \$USER in /etc/conf.d/sobexsrv!"
  11. return 1
  12. fi
  13. if [ -z "${GROUP}" ] ; then
  14. eerror "Please set \$GROUP in /etc/conf.d/sobexsrv!"
  15. return 1
  16. fi
  17. if [ ${CHROOT} = "yes" ] ; then
  18. if [ ! -u /usr/bin/sobexsrv ] ; then
  19. eerror "The \$CHROOT option requires /usr/bin/sobexsrv to be suid root!"
  20. return 1
  21. fi
  22. fi
  23. if [ -z "${INBOX}" ] || [ ! -e "${INBOX}" ] ; then
  24. eerror "Please configure \$INBOX correctly in /etc/conf.d/sobexsrv!"
  25. return 1
  26. fi
  27. }
  28. start() {
  29. check_config || return 1
  30. ebegin "Starting sobexsrv"
  31. OPTIONS=""
  32. [ -n "${CHANNEL}" ] && OPTIONS="${OPTIONS} -c ${CHANNEL}"
  33. [ -n "${SECURITY_LEVEL}" ] && OPTIONS="${OPTIONS} -s ${SECURITY_LEVEL}"
  34. [ "${CHROOT}" = "yes" ] && OPTIONS="${OPTIONS} -R"
  35. [ "${DISABLE_OPUSH}" = "yes" ] && OPTIONS="${OPTIONS} -o"
  36. [ "${DISABLE_OBEXFTP}" = "yes" ] && OPTIONS="${OPTIONS} -f"
  37. [ "${DISABLE_OBEXFTP_LISTING}" = "yes" ] && OPTIONS="${OPTIONS} -F"
  38. [ "${USE_SYSLOG}" = "yes" ] && OPTIONS="${OPTIONS} -S"
  39. OPTIONS="-I -r ${INBOX} ${OPTIONS} ${SOBEXSRV_OPT}"
  40. start-stop-daemon --chuid ${USER}:${GROUP} --start --quiet --exec /usr/bin/sobexsrv -- $OPTIONS
  41. eend $?
  42. }
  43. stop() {
  44. ebegin "Stopping sobexsrv"
  45. start-stop-daemon --stop --quiet --exec /usr/bin/sobexsrv
  46. eend $?
  47. }