summaryrefslogtreecommitdiff
path: root/roles/installer/raspios/image
diff options
context:
space:
mode:
Diffstat (limited to 'roles/installer/raspios/image')
-rw-r--r--roles/installer/raspios/image/templates/firstrun.sh.j214
1 files changed, 13 insertions, 1 deletions
diff --git a/roles/installer/raspios/image/templates/firstrun.sh.j2 b/roles/installer/raspios/image/templates/firstrun.sh.j2
index 96c74b39..05f9639d 100644
--- a/roles/installer/raspios/image/templates/firstrun.sh.j2
+++ b/roles/installer/raspios/image/templates/firstrun.sh.j2
@@ -76,8 +76,10 @@ EOF
{% if not (install_dhcp | default(false)) %}
cat <<EOF > /etc/resolv.conf
# Generated by ansible
+{% if 'domain' in network %}
search {{ network.domain }}
-{% for nameserver in network.nameservers %}
+{% endif %}
+{% for nameserver in (network.nameservers | default([])) %}
nameserver {{ nameserver }}
{% endfor %}
EOF
@@ -86,6 +88,9 @@ systemctl disable wpa_supplicant.service
rfkill unblock wlan
ifup {{ network.primary.name }}
{% endif %}
+{% for host in (network.static_hostnames | default([])) %}
+echo "{{ host.address }} {{ host.names | join(' ') }}" >> /etc/hosts
+{% endfor %}
{% if ansible_port != 22 %}
sed -e 's/^\s*#*\s*Port\s\s*[0-9][0-9]*$/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config
@@ -108,6 +113,13 @@ rm "$FW_LOC/firstrun.sh"
rm -f /etc/sudoers.d/010_pi-nopasswd
rm -f /etc/apt/sources.list.d/vscode.list
rm -f /etc/apt/trusted.gpg.d/microsoft.gpg
+rm -f /etc/apt/sources.list.d/raspi.list
+cat <<EOF > /etc/apt/sources.list
+deb http://{{ apt_repo_providers[apt_repo_provider].debian.host }}{{ apt_repo_providers[apt_repo_provider].debian.path }} {{ install_codename }} main non-free-firmware
+deb http://{{ apt_repo_providers[apt_repo_provider].debian.host }}{{ apt_repo_providers[apt_repo_provider].debian.path }} {{ install_codename }}-updates main non-free-firmware
+deb http://{{ apt_repo_providers[apt_repo_provider].debian_security.host }}{{ apt_repo_providers[apt_repo_provider].debian_security.path }} {{ install_codename }}-security main non-free-firmware
+deb http://{{ apt_repo_providers[apt_repo_provider].raspios.host }}{{ apt_repo_providers[apt_repo_provider].raspios.path }} {{ install_codename }} main
+EOF
apt-get update -q
apt-get dist-upgrade -y -q