mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-29 21:54:13 +01:00
86185989cf
1, use the pg source and photon spec to build postgres 9.6 2, install 9.6 on the photon 4.0 3, then leverage pg_upgrade to handle the pg major version migration Signed-off-by: Wang Yan <wangyan@vmware.com>
44 lines
1.3 KiB
Bash
Executable File
44 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
name='postgresql'
|
|
version='9.6.21'
|
|
|
|
function checkdep {
|
|
if ! wget --version &> /dev/null
|
|
then
|
|
echo "Need to install wget first and run this script again."
|
|
exit 1
|
|
fi
|
|
|
|
if ! bzip2 --version &> /dev/null
|
|
then
|
|
echo "Need to install bzip2 first and run this script again."
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
checkdep
|
|
|
|
cur=$PWD
|
|
workDir=`mktemp -d ${TMPDIR-/tmp}/$name.XXXXXX`
|
|
mkdir -p $workDir && cd $workDir
|
|
|
|
# step 1: get source code of pg 9.6, and rename the code directory from postgres to postgres96
|
|
wget http://ftp.postgresql.org/pub/source/v$version/$name-$version.tar.bz2
|
|
bzip2 -d ./$name-$version.tar.bz2 && tar -xvf ./$name-$version.tar
|
|
mkdir -p ${name}96-$version && cp -r ./$name-$version/* ./${name}96-$version/ && rm -rf ./$name-$version
|
|
tar -cvjSf ${name}96-$version.tar.bz2 ${name}96-$version
|
|
|
|
# step 2: get spec builder script, and replace version to 4, then to build the pg96 rpm packages
|
|
wget https://raw.githubusercontent.com/vmware/photon/4.0/tools/scripts/build_spec.sh
|
|
sed "s|VERSION=3|VERSION=4|g" -i build_spec.sh
|
|
chmod 655 ./build_spec.sh && cp $cur/postgres.spec .
|
|
./build_spec.sh ./postgres.spec
|
|
cp ./stage/RPMS/x86_64/${name}96-libs-$version-1.ph4.x86_64.rpm $cur
|
|
cp ./stage/RPMS/x86_64/${name}96-$version-1.ph4.x86_64.rpm $cur
|
|
|
|
# clean
|
|
cd $cur && rm -rf $workDir
|