-
Notifications
You must be signed in to change notification settings - Fork 32
/
XPS.sh
executable file
·139 lines (126 loc) · 3.32 KB
/
XPS.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
# Bold / Non-bold
BOLD="\033[1m"
RED="\033[0;31m"
GREEN="\033[0;32m"
BLUE="\033[1;34m"
#echo -e "\033[0;32mCOLOR_GREEN\t\033[1;32mCOLOR_LIGHT_GREEN"
OFF="\033[m"
# Repository location
REPO=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
GIT_DIR="${REPO}"
git_update()
{
cd ${REPO}
echo "${GREEN}[GIT]${OFF}: Updating local data to latest version"
echo "${BLUE}[GIT]${OFF}: Updating to latest XPS-9360-Hackintosh git master"
echo "${BLUE}[GIT]${OFF}: Git clone newest repository to current path"
git pull
}
compile_dsdt()
{
echo "${GREEN}[DSDT]${OFF}: Compiling DSDT / SSDT hotpatches in ./DSDT"
cd "${REPO}"
for f in ./DSDT/*.dsl
do
echo "${BLUE}$(basename $f)${OFF}: Compiling to ./CLOVER/ACPI/patched"
./tools/iasl -vr -w1 -ve -p ./CLOVER/ACPI/patched/$(basename -s .dsl $f).aml $f
done
}
combo_jack()
{
echo "${GREEN}[ComboJack]${OFF}: Installing ComboJack for ${BOLD}ALC256${OFF}"
chmod a+x ./ComboJack/install.sh
./ComboJack/install.sh
}
enable_trim()
{
echo "${GREEN}[TRIM]${OFF}: Enabling ${BOLD}TRIM${OFF} support for 3rd party SSD"
sudo trimforce enable
echo 'Trim is enabled.'
}
enable_3rdparty()
{
echo "${GREEN}[3rd Party]${OFF}: Enabling ${BOLD}3rd Party${OFF} application support"
sudo spctl --master-disable
}
rebuild_cache()
{
echo "${GREEN}[Rebuild cache]${OFF}: Rebuild cache"
sudo chmod -R 755 /Library/Extensions
sudo chown -R root:wheel /Library/Extensions
sudo kextcache -i /
}
better_sleep()
{
echo "${GREEN}[Sleep fixing]${OFF}: For Better Sleep"
sudo pmset -a hibernatemode 0
sudo pmset -a autopoweroff 0
sudo pmset -a standby 0
sudo rm /private/var/vm/sleepimage
sudo touch /private/var/vm/sleepimage
sudo chflags uchg /private/var/vm/sleepimage
echo 'Sleep is fixed'
}
pin_custom()
{
echo "${GREEN}[Pin custom]${OFF}: Disable 4-Digit Pin Required on macOS"
pwpolicy -clearaccountpolicies
passwd
}
RETVAL=1
case "$1" in
--update)
git_update
RETVAL=0
;;
--compile-dsdt)
compile_dsdt
RETVAL=0
;;
--combo-jack)
combo_jack
RETVAL=0
;;
--enable-trim)
enable_trim
RETVAL=0
;;
--enable-3rdparty)
enable_3rdparty
RETVAL=0
;;
--rebuild-cache)
rebuild_cache
RETVAL=0
;;
--better-sleep)
better_sleep
RETVAL=0
;;
--pin-custom)
pin_custom
RETVAL=0
;;
*)
echo "${BOLD}macOS on XPS 13 9360${OFF} - Catalina 10.15.4 (19E287)"
echo "https://github.com/the-Quert/XPS-9360-macOS"
echo
echo "\t${BOLD}--update${OFF}: Update to latest git version (including externals)"
echo "\t${BOLD}--compile-dsdt${OFF}: Compile DSDT files to ./DSDT/compiled"
echo "\t${BOLD}--combo-jack${OFF}: Install ComboJack user daemon (Headset / Headphone detection)"
echo "\t${BOLD}--enable-trim${OFF}: Enable trim support for 3rd party SSD"
echo "\t${BOLD}--enable-3rdparty${OFF}: Enable 3rd party application support (run app from anywhere)"
echo "\t${BOLD}--rebuild-cache${OFF}: Rebuild cache"
echo "\t${BOLD}--better-sleep${OFF}: For better sleep"
echo "\t${BOLD}--pin-custom${OFF}: Disable 4-Digit Pin Required on macOS"
echo
echo "Credits:"
echo "${BLUE}ComboJack${OFF}: https://github.com/hackintosh-stuff/ComboJack"
echo "${BLUE}HiDPI${OFF}: https://github.com/xzhih/one-key-hidpi"
echo "${BLUE}OpenCore${OFF}: https://github.com/acidanthera"
echo "${BLUE}Leo Neo Usfsg${OFF}: https://www.facebook.com/yuting.lee.leo"
echo
;;
esac
exit $RETVAL