215215echo " NOTE: patching postgresql.conf files"
216216cp " $PG_HBA_FILE " " $DATDIR /pg_hba.conf"
217217cp " $PG_IDENT_FILE " " $DATDIR /pg_ident.conf"
218- cp " $READREPL_CONFIG_FILE " " $DATDIR /04-read-replica.conf"
218+ mkdir -p " $DATDIR /conf.d"
219+ cp " $READREPL_CONFIG_FILE " " $DATDIR /conf.d/04-read-replica.conf"
219220mkdir -p " $DATDIR /extension-custom-scripts"
220221cp -r " $EXTENSION_CUSTOM_SCRIPTS " /* " $DATDIR /extension-custom-scripts"
221222
222223# Configure supautils
223- sed " s|supautils.extension_custom_scripts_path = '/etc/postgresql-custom/extension-custom-scripts'|supautils.extension_custom_scripts_path = '$DATDIR /extension-custom-scripts'|" " $SUPAUTILS_CONFIG_FILE " > " $DATDIR /05-supautils.conf"
224+ sed " s|supautils.extension_custom_scripts_path = '/etc/postgresql-custom/extension-custom-scripts'|supautils.extension_custom_scripts_path = '$DATDIR /extension-custom-scripts'|" " $SUPAUTILS_CONFIG_FILE " > " $DATDIR /conf.d/ 05-supautils.conf"
224225
225226# Configure PostgreSQL
226227sed -e " 1i\\
227- include = '$DATDIR /05-supautils.conf'" \
228+ include = '$DATDIR /conf.d/ 05-supautils.conf'" \
228229-e " \$ a\\
229230pgsodium.getkey_script = '$PGSODIUM_GETKEY_SCRIPT '" \
230231-e " \$ a\\
231232vault.getkey_script = '$PGSODIUM_GETKEY_SCRIPT '" \
232233-e " s|data_directory = '/var/lib/postgresql/data'|data_directory = '$DATDIR '|" \
233234-e " s|hba_file = '/etc/postgresql/pg_hba.conf'|hba_file = '$DATDIR /pg_hba.conf'|" \
234235-e " s|ident_file = '/etc/postgresql/pg_ident.conf'|ident_file = '$DATDIR /pg_ident.conf'|" \
235- -e " \$ a \ \
236+ -e " s|include_dir = '/etc/postgresql-custom'|include_dir = ' $DATDIR /conf.d'| " \
236237" $PSQL_CONF_FILE " > " $DATDIR /postgresql.conf"
237238
238239# Function to configure OrioleDB specific settings
@@ -242,34 +243,34 @@ orioledb_config_items() {
242243 echo " non-macos oriole conf"
243244 sed -i ' s/ timescaledb,//g;' " $DATDIR /postgresql.conf"
244245 sed -i ' s/db_user_namespace = off/#db_user_namespace = off/g;' " $DATDIR /postgresql.conf"
245- sed -i 's/ timescaledb,//g; s/ plv8,//g; s/ pgjwt,//g;' " $DATDIR /05-supautils.conf"
246+ sed -i ' s/ timescaledb,//g; s/ plv8,//g; s/ pgjwt,//g;' " $DATDIR /conf.d/ 05-supautils.conf"
246247 sed -i ' s/\(shared_preload_libraries.*\)' \' ' \(.*\)$/\1, orioledb' \' ' \2/' " $DATDIR /postgresql.conf"
247248 echo " default_table_access_method = 'orioledb'" >> " $DATDIR /postgresql.conf"
248249 elif [[ " $1 " = " orioledb-17" && " $CURRENT_SYSTEM " = " aarch64-darwin" ]]; then
249250 # macOS specific configuration
250251 echo " macOS detected, applying macOS specific configuration"
251252 ls -la " $DATDIR "
252-
253+
253254 # Use perl instead of sed for macOS
254255 perl -pi -e ' s/ timescaledb,//g' " $DATDIR /postgresql.conf"
255256 perl -pi -e ' s/db_user_namespace = off/#db_user_namespace = off/g' " $DATDIR /postgresql.conf"
256-
257- perl -pi -e 's/ timescaledb,//g' " $DATDIR /05-supautils.conf"
258- perl -pi -e 's/ plv8,//g' " $DATDIR /05-supautils.conf"
259- perl -pi -e 's/ pgjwt,//g' " $DATDIR /05-supautils.conf"
257+
258+ perl -pi -e ' s/ timescaledb,//g' " $DATDIR /conf.d/ 05-supautils.conf"
259+ perl -pi -e ' s/ plv8,//g' " $DATDIR /conf.d/ 05-supautils.conf"
260+ perl -pi -e ' s/ pgjwt,//g' " $DATDIR /conf.d/ 05-supautils.conf"
260261 perl -pi -e ' s/(shared_preload_libraries\s*=\s*' \' ' .*?)' \' ' /\1, orioledb' \' ' /' " $DATDIR /postgresql.conf"
261-
262+
262263 echo " default_table_access_method = 'orioledb'" >> " $DATDIR /postgresql.conf"
263264 elif [[ " $VERSION " == " 17" && " $CURRENT_SYSTEM " != " aarch64-darwin" ]]; then
264265 echo " non-macos pg 17 conf"
265266 sed -i ' s/ timescaledb,//g;' " $DATDIR /postgresql.conf"
266267 sed -i ' s/db_user_namespace = off/#db_user_namespace = off/g;' " $DATDIR /postgresql.conf"
267- sed -i 's/ timescaledb,//g; s/ plv8,//g;' " $DATDIR /05-supautils.conf"
268+ sed -i ' s/ timescaledb,//g; s/ plv8,//g;' " $DATDIR /conf.d/ 05-supautils.conf"
268269 elif [[ " $VERSION " == " 17" && " $CURRENT_SYSTEM " = " aarch64-darwin" ]]; then
269270 perl -pi -e ' s/db_user_namespace = off/#db_user_namespace = off/g;' " $DATDIR /postgresql.conf"
270271 perl -pi -e ' s/ timescaledb,//g' " $DATDIR /postgresql.conf"
271- perl -pi -e 's/ timescaledb,//g' " $DATDIR /05-supautils.conf"
272- perl -pi -e 's/ plv8,//g;' " $DATDIR /05-supautils.conf"
272+ perl -pi -e ' s/ timescaledb,//g' " $DATDIR /conf.d/ 05-supautils.conf"
273+ perl -pi -e ' s/ plv8,//g;' " $DATDIR /conf.d/ 05-supautils.conf"
273274 fi
274275}
275276
0 commit comments