File: stenographer.postinst

package info (click to toggle)
stenographer 1.0.1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 19,192 kB
  • sloc: cpp: 2,087; sh: 830; yacc: 257; makefile: 102
file content (29 lines) | stat: -rwxr-xr-x 968 bytes parent folder | download | duplicates (4)
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

STENOTYPE=/usr/sbin/stenotype

if [ "$1" = configure ]; then
    if which setcap > /dev/null; then
        if setcap 'CAP_NET_RAW,CAP_NET_ADMIN=ep CAP_IPC_LOCK=ep' "$STENOTYPE"; then
            echo "setcap on $STENOTYPE worked."
            if ! dpkg-statoverride --list $STENOTYPE >/dev/null 2>&1; then
                dpkg-statoverride \
                    --quiet --update \
                    --add stenographer root 0744 $STENOTYPE
            fi
            # twice, since caps seem to be reset after the call above
            setcap 'CAP_NET_RAW,CAP_NET_ADMIN=ep CAP_IPC_LOCK=ep' "$STENOTYPE"
        else
            echo "setcap on $STENOTYPE failed, falling back to setuid."
            if ! dpkg-statoverride --list $STENOTYPE >/dev/null 2>&1; then
                dpkg-statoverride \
                    --quiet --update \
                    --add root stenographer 4754 $STENOTYPE
            fi
        fi
    fi
fi

#DEBHELPER#