summarylogtreecommitdiffstats
path: root/chromiumos-ui-service.install
blob: ef0ad115f23727fd3454a2ab62a0f7cda8e4e30e (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
36
post_install() {
    getent group chronos > /dev/null || groupadd chronos
    getent passwd chronos > /dev/null || useradd -m -g chronos chronos

    # Add runuser-l PAM config file if missing
    if ! [[ -f /etc/pam.d/runuser-l ]]; then
        cat > /etc/pam.d/runuser-l << EOF
#%PAM-1.0

# PAM configuration file for runuser -l
# Generated by: chromiumos-ui-service

auth    sufficient pam_rootok.so
session include    system-login
EOF
    fi

    if ! [[ -f /home/chronos/.matchbox/kbdconfig ]]; then
        # Make Matchbox not grab any keyboard shortcuts except for Ctrl-Alt-X
        install -g chronos -o chronos -d /home/chronos/.matchbox
        echo '<ctrl><alt>x=!xterm' > /home/chronos/.matchbox/kbdconfig
        chown chronos:chronos /home/chronos/.matchbox/kbdconfig
    fi
}

post_upgrade() {
    post_install
}

post_remove() {
    if [[ -f /etc/pam.d/runuser-l ]] && grep -q "Generated by: chromiumos-ui-service" /etc/pam.d/runuser-l; then
        rm /etc/pam.d/runuser-l
    fi

    echo "You may want to remove chronos user and group"
}