smf_install.sh.in 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #! /bin/pfsh
  2. prefix=@prefix@
  3. exec_prefix=@exec_prefix@
  4. grep solaris.smf.value.gearman /etc/security/auth_attr > /dev/null
  5. if [ $? -ne 0 ]
  6. then
  7. ed /etc/security/auth_attr > /dev/null <<EOF
  8. a
  9. solaris.smf.value.gearman:::Change Gearman value properties::
  10. solaris.smf.manage.gearman:::Manage Gearman service states::
  11. .
  12. w
  13. q
  14. EOF
  15. if [ $? -ne 0 ]
  16. then
  17. echo "Failed to add authorization definitions"
  18. exit 1
  19. fi
  20. fi
  21. grep solaris.smf.manage.gearman /etc/security/prof_attr > /dev/null
  22. if [ $? -ne 0 ]
  23. then
  24. ed /etc/security/prof_attr > /dev/null <<EOF
  25. a
  26. Gearman Administration::::auths=solaris.smf.manage.gearman,solaris.smf.value.gearman
  27. .
  28. w
  29. q
  30. EOF
  31. if [ $? -ne 0 ]
  32. then
  33. echo "Failed to add profile definitions"
  34. exit 1
  35. fi
  36. fi
  37. getent group gearmand > /dev/null
  38. if [ $? -ne 0 ]
  39. then
  40. groupadd gearmand
  41. if [ $? -ne 0 ]
  42. then
  43. echo "Failed to create group gearmand"
  44. exit 1
  45. fi
  46. fi
  47. getent passwd gearmand > /dev/null
  48. if [ $? -ne 0 ]
  49. then
  50. roleadd -c "Gearman daemon" -d @localstatedir@ -g gearmand \
  51. -A solaris.smf.value.gearman,solaris.smf.manage.gearman gearmand
  52. if [ $? -ne 0 ]
  53. then
  54. echo "Failed to create role gearmand"
  55. exit 1
  56. fi
  57. mkdir -p @localstatedir@
  58. chown gearmand:gearmand @localstatedir@
  59. fi
  60. /usr/sbin/install -f /lib/svc/method gearmand
  61. if [ $? -ne 0 ]
  62. then
  63. echo "Failed to install smf startup script"
  64. exit 1
  65. fi
  66. /usr/sbin/install -f /var/svc/manifest/application -m 0444 gearmand.xml
  67. if [ $? -ne 0 ]
  68. then
  69. echo "Failed to install smf definition"
  70. exit 1
  71. fi
  72. svccfg import /var/svc/manifest/application/gearmand.xml
  73. if [ $? -ne 0 ]
  74. then
  75. echo "Failed to import smf definition"
  76. exit 1
  77. fi