postinst 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. #
  3. # Copyright 2021 EMQ Technologies Co., Ltd.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. # postinst script for kuiper
  18. #
  19. # see: dh_installdeb(1)
  20. set -e -u
  21. if command -v systemctl >/dev/null 2>&1; then
  22. systemctl enable kuiper
  23. fi
  24. # create group
  25. if ! getent group kuiper >/dev/null; then
  26. addgroup --system kuiper
  27. fi
  28. # create user
  29. if ! getent passwd kuiper >/dev/null; then
  30. adduser --ingroup kuiper \
  31. --home /var/lib/kuiper \
  32. --disabled-password \
  33. --system --shell /bin/bash --no-create-home \
  34. --gecos "kuiper user" kuiper
  35. fi
  36. chown -R kuiper:kuiper /var/lib/kuiper
  37. chown -R kuiper:kuiper /usr/lib/kuiper
  38. chown -R kuiper:kuiper /etc/kuiper
  39. chmod 0755 /etc/kuiper
  40. chmod 0644 /etc/kuiper/*
  41. chmod -R +X /etc/kuiper
  42. chmod -R 0755 /usr/lib/kuiper/bin
  43. [ -f /usr/bin/kuiperd ] && rm /usr/bin/kuiperd
  44. [ -f /usr/bin/kuiper ] && rm /usr/bin/kuiper
  45. ln -s /usr/lib/kuiper/bin/kuiperd /usr/bin/kuiperd
  46. ln -s /usr/lib/kuiper/bin/kuiper /usr/bin/kuiper
  47. case "$1" in
  48. configure)
  49. ;;
  50. abort-upgrade|abort-remove|abort-deconfigure)
  51. ;;
  52. *)
  53. echo "postinst called with unknown argument \`$1'" >&2
  54. exit 1
  55. ;;
  56. esac
  57. # dh_installdeb will replace this with shell code automatically
  58. # generated by other debhelper scripts.
  59. #DEBHELPER#
  60. exit 0