From b79d267b8f67569d2ebec77619d57fffc9327b17 Mon Sep 17 00:00:00 2001 From: Jakub Date: Mon, 6 Feb 2023 11:43:24 +0100 Subject: [PATCH] drop dependency on lsb-release script (#4597) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `/etc/os-release` file exists in most distributions and can be easily read in Bash by sourcing it: ``` > docker run --rm -it debian:bullseye root@2f5d6e038738:/# grep '^ID=' /etc/os-release ID=debian ``` ``` > docker run --rm -it ubuntu:22.04 root@316b572b6e4d:/# grep '^ID=' /etc/os-release ID=ubuntu ``` The dependency on `lsb-release` tool is unnecessary, and pulls in additional big dependencies like `python3`: ``` # apt show lsb-release | grep Depends Depends: python3:any, distro-info-data ``` Which if used in a Docker container would make it unnecessarily big. Signed-off-by: Jakub SokoĊ‚owski --- scripts/make_packages.sh | 2 -- scripts/package_src/nimbus_beacon_node/after_install | 10 +++++++--- .../package_src/nimbus_validator_client/after_install | 9 +++++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/make_packages.sh b/scripts/make_packages.sh index 5f6729bde..d33caf191 100755 --- a/scripts/make_packages.sh +++ b/scripts/make_packages.sh @@ -142,7 +142,6 @@ fpm -s dir -t deb -n "${PKG_NAME}" \ -C "${PKG_IMG_DIR}" \ -p "${PKG_PATH_DEB}" \ -a "${PKG_ARCH_DEB}" \ - --depends lsb-release \ --after-install "${PKG_SRC_DIR}/after_install" \ --before-remove "${PKG_SRC_DIR}/before_remove" \ --after-remove "${PKG_SRC_DIR}/after_remove" \ @@ -159,7 +158,6 @@ fpm -s dir -t rpm -n "${PKG_NAME}" \ -C "${PKG_IMG_DIR}" \ -p "${PKG_PATH_RPM}" \ -a "${PKG_ARCH_RPM}" \ - --depends redhat-lsb-core \ --after-install "${PKG_SRC_DIR}/after_install" \ --before-remove "${PKG_SRC_DIR}/before_remove" \ --after-remove "${PKG_SRC_DIR}/after_remove" \ diff --git a/scripts/package_src/nimbus_beacon_node/after_install b/scripts/package_src/nimbus_beacon_node/after_install index 3311c3f7d..14abb0916 100644 --- a/scripts/package_src/nimbus_beacon_node/after_install +++ b/scripts/package_src/nimbus_beacon_node/after_install @@ -1,11 +1,15 @@ #!/bin/bash - set -e -DISTRO=$(lsb_release -si) +DISTRO="UNKNOWN" +if [[ -r /etc/os-release ]]; then + source /etc/os-release + DISTRO="${ID}" +fi + if ! id -u nimbus > /dev/null 2>&1; then case $DISTRO in - Ubuntu|Debian) + Ubuntu|ubuntu|Debian|debian) # Debian uses `adduser` to create user... adduser --system --no-create-home --group nimbus ;; diff --git a/scripts/package_src/nimbus_validator_client/after_install b/scripts/package_src/nimbus_validator_client/after_install index 3311c3f7d..8ac966f2e 100644 --- a/scripts/package_src/nimbus_validator_client/after_install +++ b/scripts/package_src/nimbus_validator_client/after_install @@ -2,10 +2,15 @@ set -e -DISTRO=$(lsb_release -si) +DISTRO="UNKNOWN" +if [[ -r /etc/os-release ]]; then + . /etc/os-release + DISTRO="${ID}" +fi + if ! id -u nimbus > /dev/null 2>&1; then case $DISTRO in - Ubuntu|Debian) + Ubuntu|ubuntu|Debian|debian) # Debian uses `adduser` to create user... adduser --system --no-create-home --group nimbus ;;