From c8bb98554e131b03fcc7a646fa26b4f344d6b680 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sat, 12 Feb 2022 13:55:07 -0800 Subject: [PATCH] setup-apt-repo: Use /etc/os-release instead of lsb_release. But still install lsb-release for now since Puppet acts funny without it. Signed-off-by: Anders Kaseorg --- scripts/lib/setup-apt-repo | 3 ++- scripts/setup/apt-repos/zulip/custom.sh | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/lib/setup-apt-repo b/scripts/lib/setup-apt-repo index fcdc19e55c..6821055f74 100755 --- a/scripts/lib/setup-apt-repo +++ b/scripts/lib/setup-apt-repo @@ -52,6 +52,8 @@ if ! [ -d "$LIST_PATH" ]; then exit 1 fi +release="$(. /etc/os-release && printf '%s' "$VERSION_CODENAME")" + DEPENDENCIES_HASH=$(sha1sum "$LIST_PATH/"*.asc "$0") DEPENDENCIES_HASH_FILE="/var/lib/zulip/setup-repositories-state-$LIST" # Ensure that DEPENDENCIES_HASH_FILE exists before hashing it. @@ -78,7 +80,6 @@ if ! apt-get -dy install "${pre_setup_deps[@]}"; then fi apt-get -y install "${pre_setup_deps[@]}" -release=$(lsb_release -sc) if [ -f "$LIST_PATH/$release.list" ]; then apt-key add "$LIST_PATH/"*.asc cp "$LIST_PATH/$release.list" "$SOURCES_FILE" diff --git a/scripts/setup/apt-repos/zulip/custom.sh b/scripts/setup/apt-repos/zulip/custom.sh index c6dc9abd1b..b8508fb9bc 100755 --- a/scripts/setup/apt-repos/zulip/custom.sh +++ b/scripts/setup/apt-repos/zulip/custom.sh @@ -19,8 +19,11 @@ if [[ ! -e /usr/share/doc/groonga-apt-source/copyright ]]; then | cut --delimiter=: --fields=10 \ | head --lines=1 ) - release=$(lsb_release -sc) - distribution=$(lsb_release -si | tr '[:upper:]' '[:lower:]') + os_info="$(. /etc/os-release && printf '%s\n' "$ID" "$VERSION_CODENAME")" + { + read -r distribution + read -r release + } <<<"$os_info" groonga_apt_source_deb="groonga-apt-source-latest-$release.deb" groonga_apt_source_deb_sign="$groonga_apt_source_deb.asc.$pgroonga_apt_sign_key_fingerprint" curl -fLO "https://packages.groonga.org/$distribution/$groonga_apt_source_deb"