#!/bin/sh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "@(#)install-sfw 1.1 08/03/29 SMI"
. ${SRC}/tools/install.subr
# functions - search for "START HERE" to find start of control flow
install_dir() {
dstdir=$1
mode=$2
mkdir -p $dstdir
chmod $mode $dstdir
}
install_file() {
src=$1
dstdir=$2
mode=$3
strip=$4
[ -d $dstdir ] || install_dir $dstdir $mode
dst=$dstdir/`basename $src`
rm -f $dst
cp -f $src $dst
if [ x$strip != 'x' ] ; then
strip $dst
fi
chmod $mode $dst
}
untar_old_binaries() {
rm -rf 81bin
gzip -dc pg81bin.tar.gz | tar xopf - 81bin/${MACH}
ln -s postgres 81bin/${MACH}/postmaster
}
copy_upg_files() {
install_file man1/pg_upgrade.sh.1 ${SYSMAN1DIR} 444
install_file pg_upgrade.sh ${UPGRBIN} 555
rm -f ${ROOT}/usr/bin/pg_upgrade.sh
install_file postgresql_upg.conf ${UPGRETC} 444
install_file pg_hba_upg.conf ${UPGRETC} 444
# Cannot use install_file here because we need to add -P option to cp.
cp -r -P -f 81bin/${MACH}/* ${OLDBIN81}
chmod 555 ${OLDBIN81}/*
install_file pg_upgrade.so ${NEWLIB82} 555
install_file pg_upgrade.sql ${NEWSHARE82} 444
}
# START HERE - actual script processing starts here
# install locations
UPGRADE=${ROOT}/usr/postgres/upgrade
UPGRBIN=${UPGRADE}/bin
UPGRETC=${UPGRADE}/etc
OLDBIN81=${UPGRADE}/81/bin
NEWLIB82=${UPGRADE}/82/lib
NEWSHARE82=${UPGRADE}/82/share
SYSMAN1DIR=${ROOT}/usr/share/man/man1
install_dir ${UPGRADE} 755
install_dir ${UPGRBIN} 755
install_dir ${UPGRADE}/81 755
install_dir ${OLDBIN81} 755
install_dir ${UPGRADE}/82 755
install_dir ${NEWLIB82} 755
install_dir ${NEWSHARE82} 755
untar_old_binaries
copy_upg_files
exit 0