Skip to content

Commit

Permalink
drop dependency on lsb-release script (#4597)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jakubgs authored Feb 6, 2023
1 parent c81352c commit b79d267
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 0 additions & 2 deletions scripts/make_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand All @@ -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" \
Expand Down
10 changes: 7 additions & 3 deletions scripts/package_src/nimbus_beacon_node/after_install
Original file line number Diff line number Diff line change
@@ -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
;;
Expand Down
9 changes: 7 additions & 2 deletions scripts/package_src/nimbus_validator_client/after_install
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
Expand Down

0 comments on commit b79d267

Please sign in to comment.