Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 43 additions & 12 deletions etc/DependencyInstaller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ _installKlayoutDependenciesUbuntuAarch64() {
}

_installUbuntuPackages() {
# Detect distro for Docker repo URL and KLayout install method
local distro_id
distro_id=$(. /etc/os-release && echo "${ID}")
Comment on lines 150 to +153
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this related to debian? I don't want to QA AI slop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debian/Kali needs slightly different handling for KLayout (apt vs .deb), Docker repo URL (/debian vs /ubuntu), and libstdc++ package names. I'll close this and resubmit with a cleaner approach


export DEBIAN_FRONTEND="noninteractive"
apt-get -y update
apt-get -y install --no-install-recommends \
Expand Down Expand Up @@ -175,19 +179,23 @@ _installUbuntuPackages() {
zlib1g \
zlib1g-dev

packages=()
# Choose libstdc++ version
if _versionCompare $1 -ge 25.04; then
packages+=("libstdc++-15-dev")
elif _versionCompare $1 -ge 24.04; then
packages+=("libstdc++-14-dev")
elif _versionCompare $1 -ge 22.10; then
packages+=("libstdc++-12-dev")
# Choose libstdc++ version (Ubuntu-specific versioned packages)
if [[ "$distro_id" == "ubuntu" ]]; then
packages=()
if _versionCompare $1 -ge 25.04; then
packages+=("libstdc++-15-dev")
elif _versionCompare $1 -ge 24.04; then
packages+=("libstdc++-14-dev")
elif _versionCompare $1 -ge 22.10; then
packages+=("libstdc++-12-dev")
fi
apt-get install -y --no-install-recommends ${packages[@]}
fi
apt-get install -y --no-install-recommends ${packages[@]}

# install KLayout
if [[ $1 == "rodete" ]]; then
# Debian/Kali and rodete use apt; Ubuntu >= 23.04 uses apt;
# older Ubuntu uses version-specific .deb downloads
if [[ $1 == "rodete" ]] || [[ "$distro_id" != "ubuntu" ]]; then
apt-get -y install --no-install-recommends klayout python3-pandas
elif _versionCompare "$1" -ge 23.04; then
apt-get -y install --no-install-recommends klayout python3-pandas
Expand Down Expand Up @@ -236,14 +244,20 @@ _installUbuntuPackages() {
return 0
fi

# Determine Docker repo distro (Kali uses Debian repos)
local docker_distro="$distro_id"
if [[ "$distro_id" == "kali" ]]; then
docker_distro="debian"
fi

# Add Docker's official GPG key:
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
curl -fsSL https://download.docker.com/linux/${docker_distro}/gpg \
-o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/${docker_distro} \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null

Expand Down Expand Up @@ -483,6 +497,23 @@ case "${os}" in
fi
fi
;;
"Debian GNU/Linux" | "Kali GNU/Linux" )
version=$(awk -F= '/^VERSION_ID/{print $2}' /etc/os-release | sed 's/"//g')
if [[ -z ${version} ]]; then
version=$(awk -F= '/^VERSION_CODENAME/{print $2}' /etc/os-release | sed 's/"//g')
fi
if [[ ${CI} == "yes" ]]; then
echo "WARNING: Installing CI dependencies is only supported on Ubuntu 22.04" >&2
fi
_installORDependencies
if [[ "${option}" == "base" || "${option}" == "all" ]]; then
_installUbuntuPackages "${version}"
_installUbuntuCleanUp
fi
if [[ "${option}" == "common" || "${option}" == "all" ]]; then
_installPipCommon
fi
;;
"Darwin" )
if [[ ${CI} == "yes" ]]; then
echo "WARNING: Installing CI dependencies is only supported on Ubuntu 22.04" >&2
Expand Down