-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpdefaults.sh
More file actions
executable file
·116 lines (113 loc) · 3.01 KB
/
Copy pathpdefaults.sh
File metadata and controls
executable file
·116 lines (113 loc) · 3.01 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
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
#!/bin/bash
# name: pdefaults
# version: 1.0
# description: pdefaults_desc
# icon: optimizer.svg
# compat: ubuntu, debian, fedora, suse, arch, cachy, rhel, !zorin, !deepin
# reboot: yes
# noconfirm: yes
# nocontainer
# systemd: yes
# --- Start of the script code ---
source "$SCRIPT_DIR/libs/optimizers.lib"
_lang_
# system-agnostic scripts
sysag_run () {
if ! is_cachy && ! is_zorin; then
# systemd patches
cachyos_sysd_lib
fi
# shader booster
sboost_lib
# disable split-lock mitigation, which is not a security feature therefore is safe to disable
dsplitm_lib
# add earlyoom configuration, Fedora already has systemd-oomd
if is_suse || is_debian || is_arch || is_cachy || is_solus; then
earlyoom_lib
fi
# change intel driver to Xe on discrete GPUs
if ! is_fedora && ! is_ubuntu && ! is_rhel; then
intel_xe_lib
fi
# fix GTK app rendering for Intel BMG and Nvidia GPUs
fix_intel_gtk
# add alive timeout fix for Gnome
if echo "$XDG_CURRENT_DESKTOP" | grep -qi 'gnome'; then
sudo gsettings set org.gnome.mutter check-alive-timeout 20000
fi
# vm.min_free_kbytes dynamic setup - disabled for further testing
# free_mem_fix
# full kernel preemption for better latency in Fedora -- will skip automatically in other OS
preempt_lib
}
# consolidated installation
optimizer () {
if [ ! -f $HOME/.local/.autopatch.state ]; then
prep_tmp
sysag_run
prep_create "$HOME/.local/.autopatch.state"
zeninf "$msg036"
else
zenwrn "$msg234"
exit 100
fi
}
# menu
while true; do
OPTIONS=(
TRUE "standard" "Install without Power Profile"
)
if ! is_zorin && ! is_cachy && ! is_suse; then
OPTIONS+=(
FALSE "laptop" "Laptop"
)
fi
CPU_VENDOR=$(awk -F ': *' '/^vendor_id/ { print $2; exit }' /proc/cpuinfo)
if [[ "$CPU_VENDOR" == "AuthenticAMD" ]]; then
OPTIONS+=(
FALSE "performance" "High Performance"
)
fi
OPTIONS+=(
FALSE "cancel" "$msg070"
)
CHOICE=$(
zenity --list \
--radiolist \
--title="Power Optimizer" \
--text="$msg229" \
--column="Select" \
--column="ID" \
--column="Options" \
--hide-column=2 \
--print-column=2 \
"${OPTIONS[@]}" \
--width=360 \
--height=360
)
status=$?
if (( status != 0 )) || [[ -z "$CHOICE" ]]; then
exit 100
fi
case "$CHOICE" in
standard)
askpass && optimizer
exit $?
;;
performance)
askpass && pp_ondemand && optimizer
exit $?
;;
laptop)
askpass && optimizer && psave_lib
exit $?
;;
cancel)
exit 100
;;
*)
printf 'Unexpected option returned by Zenity: %q\n' "$CHOICE" >&2
exit 1
;;
esac
done