tang-common.postinst 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  2. set -e
  3. DB_DIR_OLD=/var/db/tang
  4. DB_DIR=/var/lib/tang
  5. case "$1" in
  6. configure)
  7. if ! getent passwd _tang >/dev/null; then
  8. adduser --quiet --system --group --no-create-home --home /nonexistent --force-badname _tang
  9. fi
  10. # Migrate tang db:
  11. # * Change location
  12. # * Give it to _tang user
  13. # This cannot be anchored to a version since the initial setup used
  14. # to be in the tang package.
  15. # (Retire after bookworm release)
  16. if \
  17. [ -d "$DB_DIR_OLD" ] &&
  18. [ ! -d "$DB_DIR" ]
  19. then
  20. echo 'I: Migrating tang db'
  21. mv "$DB_DIR_OLD" "$DB_DIR"
  22. chown -R _tang:_tang "$DB_DIR"
  23. fi
  24. # Possibly remove /var/db/
  25. # (Retire after bookworm release)
  26. if [ -d /var/db/ ] ; then
  27. rmdir /var/db/ >/dev/null 2>&1 || :
  28. fi
  29. # assert db directory
  30. mkdir -m0750 -p "$DB_DIR"
  31. chown _tang:_tang "$DB_DIR"
  32. # assert restrictive permissions upon upgrade
  33. chmod 0750 "$DB_DIR"
  34. ;;
  35. abort-upgrade|abort-remove|abort-deconfigure)
  36. ;;
  37. *)
  38. echo "postinst called with unknown argument '$1'" >&2
  39. exit 1
  40. ;;
  41. esac
  42. #DEBHELPER#
  43. exit 0