blob: 5299b38569febdc0c9a3328ee514748ea17493bf (
plain)
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
# This is a default template for a post-install scriptlet.
# Uncomment only required functions and remove any functions
# you don't need (and this header).
## arg 1: the new package version
#pre_install() {
# do something here
#}
## arg 1: the new package version
post_install() {
#descobrir o nome do usuario
who=$(who | awk '{ print $1 }' | head -n 1)
#adicinar usuario ao grupo realtime e video
if [ -n "$(getent group | grep realtime)" ];then
usermod -a -G realtime $who
else
echo '
users=$(ls /home)
for i in $users; do
if [ -z "$(groups $i | grep realtime)" ]; then
usermod -a -G realtime $i
fi
done' | tee -a /usr/bin/big-first-boot
fi
usermod -a -G video $who
usermod -a -G audio $who
### toda essa parte foi movida para o systemD ###
#Aumentar a frequência de interrupção RTC
#echo 2048 > /sys/class/rtc/rtc0/max_user_freq
#echo 2048 > /proc/sys/dev/hpet/max-user-freq
#configurar o swapness para 10
#cat /proc/sys/vm/swappiness
#echo "vm.swappiness = 10" | tee /etc/sysctl.d/90-swappiness.conf
#cat /proc/sys/vm/vfs_cache_pressure
#echo "vm.vfs_cache_pressure = 100" | tee /etc/sysctl.d/99-vm.vfs_cache_pressure.conf
### até aqui ###
### movido para arquivos dentro do .pkg.tar.zst ###
#Increasing the maximum watches on files to 6000
#cat /proc/sys/fs/inotify/max_user_watches
#if [ ! -e "/etc/sysctl.d/90-max_user_watches.conf" ]; then
# echo fs.inotify.max_user_watches = 600000 | tee /etc/sysctl.d/90-max_user_watches.conf
#elif [ -e "/etc/sysctl.d/90-max_user_watches.conf" ]; then
# sed -i '/fs.inotify.max_user_watches/s/=.*$/= 600000/' /etc/sysctl.d/90-max_user_watches.conf
#fi
#baixar a latencia das placas de audio PCI internas
for i in $(lspci | grep -i audio | awk '{print $1}'); do setpci -v -s $i latency_timer=ff; done
#if [ ! -e /etc/security/limits.d/audio.conf ];then
# touch /etc/security/limits.d/audio.conf
#fi
#aumentar a prioridade e memoria para o audio
#if [ -z "$(grep 'rtprio 98' /etc/security/limits.d/audio.conf)" ]; then
# echo "@audio - rtprio 98" | tee -a /etc/security/limits.d/audio.conf
#fi
#if [ -z "$(grep 'memlock unlimited' /etc/security/limits.d/audio.conf)" ]; then
# echo "@audio - memlock unlimited" | tee -a /etc/security/limits.d/audio.conf
#fi
#if [ -z "$(grep 'KERNEL=="rtc0", GROUP="audio"' /etc/udev/rules.d/40-timer-permissions.rules)" ]; then
# echo 'KERNEL=="rtc0", GROUP="audio"' | tee -a /etc/udev/rules.d/40-timer-permissions.rules
#fi
#if [ -z "$(grep 'KERNEL=="hpet", GROUP="audio"' /etc/udev/rules.d/40-timer-permissions.rules)" ]; then
# echo 'KERNEL=="hpet", GROUP="audio"' | tee -a /etc/udev/rules.d/40-timer-permissions.rules
#fi
#if [ -z "$(grep 'KERNEL=="raw1394", GROUP="audio"' /etc/udev/rules.d/50-raw-firewire.rules)" ]; then
# echo 'KERNEL=="raw1394", GROUP="audio"' | tee -a /etc/udev/rules.d/50-raw-firewire.rules
#fi
### até aqui ###
#PAM-enabled login
if [ -z "$(grep pam_limits.so /etc/pam.d/crond)" ]; then
echo "session required pam_limits.so" | tee -a /etc/pam.d/crond
fi
if [ -z "$(grep pam_limits.so /etc/pam.d/login)" ]; then
echo "session required pam_limits.so" | tee -a /etc/pam.d/login
fi
if [ -z "$(grep pam_limits.so /etc/pam.d/polkit-1)" ]; then
echo "session required pam_limits.so" | tee -a /etc/pam.d/polkit-1
fi
if [ -z "$(grep pam_limits.so /etc/pam.d/system-auth)" ]; then
echo "session required pam_limits.so" | tee -a /etc/pam.d/system-auth
fi
if [ -z "$(grep pam_limits.so /etc/pam.d/system-services)" ]; then
echo "session required pam_limits.so" | tee -a /etc/pam.d/system-services
fi
##se o processador for intel desativar o pstate
#verificar se o processador é intel
cpu=$(lscpu | grep -i intel)
#verificar se o pstate está ativo
pstate=$(cat /etc/default/grub | grep intel_pstate=disable)
#se o processador for intel and o pstate tiver ativo
if [ -n "$cpu" -a -n "$pstate" ]; then
#desativar o pstate
sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/s/\"/ intel_pstate=disable"/2' /etc/default/grub
#update-grub
fi
##desativar o mitigations
mitigations=$(cat /etc/default/grub | grep mitigations=off)
#se o mitigations não estiver em off
if [ -z "$mitigations" ]; then
sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/s/\"/ mitigations=off"/2' /etc/default/grub
#update-grub
fi
clearcpuid=$(cat /etc/default/grub | grep clearcpuid=514)
#se o clearcpuid não estiver
if [ -z "$clearcpuid" ]; then
sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/s/\"/ clearcpuid=514"/2' /etc/default/grub
#update-grub
fi
nowatchdog=$(cat /etc/default/grub | grep nowatchdog)
#se o nowatchdog não estiver
if [ -z "$nowatchdog" ]; then
sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/s/\"/ nowatchdog"/2' /etc/default/grub
#update-grub
fi
nosoftlockup=$(cat /etc/default/grub | grep nosoftlockup)
#se o nosoftlockup não estiver
if [ -z "$nosoftlockup" ]; then
sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/s/\"/ nosoftlockup"/2' /etc/default/grub
#update-grub
fi
audit=$(cat /etc/default/grub | grep audit)
#se o audit não estiver
if [ -z "$audit" ]; then
sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/s/\"/ audit=0"/2' /etc/default/grub
#update-grub
fi
skewtick=$(cat /etc/default/grub | grep skew_tick=1)
#se o skewtick não estiver
if [ -z "$skewtick" ]; then
sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/s/\"/ skew_tick=1"/2' /etc/default/grub
#update-grub
fi
threadirqs=$(cat /etc/default/grub | grep threadirqs)
#se o threadirqs não estiver
if [ -z "$threadirqs" ]; then
sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/s/\"/ threadirqs"/2' /etc/default/grub
#update-grub
fi
update-grub
systemctl start xiva-audio-config
udevadm control --reload-rules
udevadm trigger
}
## arg 1: the new package version
## arg 2: the old package version
#pre_upgrade() {
# do something here
#}
## arg 1: the new package version
## arg 2: the old package version
#post_upgrade() {
# do something here
#}
## arg 1: the old package version
#pre_remove() {
# do something here
#}
## arg 1: the old package version
#post_remove() {
# do something here
#}
|