install.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. # ${project.artifactId} installer for Ubuntu 14.04
  3. if [ `id -u` -ne 0 ]; then
  4. echo ""
  5. echo "Only root can start ${project.artifactId}"
  6. echo ""
  7. exit 1
  8. fi
  9. APP_HOME=$(dirname $(dirname $(readlink -f $0)))
  10. CONFIG_FILE="$APP_HOME/config/configuration.conf.json"
  11. # Create defaults
  12. mkdir -p /etc/default
  13. cat > /etc/default/${project.artifactId} <<-EOF
  14. # Defaults for ${project.artifactId} initscript
  15. # sourced by /etc/init.d/${project.artifactId}
  16. # installed at /etc/default/${project.artifactId} by the maintainer scripts
  17. #
  18. # This is a POSIX shell fragment
  19. #
  20. # Commment next line to disable ${project.artifactId} daemon
  21. START_DAEMON=true
  22. # Whom the daemons should run as
  23. DAEMON_USER=nobody
  24. EOF
  25. # Install binaries
  26. install -o root -g root -m 755 $APP_HOME/bin/start.sh /usr/bin/${project.artifactId}
  27. install -o root -g root -m 755 $APP_HOME/support-files/kurento-demo.sh /etc/init.d/${project.artifactId}
  28. mkdir -p /var/lib/kurento
  29. install -o root -g root $APP_HOME/lib/${project.artifactId}.jar /var/lib/kurento/
  30. [ -f $CONFIG_FILE ] && ( mkdir -p /etc/kurento/ && install -o root -g root $CONFIG_FILE /etc/kurento/${project.artifactId}.conf.json )
  31. # enable ${project.artifactId} start at boot time
  32. # update-rc.d ${project.artifactId} defaults
  33. # start ${project.artifactId}
  34. /etc/init.d/${project.artifactId} restart