summaryrefslogtreecommitdiff
path: root/docker-ep.sh
blob: 2f949f573ad9a6f04c3396c5fcc92a8562bf49fa (plain)
  1. #!/bin/bash
  2. ##
  3. ## entrypoint for the docker images
  4. groupmod -g $gid voc
  5. usermod -u $uid -g $gid voc
  6. # check if homedir is mounted
  7. if grep -q '/home/voc' /proc/mounts; then
  8. # homedir is mounted into the docker so don't touch the ownership of the files
  9. true
  10. else
  11. # fixup for changed uid and gid
  12. chown -R voc:voc /home/voc
  13. fi
  14. function startCore() {
  15. if [ -x /bin/gosu ]; then
  16. gosu voc /opt/voctomix/voctocore/voctocore.py -v
  17. else
  18. echo "no gosu found..."
  19. exec su -l -c "/opt/voctomix/voctocore/voctocore.py -v" voc
  20. fi
  21. }
  22. function isVideoMounted() {
  23. return grep -q '/video' /proc/mounts
  24. }
  25. function startGui() {
  26. if [ -x /bin/gosu ]; then
  27. gosu voc /opt/voctomix/voctocore/voctocore.py -v
  28. else
  29. echo "no gosu found..."
  30. exec su -l -c "/opt/voctomix/voctogui/voctogui.py -v" voc
  31. fi
  32. }
  33. function listExamples() {
  34. cd example-scripts/
  35. find -type f
  36. }
  37. function runExample() {
  38. if [ -z $1 ]; then
  39. echo "no valid example! "
  40. fi
  41. FILENAME="example-scripts/$1"
  42. if [ -f ${FILENAME} ]; then
  43. echo "Running: ${FILENAME}"
  44. ${FILENAME}
  45. fi
  46. }
  47. function usage() {
  48. echo "Usage: $0 <cmd>"
  49. echo "help - this text"
  50. echo "core - starts voctomix gore"
  51. echo "gui - starts the voctomix GUI"
  52. echo "examples - lists the example scripts"
  53. echo "scriptname.py - starts the example script named 'scriptname.py' "
  54. }
  55. case $1 in
  56. help )
  57. usage
  58. ;;
  59. examples )
  60. listExamples
  61. ;;
  62. gui )
  63. startGui
  64. ;;
  65. core )
  66. startCore
  67. ;;
  68. * )
  69. runExample $1
  70. ;;
  71. esac