-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxiaomi-notebook-pro-setup.sh
executable file
·102 lines (83 loc) · 2.43 KB
/
xiaomi-notebook-pro-setup.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
# encoding: utf-8
source snackk.conf
to_install=3;
##################################################
# XIAOMI-NOTEBOOK-PRO-INSTALLATION #
##################################################
HARDWARE_PKGS='aic94xx-firmware wd719x-firmware'
DISPLAY_DRIVERS='vulkan-intel nvidia bumblebee'
function install_yaourt
{
ERR=0
# Installing yaourt
print_pretty_header "Installing yaourt"
cd ~/Downloads 1>/dev/null || ERR=1
git clone https://aur.archlinux.org/yaourt.git --depth=1 1>/dev/null || ERR=1
cd yaourt/ 1>/dev/null || ERR=1
makepkg -si --noconfirm 1>/dev/null || ERR=1
cd ~ 1>/dev/null || ERR=1
if [[ $ERR -eq 1 ]]; then
echo "Installing yaourt error."
exit 1
else
let success+=1;
fi
}
function install_yay
{
ERR=0
# Installing yay
print_pretty_header "Installing yay"
cd ~/Downloads 1>/dev/null || ERR=1
git clone https://aur.archlinux.org/yay.git --depth=1 1>/dev/null || ERR=1
cd yay/ 1>/dev/null || ERR=1
makepkg -si --noconfirm 1>/dev/null || ERR=1
cd ~ 1>/dev/null || ERR=1
if [[ $ERR -eq 1 ]]; then
echo "Installing yay error."
exit 1
else
let success+=1;
fi
}
function display_drivers
{
ERR=0
# Intalling display drivers
print_pretty_header "Installing${NC} $DISPLAY_DRIVERS"
pacman -S `echo $DISPLAY_DRIVERS` --noconfirm 1>/dev/null || ERR=1
# Setting daemon and user to bumblebee group
systemctl enable bumblebeed.service 1>/dev/null || ERR=1
gpasswd -a $USERN bumblebee 1>/dev/null || ERR=1
if [[ $ERR -eq 1 ]]; then
echo "Installing display drivers error."
exit 1
else
let success+=1;
fi
}
function missing_hardware_dependecies
{
ERR=0
# Downloading Hardware dependencies
print_pretty_header "Installing${NC} $HARDWARE_PKGS"
sudo -i -u $USERN yay -S `echo $HARDWARE_PKGS` --noconfirm 1>/dev/null || ERR=1
print_pretty_header "Resetting initial ramdisk"
echo -e $ROOT_PASSWD | sudo -S mkinitcpio -p linux || ERR=1
if [[ $ERR -eq 1 ]]; then
echo "Hardware dependencies error."
exit 1
else
let success+=1;
fi
}
##################################################
# Script #
##################################################
#install_yaourt
install_yay
display_drivers
missing_hardware_dependecies
print_results
print_line