File: postinst

package info (click to toggle)
suckless-tools 42-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 736 kB
  • ctags: 785
  • sloc: ansic: 3,133; makefile: 493; sh: 83
file content (29 lines) | stat: -rwxr-xr-x 972 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
#!/bin/sh

set -e

if [ "$1" = "configure" ]; then
    update-alternatives --quiet --install /usr/bin/tabbed tabbed \
        /usr/bin/tabbed.default 100
    update-alternatives --quiet --install /usr/bin/tabbed tabbed \
        /usr/bin/tabbed.meta 50

    # 'slock' needs to set '/proc/PID/oom_score_adj' to a value
    # lower than '0'. Try and set CAP_SYS_RESOURCE to 'slock' binary,
    # which allows us to install it without the setuid bit.
    # We also need to set 'CAP_DAC_OVERRIDE',
    # see http://www.gossamer-threads.com/lists/linux/kernel/1803612.
    if command -v setcap > /dev/null; then
        if ! setcap cap_sys_resource,cap_dac_override+ep /usr/bin/slock; then
            echo "Setcap failed on /usr/bin/slock." \
                "Slock will not be able to disable the OOM killer." >&2
        fi
    else
        echo "Setcap is not installed." \
            "Slock will not be able to disable the OOM killer." >&2
    fi
fi

#DEBHELPER#

exit 0