distro-tracker.postinst 745 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. set -e
  3. case "$1" in
  4. configure)
  5. adduser --system --group --shell /bin/bash \
  6. --gecos "Distro Tracker System User" \
  7. --home /var/lib/distro-tracker \
  8. distro-tracker >/dev/null
  9. if [ "$2" = "" ]; then
  10. chown -R distro-tracker:distro-tracker \
  11. /var/cache/distro-tracker \
  12. /var/lib/distro-tracker \
  13. /var/log/distro-tracker
  14. fi
  15. # Create the secret key
  16. if [ ! -f /var/lib/distro-tracker/key ]; then
  17. pwgen -s -y 50 > /var/lib/distro-tracker/key
  18. chown distro-tracker:distro-tracker /var/lib/distro-tracker/key
  19. chmod 640 /var/lib/distro-tracker/key
  20. fi
  21. # Collect the static files
  22. su - distro-tracker -c "distro-tracker collectstatic -v 0 --noinput"
  23. ;;
  24. esac
  25. #DEBHELPER#
  26. exit 0