243 |
|
pg_config_file=pg_hba.conf
|
244 |
|
pg_config_file_saved=pg_hba.conf.before-livesupport
|
|
241 |
pg_hba_file=pg_hba.conf
|
|
242 |
pg_hba_file_saved=pg_hba.conf.before-livesupport
|
|
243 |
pg_config_file=postgresql.conf
|
|
244 |
pg_config_file_saved=postgresql.conf.before-livesupport
|
|
245 |
|
|
246 |
echo "Test for Postgresql config dir...";
|
|
247 |
|
|
248 |
for PG_CONFIG_DIR in \
|
|
249 |
$pg_config_dir /etc/postgresql/7.4/main
|
|
250 |
do
|
|
251 |
echo -n "$PG_CONFIG_DIR/$pg_hba_file "
|
|
252 |
if [ -f $PG_CONFIG_DIR/$pg_hba_file ]; then
|
|
253 |
echo "Y"
|
|
254 |
PG_CONFIG_DIR_FOUND="$PG_CONFIG_DIR"
|
|
255 |
else
|
|
256 |
echo "N"
|
|
257 |
fi
|
|
258 |
done
|
|
259 |
|
|
260 |
if [ -f $PG_CONFIG_DIR_FOUND/$pg_hba_file ]; then
|
|
261 |
#-------------------------------------------------------------------------------
|
|
262 |
# Install the new pg_hba.conf file
|
|
263 |
#-------------------------------------------------------------------------------
|
|
264 |
echo "Modifying postgresql access permissions...";
|
|
265 |
|
|
266 |
|
|
267 |
if [ -f $PG_CONFIG_DIR_FOUND/$pg_hba_file_saved ]; then
|
|
268 |
echo "Backup of $PG_CONFIG_DIR_FOUND/$pg_hba_file already exists, skipped";
|
|
269 |
else
|
|
270 |
echo "Backup $PG_CONFIG_DIR_FOUND/$pg_hba_file to $PG_CONFIG_DIR_FOUND/$pg_hba_file_saved"
|
|
271 |
mv -f $PG_CONFIG_DIR_FOUND/$pg_hba_file $PG_CONFIG_DIR_FOUND/$pg_hba_file_saved ;
|
|
272 |
fi
|
|
273 |
|
|
274 |
echo "Installing replacement for $PG_CONFIG_DIR_FOUND/$pg_hba_file"
|
|
275 |
cp $install_etc/$pg_hba_file $PG_CONFIG_DIR_FOUND/$pg_hba_file
|
|
276 |
chown root:$postgres_user $PG_CONFIG_DIR_FOUND/$pg_hba_file
|
|
277 |
|
|
278 |
else
|
|
279 |
echo "###############################"
|
|
280 |
echo " Could not configure Postgresql"
|
|
281 |
echo "###############################"
|
|
282 |
fi
|
|
283 |
|
|
284 |
echo "done"
|
|
285 |
|
|
286 |
|
|
287 |
#-------------------------------------------------------------------------------
|
|
288 |
# Install the new postgresql.conf file just on ubuntu
|
|
289 |
#-------------------------------------------------------------------------------
|
|
290 |
|
|
291 |
|
|
292 |
if [ $PG_CONFIG_DIR_FOUND == "/etc/postgresql/7.4/main" ]; then
|
|
293 |
|
|
294 |
echo "Changing postgresql.conf...";
|
|
295 |
|
|
296 |
if [ -f $PG_CONFIG_DIR_FOUND/$pg_config_file_saved ]; then
|
|
297 |
echo "Backup of $PG_CONFIG_DIR_FOUND/$pg_config_file already exists, skipped";
|
|
298 |
else
|
|
299 |
echo "Backup $PG_CONFIG_DIR_FOUND/$pg_config_file to $PG_CONFIG_DIR_FOUND/$pg_config_file_saved"
|
|
300 |
cp -f $PG_CONFIG_DIR_FOUND/$pg_config_file $PG_CONFIG_DIR_FOUND/$pg_config_file_saved ;
|
|
301 |
fi
|
|
302 |
|
|
303 |
echo "Installing replacement for $PG_CONFIG_DIR_FOUND/$pg_config_file"
|
|
304 |
cp $install_etc/$pg_config_file $PG_CONFIG_DIR_FOUND/$pg_config_file
|
|
305 |
chown root:$postgres_user $PG_CONFIG_DIR_FOUND/$pg_config_file
|
252 |
|
# don't use restart for the init script, as it might return prematurely
|
253 |
|
# and in the later call to psql we wouldn't be able to connect
|
254 |
|
/etc/init.d/postgresql stop
|
255 |
|
/etc/init.d/postgresql start
|
|
309 |
#-------------------------------------------------------------------------------
|
|
310 |
# Detect Postgresql start-stop script name
|
|
311 |
#-------------------------------------------------------------------------------
|
|
312 |
|
|
313 |
echo "Test for Postgresql start-stop script...";
|
|
314 |
|
|
315 |
PG_INIT_SCRIPT_FOUND=no
|
|
316 |
|
|
317 |
for PG_INIT_SCRIPT in \
|
|
318 |
postgresql postgresql-7.4
|
|
319 |
do
|
|
320 |
echo -n "/etc/init.d/$PG_INIT_SCRIPT "
|
|
321 |
if [ -f /etc/init.d/$PG_INIT_SCRIPT ]; then
|
|
322 |
echo "Y"
|
|
323 |
PG_INIT_SCRIPT_FOUND="$PG_INIT_SCRIPT"
|
|
324 |
else
|
|
325 |
echo "N"
|
|
326 |
fi
|
|
327 |
done
|
|
328 |
if [ "x$PG_INIT_SCRIPT_FOUND" == "x" ]; then
|
|
329 |
echo "###############################"
|
|
330 |
echo " Could not restart Postgresql"
|
|
331 |
echo "###############################"
|
|
332 |
else
|
|
333 |
# don't use restart for the init script, as it might return prematurely
|
|
334 |
# and in the later call to psql we wouldn't be able to connect
|
|
335 |
/etc/init.d/$PG_INIT_SCRIPT_FOUND stop
|
|
336 |
/etc/init.d/$PG_INIT_SCRIPT_FOUND start
|
|
337 |
fi
|
|
338 |
echo "done"
|