422664d08d42b3acd3bbe588b211e515dca43863
[workstation-ostree-config.git] / pitti-post.sh
1 #!/usr/bin/env bash
2 set -xeuo pipefail
3
4 # Install local RPMs
5 rpm -i --verbose /usr/lib/local-rpms/*.rpm
6 rm -rf /usr/lib/local-rpms
7
8 # Enable SysRQ
9 echo 'kernel.sysrq = 1' > /etc/sysctl.d/90-sysrq.conf
10
11 # power saving
12 echo 'blacklist e1000e' > /etc/modprobe.d/blacklist-local.conf
13
14 # NetworkManager config
15 cat <<EOF > /etc/NetworkManager/conf.d/local.conf
16 [main]
17 plugins=
18 dns=dnsmasq
19 dhcp=internal
20 EOF
21
22 # X11/DM config
23 cat <<EOF > /etc/X11/xorg.conf.d/01-intel.conf
24 Section "Device"
25         Identifier "Intel"
26         Driver "intel"
27 EndSection
28 EOF
29
30 cat <<EOF > /etc/lxdm/LoginReady
31 #!/bin/sh
32 export XAUTHORITY=/run/lxdm/lxdm-:0.auth
33 if xrandr | grep -q 'HDMI3 connected'; then
34         xrandr --output LVDS1 --off --output HDMI3 --primary
35 fi
36 EOF
37 chmod a+x /etc/lxdm/LoginReady
38
39 # fix and enable apt-cacher-ng
40 mkdir -p /etc/systemd/system/apt-cacher-ng.service.d
41 cat <<EOF > /etc/systemd/system/apt-cacher-ng.service.d/override.conf
42 [Service]
43 Type=simple
44 PIDFile=
45 ExecStart=
46 ExecStart=/usr/sbin/apt-cacher-ng \$DAEMON_OPTS SocketPath=/run/apt-cacher-ng/socket foreground=1
47 RuntimeDirectory=apt-cacher-ng
48 User=apt-cacher-ng
49 EOF
50 ln -sf /usr/lib/systemd/system/apt-cacher-ng.service /etc/systemd/system/multi-user.target.wants/apt-cacher-ng.service
51
52 # Lock screen on suspend
53 cat <<EOF > /etc/systemd/system/suspend-lock.service
54 [Unit]
55 Description=Lock martin's i3 on suspend
56 Before=sleep.target
57
58 [Service]
59 User=martin
60 Environment=DISPLAY=:0
61 ExecStart=/usr/bin/i3lock -n
62
63 [Install]
64 WantedBy=sleep.target
65 EOF
66 mkdir -p /etc/systemd/system/sleep.target.wants/
67 ln -sf /etc/systemd/system/suspend-lock.service /etc/systemd/system/sleep.target.wants/suspend-lock.service
68
69 # schroot: use tmpfs for sessions
70 echo 'L+ /var/lib/schroot - - - - /run/schroot' > /usr/lib/tmpfiles.d/0-schroot.conf
71 echo 'd /run/schroot/session 0755 root root' >> /usr/lib/tmpfiles.d/0-schroot.conf
72 # schroot: mount home directory
73 echo '/var/home /var/home none rw,bind 0 0' >> /etc/schroot/default/fstab