postinst 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #!/bin/sh
  2. # Post-install script for ‘bsdgames’ package.
  3. #
  4. # Man page: ‘dh_installdeb(1)’
  5. set -e
  6. # Summary of ways this script can be called:
  7. # * <postinst> ‘configure’ <most-recently-configured-version>
  8. # * <old-postinst> ‘abort-upgrade’ <new version>
  9. # * <conflictor-postinst> ‘abort-remove’
  10. # ‘in-favour’ <package> <new-version>
  11. # * <deconfigured-postinst> ‘abort-deconfigure’
  12. # ‘in-favour’ <failed-install-package> <version>
  13. # ‘removing’ <conflicting-package> <version>
  14. # For details, see <URL:http://www.debian.org/doc/debian-policy/> or
  15. # the ‘debian-policy’ package.
  16. action="$1"
  17. SCOREFILES="
  18. /var/games/bsdgames/atc_score
  19. /var/games/bsdgames/battlestar.log
  20. /var/games/bsdgames/cfscores
  21. /var/games/bsdgames/criblog
  22. /var/games/bsdgames/robots_roll
  23. /var/games/bsdgames/saillog
  24. /var/games/bsdgames/snake.log
  25. /var/games/bsdgames/snakerawscores
  26. /var/games/bsdgames/tetris-bsd.scores
  27. /var/games/bsdgames/phantasia/characs
  28. /var/games/bsdgames/phantasia/gold
  29. /var/games/bsdgames/phantasia/lastdead
  30. /var/games/bsdgames/phantasia/mess
  31. /var/games/bsdgames/phantasia/motd
  32. /var/games/bsdgames/phantasia/scoreboard
  33. /var/games/bsdgames/phantasia/void
  34. /var/games/bsdgames/phantasia/monsters
  35. /var/games/bsdgames/hack/perm
  36. /var/games/bsdgames/hack/record"
  37. # Hack moved over from bsdgames-nonfree.
  38. if [ -d /var/games/bsdgames-nonfree ]; then
  39. for file in perm record; do
  40. if [ -e /var/games/bsdgames-nonfree/hack/$file ]; then
  41. mv -f /var/games/bsdgames-nonfree/hack/$file \
  42. /var/games/bsdgames/hack/$file
  43. fi
  44. done
  45. cp -a -f /var/games/bsdgames-nonfree/hack/save/* \
  46. /var/games/bsdgames/hack/save/ 2>/dev/null || true
  47. rm -f /var/games/bsdgames-nonfree/hack/save/* 2>/dev/null || true
  48. rmdir -p /var/games/bsdgames-nonfree/hack/save 2>/dev/null || true
  49. fi
  50. # These files cannot just be zero-byte files:
  51. if [ ! -e /var/games/bsdgames/phantasia/void ]; then
  52. cp /usr/share/games/bsdgames/phantasia/void \
  53. /var/games/bsdgames/phantasia/void
  54. fi
  55. if [ ! -e /var/games/bsdgames/phantasia/monsters ] ; then
  56. cp /usr/share/games/bsdgames/phantasia/monsters \
  57. /var/games/bsdgames/phantasia/monsters
  58. fi
  59. touch $SCOREFILES
  60. chown root:games $SCOREFILES
  61. chmod 664 $SCOREFILES
  62. # These files may not be world-readable as they have passwords
  63. # in them.
  64. chmod 660 /var/games/bsdgames/phantasia/characs
  65. ADVENTURE_PRIORITY=50
  66. case "$action" in
  67. configure)
  68. update-alternatives --install \
  69. /usr/games/adventure adventure \
  70. /usr/games/bsdgames-adventure $ADVENTURE_PRIORITY \
  71. --slave \
  72. /usr/share/man/man6/adventure.6.gz adventure.6.gz \
  73. /usr/share/man/man6/bsdgames-adventure.6.gz
  74. ;;
  75. abort-upgrade|abort-remove|abort-deconfigure)
  76. ;;
  77. *)
  78. printf "postinst called with unknown action ‘%s’\n" "$action" >&2
  79. exit 1
  80. ;;
  81. esac
  82. # I have to make this directory here, because older version of this package
  83. # always deleted it in their postrm. Oops.
  84. mkdir -p /var/games/bsdgames/sail
  85. chown root:games /var/games/bsdgames/sail
  86. chmod g+rws /var/games/bsdgames/sail
  87. #DEBHELPER#
  88. exit 0