This file is indexed.

postrm is in sidedoor-sudo 0.2.1-1.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh

set -e

# Automatically added by dh_installdeb/10.10.5ubuntu1
dpkg-maintscript-helper rm_conffile /etc/sudoers.d/sudoers 0.2~ -- "$@"
# End automatically added section


SUDOERS=/etc/sudoers.d/sidedoor

pathfind() {
  OLDIFS="$IFS"
  IFS=:
  for p in $PATH; do
    if [ -x "$p/$*" ]; then
      IFS="$OLDIFS"
      return 0
    fi
  done
  IFS="$OLDIFS"
  return 1
}

UCF() {
  if pathfind ucf; then
    ucf "$@"
  fi
}

UCFR() {
  if pathfind ucfr; then
    ucfr "$@"
  fi
}

disable() {
  # Do not use /dev/null in place of tempfile as it will be world-writable.
  if [ -e "$SUDOERS" ]; then
    tempfile="$(mktemp -p /tmp)"
    UCF "$tempfile" "$SUDOERS"
    chmod 0440 "$SUDOERS"  # for extra peace of mind
    UCFR sidedoor-sudo "$SUDOERS"
    rm -f "$tempfile"
  fi
}

purge() {
  for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist; do
    rm -f "${SUDOERS}${ext}"
  done
  rm -f "$SUDOERS"
  UCF --purge "$SUDOERS"
  UCFR --purge sidedoor-sudo "$SUDOERS"

  # If sudo is purged before sidedoor, sudoers.d will be left behind,
  # so try removing it if empty.
  rmdir --ignore-fail-on-non-empty /etc/sudoers.d
}

case "$1" in
  remove)
    # Disable sudo entry immediately, not only when package is purged.
    disable || true
    ;;
  purge)
    purge
    ;;
  upgrade)
    # sidedoor-sudo 0.1.1-1 does not use ucf.
    if dpkg --compare-versions "$2" lt 0.2~; then
      purge
    fi
    ;;
esac