From c36a55e98599c96f228eb7ea09c1c71a5e114ee5 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 27 May 2017 15:22:27 +0200 Subject: [PATCH] package.bash: make it work somewhat on RHEL RHEL and CentOS do not have /etc/os-release yet. Read from /etc/redhat-release instead. Fixes https://github.com/rfjakob/gocryptfs/issues/113 --- package.bash | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/package.bash b/package.bash index d3b95fd..4cb462e 100755 --- a/package.bash +++ b/package.bash @@ -3,8 +3,23 @@ set -eu cd $(dirname "$0") -source build.bash # Builds binary and sets GITVERSION (example: v0.7-15-gf01f599) -source /etc/os-release # Sets ID (example: fedora) and VERSION_ID (example: 23) +# Build binary and sets $GITVERSION (example: v0.7-15-gf01f599) +source build.bash + +# Set $ID (example: "fedora", "debian") and $VERSION_ID (example: "23", "8") +if [[ -e /etc/os-release ]]; then + # Modern Debian and Fedora + source /etc/os-release +elif [[ -e /etc/redhat-release ]]; then + # RHEL and CentOS + ID=$(cat /etc/redhat-release | tr ' ' '_') + VERSION_ID="" +else + echo "Could not get distribution version" + ID=unknown + VERSION_ID=.unknown +fi + ARCH=$(go env GOARCH) # Build gocryptfs.1 man page ./Documentation/MANPAGE-render.bash > /dev/null