This repository has been archived by the owner on Mar 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
72 lines (60 loc) · 2.55 KB
/
install.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
function setup
{
echo -e "\nPreparing to install ..."
#File install
echo -e "\nCopying files ..."
mkdir /etc/prime
mkdir /etc/prime/services
cp config /etc/prime/config
cp prime_switch /etc/prime/services/prime_switch
cp prime_logout.waiting /etc/prime/services/prime_logout.waiting
cp prime_switch.service /etc/systemd/system/prime_switch.service
cp prime_logout.waiting.service /etc/systemd/system/prime_logout.waiting.service
cp vga /usr/bin/vga
cp optimus-switch.conf /etc/modprobe.d/optimus-switch.conf
cp SUSEPrime_project_files/prime-select.sh /etc/prime/services/prime-select.sh
cp SUSEPrime_project_files/xorg-intel.conf /etc/prime/xorg-intel.conf
cp SUSEPrime_project_files/xorg-nvidia.conf /etc/prime/xorg-nvidia.conf
echo "Done."
#Permissions
echo -e "\nSetting permissions ..."
chmod +x /etc/prime/services/prime_switch
chmod +x /etc/prime/services/prime_logout.waiting
chmod +x /etc/prime/services/prime-select.sh
chmod +x /usr/bin/vga
echo "Done."
#Service
echo -e "\nSetting service ..."
systemctl enable prime_switch
bash /etc/prime/services/prime-select.sh intel
echo "Done."
#Modprobe_rules
echo -e "\nSetting modprobe rules ..."
mkinitrd
echo "Done."
echo -e "\nInstallation completed successfully! Please REBOOT and use [ vga ] command to know how to use\n"
}
echo
if [[ $EUID > 0 ]]
then echo -e "Please run as root\n"
exit
fi
echo -e "Welcome to Nvidia Optimus Switch installation! Based to michalsrb and bosim suse-prime project."
echo -e "Please visit https://github.com/simopil/nvidia-optimus-switch to see differences and report BUGs."
echo -e "\nPreliminary verification ..."
if [ -x "$(command -v prime-select)" ]; then
echo -e "\nsuse-prime package not required, already included in this project! Uninstall it first" >&2
exit 1
fi
if [ -x "$(command -v optirun)" ]; then
echo -e "\nSeems you have bumblebee or similar installed, please remove it first!" >&2
exit 1
fi
echo
read -p "Nvidia Optimus Switch will be installed on your system, continue? (y|n): " confirm
case "$confirm" in
y|Y ) setup;;
n|N ) echo -e "\nInstallation aborted\n";;
* ) echo -e "\nInvalid answer, installation aborted\n";;
esac