File: nethack-common.postinst

package info (click to toggle)
nethack 3.6.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,468 kB
  • sloc: ansic: 266,495; cpp: 13,652; yacc: 2,903; perl: 1,426; lex: 581; sh: 535; xml: 372; awk: 98; makefile: 68; fortran: 51; sed: 11
file content (58 lines) | stat: -rw-r--r-- 1,798 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh

# Nethack post-installation script for Debian
#
# Ben Gertzfield (che@debian.org) 29 July 1997
# Joshua Kwan (joshk@triplehelix.org) 11 Oct 2003
# Copyright 1997 Ben Gertzfield, 2003 Joshua Kwan. This script is
# released under the GNU General Public License, version 2 or later.

# Modified 10 October 1997 to fix permissions on /var/games/nethack.
# Modified 18 August 1998 to fix more upgrade problems from ancient
# nethacks
# Modified 11 April 2001 to change path to /var/games/nethack.
# Modified 23 March 2002, removed code to change path from
#  /var/lib/games/nethack -> /var/games/nethack since the save files
#  changed format anyway.
# Modified 11 Oct 2003, move all the preinst stuff here.
# Modified 19 Feb 2009, drop the "backup incompatible" stuff

set -e

. /usr/share/debconf/confmodule

LOGDIR=/var/games/nethack
OLDLOGDIR=/var/lib/games/nethack

if [ "$1" = "configure" ]; then
    db_get nethack-common/recover-setgid

    if [ "$RET" = false ]; then
      # Remove the statoverride that may have been left over from previous
      # configurations
      if dpkg-statoverride --list /usr/lib/games/nethack/recover >/dev/null
      then
        dpkg-statoverride --remove /usr/lib/games/nethack/recover
      fi

      # Remove setgid bit
      chmod 755 /usr/lib/games/nethack/recover
    else
      if ! dpkg-statoverride --list /usr/lib/games/nethack/recover >/dev/null
      then
        dpkg-statoverride --update --add root games 2755 /usr/lib/games/nethack/recover
      fi
    fi

    db_stop

    for file in perm record logfile xlogfile; do
      if [ ! -e /var/games/nethack/$file ]; then
        touch /var/games/nethack/$file
        chmod 0664 /var/games/nethack/$file
        chown root:games /var/games/nethack/$file
      fi
    done
fi

#DEBHELPER#