From cef8898cb42400910d25a8f2a15e1ab191354a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Mon, 6 Feb 2023 10:10:19 +0100 Subject: [PATCH] drop dependency on lsb-release script 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 | 7 ++++++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/make_packages.sh b/scripts/make_packages.sh index 5f6729bdef..d33caf1915 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 55a6c11b8f..d16c87f95d 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 55a6c11b8f..6f1b91dd9d 100644 --- a/scripts/package_src/nimbus_validator_client/after_install +++ b/scripts/package_src/nimbus_validator_client/after_install @@ -2,7 +2,12 @@ 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)