drop dependency on lsb-release script (#4597)

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 <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-02-06 11:43:24 +01:00 committed by GitHub
parent c81352ce4e
commit b79d267b8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 7 deletions

View File

@ -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" \

View File

@ -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
;;

View File

@ -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
;;