From 62d0464392a015bdca8f8ad9814da046432075ea Mon Sep 17 00:00:00 2001 From: "Ian M. Jones" Date: Tue, 14 Jan 2025 21:38:11 +0000 Subject: [PATCH] #320: Fix installing CA on Solus --- CHANGELOG.md | 2 ++ scripts/environment.sh | 3 +++ scripts/install-system-ca-linux.sh | 20 +++++++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1678f643d..4e89ae226 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }}) +* Fixed installing CA on Solus + ## v3.23.24 - [January 14, 2025](https://github.com/lando/core/releases/tag/v3.23.24) * Fixed bug causing service script moving to fail when receiving non-stringy inputs diff --git a/scripts/environment.sh b/scripts/environment.sh index 1d018dd53..fab65f1a2 100755 --- a/scripts/environment.sh +++ b/scripts/environment.sh @@ -49,6 +49,9 @@ set_package_manager() { ol) export LANDO_LINUX_PACKAGE_MANAGER="microdnf" ;; + solus) + export LANDO_LINUX_PACKAGE_MANAGER="eopkg" + ;; *) return 1 ;; diff --git a/scripts/install-system-ca-linux.sh b/scripts/install-system-ca-linux.sh index 57b204bf0..e9cb0419d 100755 --- a/scripts/install-system-ca-linux.sh +++ b/scripts/install-system-ca-linux.sh @@ -82,6 +82,9 @@ set_package_manager() { ol) export LANDO_LINUX_PACKAGE_MANAGER="microdnf" ;; + solus) + export LANDO_LINUX_PACKAGE_MANAGER="eopkg" + ;; *) return 1 ;; @@ -146,8 +149,16 @@ if [ ! -x "$(command -v update-ca-trust)" ]; then esac fi +if [ ! -x "$(command -v certutil)" ]; then + case $LANDO_LINUX_PACKAGE_MANAGER in + eopkg) + eopkg install -y ca-certs libnss + ;; + esac +fi + # abort if we cannot install the things we need -if [ ! -x "$(command -v update-ca-certificates)" ] && [ ! -x "$(command -v update-ca-trust)" ]; then +if [ ! -x "$(command -v update-ca-certificates)" ] && [ ! -x "$(command -v update-ca-trust)" ] && [ ! -x "$(command -v certutil)" ]; then echo "$LANDO_LINUX_PACKAGE_MANAGER not supported! Could not install ca-certs!" >&2 exit 1 fi @@ -164,6 +175,13 @@ case $LANDO_LINUX_PACKAGE_MANAGER in cp -rf "$CA" /etc/ca-certificates/trust-source/anchors/ update-ca-trust ;; + eopkg) + mkdir -p /etc/ssl/certs + cp -rf "$CA" /etc/ssl/certs/ + NONROOT_USER=$(logname) + NONROOT_HOME=$(getent passwd "$NONROOT_USER" | cut -d: -f6) + certutil -d "sql:$NONROOT_HOME/.pki/nssdb" -A -t "C,," -n Lando-Root-CA -i "$CA" + ;; *) mkdir -p /usr/local/share/ca-certificates cp -rf "$CA" /usr/local/share/ca-certificates/