#!/bin/sh # # Copyright (C) 2021 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # trap "echo 3 >${exitcode}" ERR # $1 - Suite name for apt sources update_apt_sources() { # Add the needed debian sources cat >/etc/apt/sources.list </etc/apt/apt.conf.d/90recommends </etc/resolv.conf echo "nameserver 8.8.4.4" >>/etc/resolv.conf } # $1 - Network interface for bridge (or NetworkManager DHCP) # $2 - Bridge name. If set to the empty string, NetworkManager is used setup_dynamic_networking() { # So isc-dhcp-client can work with a read-only rootfs.. cat >>/etc/fstab </run/resolvconf/resolv.conf echo "nameserver 8.8.4.4" >>/run/resolvconf/resolv.conf # Set up automatic DHCP for *future* boots if [ -z "$2" ]; then cat >/etc/systemd/network/dhcp.network </etc/network/interfaces.d/$2.conf <>/etc/security/limits.conf } # $* - One or more device names for getty spawns create_systemd_getty_symlinks() { for device in $*; do ln -s /lib/systemd/system/serial-getty\@.service \ /etc/systemd/system/getty.target.wants/serial-getty\@"${device}".service done } # $1 - Additional default command line setup_grub() { if [ -n "${embed_kernel_initrd_dtb}" ]; then # For testing the image with a virtual device apt-get install -y grub2-common cat >/etc/default/grub <"${exitcode}" sync && poweroff -f }