forked from FeralInteractive/gamemode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·50 lines (40 loc) · 1.55 KB
/
bootstrap.sh
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
#!/bin/bash
# Simple bootstrap script to build and run the daemon
if [ "$EUID" -eq 0 ]
then echo "Please don't run bootstrap.sh as root."
exit
fi
set -e
# Check for scaling governor support and warn about it
if [ ! -f "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" ]; then
echo "WARNING: CPUFreq scaling governor device file was not found at \"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor\"."
echo "This probably means that you have disabled processor scheduling features in your BIOS. See README.md (or GitHub issue #44) for more information."
echo "This means GameMode's CPU governor control feature will not work (other features will still work)."
if [ "$CI" != "true" ]; then
# Allow to continue the install, as gamemode has other useful features
read -p "Would you like to continue anyway [y/N]? " -r
[[ $REPLY =~ ^[Yy]$ ]]
fi
fi
# accept a prefix value as: prefix=/path ./bootstrap.sh
: ${prefix:=/usr}
# Echo the rest so it's obvious
set -x
meson builddir --prefix=$prefix --buildtype debugoptimized -Dwith-systemd-user-unit-dir=/etc/systemd/user "$@"
ninja -C builddir
# Verify user wants to install
set +x
if [ "$CI" != "true" ]; then
read -p "Install to $prefix? [y/N] " -r
[[ $REPLY =~ ^[Yy]$ ]]
fi
set -x
sudo ninja install -C builddir
if [ "$CI" != "true" ]; then
# Restart polkit so we don't get pop-ups whenever we pkexec
if systemctl list-unit-files | grep -q polkit.service; then
sudo systemctl try-restart polkit
fi
# Reload systemd configuration so that it picks up the new service.
systemctl --user daemon-reload
fi