forked from dnschneid/crouton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
x11-common
92 lines (75 loc) · 2.87 KB
/
x11-common
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh -e
# Copyright (c) 2016 The crouton Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This isn't a real target; it's the common commands for installing various
# forms of X11.
### Append to prepare.sh:
# Create dummy xserver-xorg-legacy
install_dummy xserver-xorg-legacy
# Store and apply the X11 method
ln -sfT '/etc/crouton/xserverrc' '/etc/X11/xinit/xserverrc'
echo "$XMETHOD" > '/etc/crouton/xmethod'
# Remove old vgem hack
offset="`grep -F -m 1 -boa 'croutonhax' /usr/bin/Xorg 2>/dev/null || true`"
if [ -n "$offset" ]; then
echo -n 'card[0-9]*' | dd seek="${offset%:*}" bs=1 of=/usr/bin/Xorg \
conv=notrunc,nocreat 2>/dev/null
fi
# Install utilities and links for powerd-poking daemon
compile xi2event '-lX11 -lXi' libx11-dev libxi-dev
install --minimal dbus xdg-utils
ln -sf croutonpowerd /usr/local/bin/gnome-screensaver-command
ln -sf croutonpowerd /usr/local/bin/xscreensaver-command
# Install nicer cursors
install --minimal dmz-cursor-theme
# Install bsdmainutils, xbindkeys and xautomation for shortcuts
install --minimal bsdmainutils xbindkeys xautomation
# We need chvt on freon systems
if [ -f "/sys/class/tty/tty0/active" ]; then
install --minimal kbd
# Allow users to run sudo chvt without password, so we don't need to run
# croutoncycle as root
echo '%sudo ALL = NOPASSWD:/bin/chvt' > /etc/sudoers.d/chvt
chmod 440 /etc/sudoers.d/chvt
fi
# Add a blank Xauthority to all users' home directories
touch /etc/skel/.Xauthority
chmod 600 /etc/skel/.Xauthority
# Make xscreensaver default to blank only
echo 'mode: blank' > /etc/skel/.xscreensaver
# Create /usr/share/desktop-directories to avoid issues with xdg-desktop-menu
mkdir -p /usr/share/desktop-directories
# Prevent Upstart from taking over X sessions
if release -eq trusty -eq xenial; then
dpkg-divert --local --rename --add /etc/upstart-xsessions
fi
# FIXME: is this necessary for rootless X11?
# This makes sure Xephyr, running as user, can write server-*.xkm files to
# /var/lib/xkb, so it does not conflict with files created by Chromium OS
# X server in /tmp.
mkdir -p /var/lib/xkb
chgrp video /var/lib/xkb
chmod g+rw /var/lib/xkb
# Update policies for mounting and unmounting devices with udisks2
mkdir -p '/etc/polkit-1/localauthority/10-vendor.d'
cat > '/etc/polkit-1/localauthority/10-vendor.d/10-crouton-udisks2.pkla' <<EOF
[Allow mounting when started from crosh]
Identity=*
Action=org.freedesktop.udisks*.filesystem-mount
ResultAny=auth_admin
ResultInactive=yes
ResultActive=yes
[Allow eject when started from crosh]
Identity=*
Action=org.freedesktop.udisks*.*eject*
ResultAny=auth_admin
ResultInactive=yes
ResultActive=yes
[Disallow unmounting of Chromium OS mounts; it won't work]
Identity=*
Action=org.freedesktop.udisks*.filesystem-unmount-others
ResultAny=no
ResultInactive=no
ResultActive=no
EOF