#!/bin/bash -e # Configure apt sources install -m 644 files/sources.list "${ROOTFS_DIR}/etc/apt/" sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list" if [[ "${ARCH}" == "arm64" || "${ARCH}" == "armhf" ]]; then install -m 644 files/raspi.list "${ROOTFS_DIR}/etc/apt/sources.list.d/" sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/raspi.list" fi install -m 644 files/oxmc.list "${ROOTFS_DIR}/etc/apt/sources.list.d/" sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/oxmc.list" # Configure apt proxy if [ -n "$APT_PROXY" ]; then install -m 644 files/51cache "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" sed "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" -i -e "s|APT_PROXY|${APT_PROXY}|" else rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" fi if [ -n "$TEMP_REPO" ]; then install -m 644 /dev/null "${ROOTFS_DIR}/etc/apt/sources.list.d/00-temp.list" echo "$TEMP_REPO" | sed "s/RELEASE/$RELEASE/g" > "${ROOTFS_DIR}/etc/apt/sources.list.d/00-temp.list" else rm -f "${ROOTFS_DIR}/etc/apt/sources.list.d/00-temp.list" fi # Configure apt preferences install -m 644 files/apt-chillcraftos-prefs "${ROOTFS_DIR}/etc/apt/preferences.d/" if [[ "${ARCH}" == "arm64" || "${ARCH}" == "armhf" ]]; then # Add raspberrypi-archive-keyring to apt cat files/raspberrypi.gpg.key | gpg --dearmor > "${STAGE_WORK_DIR}/raspberrypi-archive-stable.gpg" install -m 644 "${STAGE_WORK_DIR}/raspberrypi-archive-stable.gpg" "${ROOTFS_DIR}/etc/apt/trusted.gpg.d/" fi # Add oxmc-archive-keyring to apt cat files/oxmc.gpg.key | gpg --dearmor > "${STAGE_WORK_DIR}/oxmc.gpg" install -m 644 "${STAGE_WORK_DIR}/oxmc.gpg" "${ROOTFS_DIR}/etc/apt/trusted.gpg.d/" # Add armhf and arm64 architectures, update and upgrade and cache policy on_chroot <<- \EOF SYSTEM_ARCH="$(dpkg --print-architecture)" if [ "$SYSTEM_ARCH" = "armhf" ]; then dpkg --add-architecture arm64 elif [ "$SYSTEM_ARCH" = "arm64" ]; then dpkg --add-architecture armhf fi apt-get update apt-get dist-upgrade -y apt-cache policy EOF