tang-common.postinst 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 -p "$DB_DIR"
  31. chown _tang:_tang "$DB_DIR"
  32. ;;
  33. abort-upgrade|abort-remove|abort-deconfigure)
  34. ;;
  35. *)
  36. echo "postinst called with unknown argument '$1'" >&2
  37. exit 1
  38. ;;
  39. esac
  40. #DEBHELPER#
  41. exit 0