Skip to content

Commit 1f06cf1

Browse files
stewartsmithhhorak
authored andcommitted
Better discover RedHat-like OSs
Amazon Linux 1 and Amazon Linux 2 are sufficiently like a redhat to pass here, but notably do not have an /etc/redhat-release, so implement logic that falls back to look for ID and ID_LIKE in the /etc/os-release file to catch these OSs. Signed-off-by: Stewart Smith <[email protected]>
1 parent e9817b6 commit 1f06cf1

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

configure.ac

+19-7
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,29 @@ _AX_TEXT_TPL_SUBST([PGLOGDIR_BASENAME])
113113

114114
AC_PATH_PROG([PG_UPGRADE_BIN], [pg_upgrade])
115115

116-
if test -z "$PKGCONFIG_DIR" -a "$pgsetup_cv_os_family" = redhat; then
117-
PKGCONFIG_DIR=/etc/postgresql
116+
if test -z "$PKGCONFIG_DIR"; then
117+
case $pgsetup_cv_os_family in
118+
redhat|fedora|amazon)
119+
PKGCONFIG_DIR=/etc/postgresql
120+
;;
121+
esac
118122
fi
119123

120-
if test -z "$POSTGRES_HOMEDIR" -a "$pgsetup_cv_os_family" = redhat; then
121-
POSTGRES_HOMEDIR=/var/lib/pgsql
124+
if test -z "$POSTGRES_HOMEDIR"; then
125+
case $pgsetup_cv_os_family in
126+
redhat|fedora|amazon)
127+
POSTGRES_HOMEDIR=/var/lib/pgsql
128+
;;
129+
esac
122130
fi
123131

124-
if test -z "$PGDATADIR" -a "$pgsetup_cv_os_family" = redhat; then
125-
# This is based on Red Hat's packaging.
126-
PGDATADIR='${localstatedir}/lib/pgsql/data'
132+
if test -z "$PGDATADIR"; then
133+
case $pgsetup_cv_os_family in
134+
redhat|fedora|amazon)
135+
# This is based on Red Hat's packaging.
136+
PGDATADIR='${localstatedir}/lib/pgsql/data'
137+
;;
138+
esac
127139
fi
128140

129141
README_DIST_BASENAME=README.rpm-dist

m4/packaging.m4

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
AC_DEFUN([PGSETUP_PACKAGING_INIT], [
22
AC_CACHE_CHECK(
3-
[for operating system (distribution)],
3+
[for operating system (distribution) family],
44
[pgsetup_cv_os_family], [
55
pgsetup_cv_os_family=
66
if test -r /etc/redhat-release; then
7-
pgsetup_cv_os_family=redhat
7+
pgsetup_cv_os_family=redhat;
8+
elif grep -c 'ID="amzn"' /etc/os-release > /dev/null; then
9+
pgsetup_cv_os_family=amazon;
10+
elif grep -c 'ID_LIKE=.*fedora' /etc/os-release > /dev/null; then
11+
pgsetup_cv_os_family=fedora;
812
fi
913
]
1014
)
1115
1216
case $pgsetup_cv_os_family in
13-
redhat)
17+
redhat|fedora|amazon)
1418
AC_PATH_PROG([RPM], [rpm])
1519
if test -z "$ac_cv_path_RPM"; then
1620
AC_MSG_ERROR("can not find RPM package manager")

0 commit comments

Comments
 (0)