summaryrefslogtreecommitdiffstats
path: root/debian/screen.postinst
blob: 687579fedb0831947db7a92271bc66c1ed7359b2 (plain)
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
#!/bin/sh
set -e

. /usr/share/debconf/confmodule

if [ "$1" = configure ]; then
  if ! test -d /run/screen; then
    install -g utmp -m 0775 -d /run/screen
  fi
  perms="`stat -c%a /usr/bin/screen`"
  override=/etc/tmpfiles.d/screen-cleanup.conf
  if [ $perms -eq 4755 ]; then
    chmod 0755 /run/screen
    if [ ! -f $override ]; then
       echo 'd /run/screen 0755 root utmp' > $override
    fi
  elif [ $perms -eq 755 ]; then
    chmod 1777 /run/screen
    if [ ! -f $override ]; then
       echo 'd /run/screen 1777 root utmp' > $override
    fi
  fi

  # LP #1462692
  servicedir=/lib/systemd/system
  servicefile=$servicedir/screen-cleanup.service
  mkdir -p $servicedir
  if [ ! -e $servicefile ]; then
      ln -s /dev/null $servicefile
  fi

  add-shell /usr/bin/screen || true
fi

#DEBHELPER#