70 lines
2.7 KiB
Bash
Executable File
70 lines
2.7 KiB
Bash
Executable File
#!/bin/bash -e
|
|
|
|
# Configure apt sources
|
|
true > "${ROOTFS_DIR}/etc/apt/sources.list"
|
|
|
|
# Add APT Sources
|
|
if [ "${PLATFORM}" == "rpi" ]; then
|
|
# On rpi platforms add rpi sources
|
|
install -m 644 files/raspbian.sources "${ROOTFS_DIR}/etc/apt/sources.list.d/"
|
|
install -m 644 files/raspi.sources "${ROOTFS_DIR}/etc/apt/sources.list.d/"
|
|
sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/raspbian.sources"
|
|
sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/raspi.sources"
|
|
install -m 644 files/raspberrypi-archive-keyring.pgp "${ROOTFS_DIR}/usr/share/keyrings/"
|
|
fi
|
|
|
|
# Add default debian sources until oxmc creates a mirror for debian sources
|
|
install -m 644 files/debian.sources "${ROOTFS_DIR}/etc/apt/sources.list.d/"
|
|
sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/debian.sources"
|
|
|
|
# Configure vesperos apt sources
|
|
install -m 644 files/vesperos.sources "${ROOTFS_DIR}/etc/apt/sources.list.d/"
|
|
sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/vesperos.sources"
|
|
install -m 644 files/vesperos.gpg "${ROOTFS_DIR}/usr/share/keyrings/"
|
|
|
|
# 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
|
|
|
|
# Add temp repo if provided
|
|
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-vesperos-prefs "${ROOTFS_DIR}/etc/apt/preferences.d/"
|
|
sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/preferences.d/apt-vesperos-prefs"
|
|
|
|
# Add additional architectures if needed, update and upgrade and cache policy
|
|
on_chroot <<- \EOF
|
|
SYSTEM_ARCH="$(dpkg --print-architecture)"
|
|
|
|
# If we're building for rpi, we want to add both armhf and arm64 architectures to allow installing packages from both architectures
|
|
if [ "${PLATFORM}" == "rpi" ]; then
|
|
if [ "$SYSTEM_ARCH" = "armhf" ]; then
|
|
dpkg --add-architecture arm64
|
|
elif [ "$SYSTEM_ARCH" = "arm64" ]; then
|
|
dpkg --add-architecture armhf
|
|
fi
|
|
fi
|
|
|
|
# If we're building for amd64, we want to add i386 architecture to allow installing packages from both architectures
|
|
if [ "$SYSTEM_ARCH" = "amd64" ]; then
|
|
dpkg --add-architecture i386
|
|
elif [ "$SYSTEM_ARCH" = "i386" ]; then
|
|
dpkg --add-architecture amd64
|
|
fi
|
|
|
|
# Update and upgrade packages and show cache policy
|
|
apt-get update
|
|
apt-get dist-upgrade -y
|
|
apt-cache policy
|
|
EOF
|