diff --git a/Ubuntu-22.04-Server.sh b/Ubuntu-22.04-Server.sh index 1e88dad..1fd9b41 100644 --- a/Ubuntu-22.04-Server.sh +++ b/Ubuntu-22.04-Server.sh @@ -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 \ No newline at end of file