37 lines
1.2 KiB
Bash
Executable File
37 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Copyright (c) 2024 Joshua Rich <joshua.rich@gmail.com>
|
|
#
|
|
# This software is released under the MIT License.
|
|
# https://opensource.org/licenses/MIT
|
|
|
|
set -e
|
|
|
|
# set pkgarch as per given BUILDPLATFORM
|
|
case $1 in
|
|
linux/amd64) exit 0 ;;
|
|
linux/arm/*) pkgarch=(armhf) ;;
|
|
linux/arm64) pkgarch=(arm64) ;;
|
|
all) pkgarch=(armhf arm64) ;;
|
|
*) echo "No arch specified" && exit -1 ;;
|
|
esac
|
|
|
|
function join_by { local IFS="$1"; shift; echo "$*"; }
|
|
|
|
# ensure the existing defualt repos are only consulted for amd64 arch
|
|
sed -i 's|^deb\s|deb [arch=amd64] |g' /etc/apt/sources.list
|
|
# add the additional arch
|
|
for arch in "${pkgarch[@]}"; do
|
|
dpkg --add-architecture ${arch}
|
|
done
|
|
archs=$(join_by , "${pkgarch[@]}")
|
|
# add repos for the additional arch
|
|
tee -a /etc/apt/sources.list << EOF
|
|
deb [arch=${archs}] http://ports.ubuntu.com/ubuntu-ports/ jammy main
|
|
#deb-src [arch=${archs}] http://ports.ubuntu.com/ubuntu-ports/ jammy main
|
|
deb [arch=${archs}] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main
|
|
#deb-src [arch=${archs}] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main
|
|
deb [arch=${archs}] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main
|
|
#deb-src [arch=${archs}] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main
|
|
EOF
|