-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·80 lines (67 loc) · 3.13 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·80 lines (67 loc) · 3.13 KB
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
#!/usr/bin/bash
# Installs Handheld Daemon to ~/.local/share/hhd
if [ "$EUID" = 0 ]; then
echo "You should run this script as your user, not root (sudo)."
exit
fi
is_bazzite=$(cat /etc/os-release | sed -e 's/\(.*\)/\L\1/' | grep bazzite)
if [ "${is_bazzite}" ]; then
echo "Installing Handheld Daemon on Bazzite is not supported."
echo
echo "For Handheld Daemon in desktop mode/gamemode you can use Anatase"
echo "https://docs.anatase.org/basics/install#rebasing-from-bazzite"
exit
fi
is_steamos=$(cat /etc/os-release | grep ID=steamos)
if [[ -n "${is_steamos}" && -z "${BYPASS_STEAMOS_CHECK}" ]]; then
echo "Installing Handheld Daemon on SteamOS is not canon."
echo
echo "Did you mean to install Anatase? https://anatase.org"
exit
fi
is_anatase=$(cat /etc/os-release | sed -e 's/\(.*\)/\L\1/' | grep anatase)
if [ "${is_anatase}" ]; then
echo "Installing Handheld Daemon is preinstalled on Anatase."
echo
echo "Do not try to install it again. For issues, please head to Discord or the Issue tracker"
exit
fi
set -e
# Install Handheld Daemon to ~/.local/share/hhd
mkdir -p ~/.local/share/hhd && cd ~/.local/share/hhd
python3 -m venv --system-site-packages venv
source venv/bin/activate
pip3 install --upgrade hhd adjustor
# Install udev rules and create a service file
sudo mkdir -p /etc/udev/rules.d/
sudo mkdir -p /etc/udev/hwdb.d/
sudo curl https://raw.githubusercontent.com/hhd-dev/hhd/master/usr/lib/udev/rules.d/83-hhd.rules -o /etc/udev/rules.d/83-hhd.rules
sudo curl https://raw.githubusercontent.com/hhd-dev/hhd/master/usr/lib/udev/hwdb.d/83-hhd.hwdb -o /etc/udev/hwdb.d/83-hhd.hwdb
sudo curl https://raw.githubusercontent.com/hhd-dev/hhd/master/usr/lib/systemd/system/hhd_local%40.service -o /etc/systemd/system/hhd_local@.service
# Add hhd to user path
mkdir -p ~/.local/bin
ln -sf ~/.local/share/hhd/venv/bin/hhd ~/.local/bin/hhd
ln -sf ~/.local/share/hhd/venv/bin/hhd.contrib ~/.local/bin/hhd.contrib
FINAL_URL='https://api.github.com/repos/hhd-dev/hhd-ui/releases/latest'
curl -L $(curl -s "${FINAL_URL}" | grep "browser_download_url" | cut -d '"' -f 4) -o $HOME/.local/bin/hhd-ui
chmod +x $HOME/.local/bin/hhd-ui
if [ -f /sys/fs/selinux/enforce ]; then
# The presence of this file means SELinux is loaded in the kernel.
# A value of 0 means Permissive, 1 means Enforcing.
selinux_enforcing=$(cat /sys/fs/selinux/enforce)
if [[ "$selinux_enforcing" != "0" ]]; then
echo "SELinux is loaded and in enforcing mode: changing hhd file security contextes:"
# Fedora Atomic derived distros (e.g. bazzite-gnome) have /home as a symlink to /var/home
user_home_dir=$(readlink -f $HOME)
sudo semanage fcontext -a -t bin_t $user_home_dir/.local/share/hhd/venv/bin/'.*'
sudo restorecon -Rv $user_home_dir//.local/share/hhd/venv/bin/
fi
fi
# Start service and reboot
sudo systemctl enable --now hhd_local@$(whoami)
echo ""
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!! Do not forget to remove a Bundled Handheld Daemon if your distro preinstalls it. !!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo ""
echo "Reboot!"