49 lines
1.3 KiB
Bash
Executable File
49 lines
1.3 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
|
|
|
|
case $1 in
|
|
amd64)
|
|
exit 0
|
|
;;
|
|
arm)
|
|
pkgarch=(armhf)
|
|
ccpkg=(gcc-arm-linux-gnueabihf)
|
|
;;
|
|
arm64)
|
|
pkgarch=(arm64)
|
|
ccpkg=(gcc-aarch64-linux-gnu)
|
|
;;
|
|
all)
|
|
pkgarch=(armhf arm64)
|
|
ccpkg=(gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu)
|
|
;;
|
|
*)
|
|
echo "No arch specified"
|
|
exit -1
|
|
;;
|
|
esac
|
|
|
|
function join_by { local IFS="$1"; shift; echo "$*"; }
|
|
|
|
sed -i 's|^deb\s|deb [arch=amd64] |g' /etc/apt/sources.list
|
|
for arch in "${pkgarch[@]}"; do
|
|
dpkg --add-architecture ${arch}
|
|
done
|
|
archs=$(join_by , "${pkgarch[@]}")
|
|
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
|
|
apt-get update
|
|
apt-get -y install ${ccpkg[@]:0}
|