2023-04-15 16:14:30 -07:00
|
|
|
{{- if (eq .host.distro.family "linux") -}}
|
2022-12-06 02:26:47 -08:00
|
|
|
#!/usr/bin/env bash
|
2023-04-12 18:27:13 -07:00
|
|
|
# @file Linux System Tweaks
|
|
|
|
# @brief Applies a set of generic Linux system tweaks such as ensuring the hostname is set, setting the timezone, and more
|
|
|
|
# @description
|
|
|
|
# This script applies generic Linux system tweaks that should be made before the rest of the provisioning process.
|
2022-12-06 02:26:47 -08:00
|
|
|
|
2023-01-24 20:36:59 -08:00
|
|
|
{{ includeTemplate "universal/profile-before" }}
|
|
|
|
{{ includeTemplate "universal/logg-before" }}
|
2022-12-25 00:35:37 -08:00
|
|
|
|
2022-12-06 02:26:47 -08:00
|
|
|
### Set hostname (if redefined)
|
|
|
|
if command -v hostnamectl > /dev/null; then
|
|
|
|
# Betelgeuse is the default hostname so only change when it is different
|
|
|
|
if [ '{{ .host.hostname }}' != 'Betelgeuse' ]; then
|
|
|
|
logg info "Setting hostname to {{ .host.hostname }}"
|
|
|
|
sudo hostnamectl set-hostname {{ .host.hostname }}
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
### Set timezone
|
|
|
|
if command -v timedatectl > /dev/null; then
|
|
|
|
logg info 'Setting timezone to `{{ .user.timezone }}`'
|
|
|
|
sudo timedatectl set-timezone {{ .user.timezone }}
|
|
|
|
fi
|
|
|
|
|
|
|
|
### Modify vm.max_map_count
|
|
|
|
if command -v sysctl > /dev/null; then
|
|
|
|
logg info 'Increasing vm.max_map_count size to 262144'
|
2023-01-12 07:02:13 -08:00
|
|
|
sudo sysctl -w vm.max_map_count=262144 > /dev/null
|
2022-12-06 02:26:47 -08:00
|
|
|
fi
|
2023-04-15 16:14:30 -07:00
|
|
|
{{ end -}}
|