1
0
mirror of https://github.com/tommytran732/Linux-Setup-Scripts synced 2024-12-23 15:22:12 -05:00

Differentiating bare metal and virtual Ubuntu server installs

Signed-off-by: Tommy <contact@tommytran.io>
This commit is contained in:
Tommy 2023-12-01 20:19:31 -07:00
parent 06ef0e7ca0
commit ab9482c2f9
No known key found for this signature in database
GPG Key ID: D30DEC268D3FEB17

View File

@ -158,9 +158,41 @@ ExecStart=/usr/bin/fwupdmgr update' | tee /etc/systemd/system/fwupd-refresh.serv
sudo systemctl daemon-reload
sudo systemctl enable --now fwupd-refresh.timer
# Setup tuned
sudo apt install tuned -y
sudo tuned-adm profile virtual-guest
# Enable fstrim.timer
sudo systemctl enable --now fstrim.timer
### Differentiating bare metal and virtual installs
# Installing tuned first here because virt-what is 1 of its dependencies anyways
sudo apt install tuned -y
virt_type=$(echo $(virt-what))
if [ "$virt_type" = "" ]; then
output "Virtualization: Bare Metal."
elif [ "$virt_type" = "openvz lxc" ]; then
output "Virtualization: OpenVZ 7."
elif [ "$virt_type" = "xen xen-hvm" ]; then
output "Virtualization: Xen-HVM."
elif [ "$virt_type" = "xen xen-hvm aws" ]; then
output "Virtualization: Xen-HVM on AWS."
else
output "Virtualization: $virt_type."
fi
# Setup tuned
if [ "$virt_type" = "" ]; then
sudo tuned-adm profile latency-performance
else
sudo tuned-adm profile virtual-guest
fi
# Setup fwupd
if [ "$virt_type" = "" ]; then
sudo apt install fwupd -y
echo 'UriSchemes=file;https' | sudo tee -a /etc/fwupd/fwupd.conf
sudo systemctl restart fwupd
mkdir -p /etc/systemd/system/fwupd-refresh.service.d
sudo curl https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/systemd/system/fwupd-refresh.service.d/override.conf -o /etc/systemd/system/fwupd-refresh.service.d/override.conf
sudo systemctl daemon-reload
sudo systemctl enable --now fwupd-refresh.timer
fi