upgrade function

This commit is contained in:
zzh 2024-05-24 09:42:33 +08:00
parent b1efe9300d
commit fb7be5a93f
4 changed files with 39 additions and 3 deletions

View File

@ -11,6 +11,7 @@ rm -rf src/test/regress/sql
rm -rf src/test/regress/data
rm -rf src/test/regress/jdbc_test
rm -rf src/test/regress/input
rm -rf src/test/regress/jdbc_client_lib
rm -rf .git
rm -rf ./docker
cd ..

Binary file not shown.

View File

@ -179,6 +179,13 @@ if [ $1 = 1 ]; then
fi
fi
# upgrade installation
if [ $1 = 2 ]; then
pushd openGauss-server-%{version}/liteom
sh upgrade_GAUSSv5.sh upgrade_pre
popd
fi
%post
# set opengauss mini config parameters
set_mini_configparam(){
@ -232,6 +239,17 @@ add_service(){
systemctl daemon-reload
}
copy_bashrc(){
copyResult=$(su - opengauss -c "echo 'export GAUSSHOME=/usr/local/opengauss/' >> ~/.bashrc &&
echo 'export LD_LIBRARY_PATH=/usr/local/opengauss/lib:$LD_LIBRARY_PATH' >> ~/.bashrc &&
echo 'export PATH=/usr/local/opengauss/bin:$PATH' >> ~/.bashrc &&
echo 'export PGDATA=/var/lib/opengauss/data' >> ~/.bashrc &&
echo 'export PORT=7654' >> ~/.bashrc && source ~/.bashrc")
if [ $? -ne 0 ]; then
exit $result
fi
}
# for install step
if [ $1 = 1 ]; then
chmod -R 755 /usr/local/opengauss
@ -239,6 +257,20 @@ if [ $1 = 1 ]; then
set_mini_configparam
start_opengauss
add_service
copy_bashrc
fi
# upgrade installation
if [ $1 = 2 ]; then
pushd openGauss-server-%{version}/liteom
sh upgrade_GAUSSv5.sh upgrade_bin
servicename=/usr/lib/systemd/system/opengauss.service
if [ -f $servicename ]; then
systemctl restart opengauss.service
fi
sh upgrade_GAUSSv5.sh upgrade_post
sh upgrade_GAUSSv5.sh upgrade_commit
popd
fi
%postun
@ -277,6 +309,9 @@ fi
%changelog
* Fri May 24 2024 zhangzhihui <zhangzhihui42@huawei.com> - 5.0.1-12
- upgrade function
* Mon May 6 2024 liuheng <liuheng76@huawei.com> - 5.0.1-12
- Update version to 5.0.1

View File

@ -6,9 +6,9 @@ After=local-fs.target
Type=forking
User=opengauss
WorkingDirectory=/var/lib/opengauss
ExecStart=/bin/bash -c 'source ~/.bash_profile; gs_ctl start -D /var/lib/opengauss/data'
ExecStop=/bin/bash -c 'source ~/.bash_profile; gs_ctl stop -D /var/lib/opengauss/data'
ExecReload=/bin/bash -c 'source ~/.bash_profile; gs_ctl reload -D /var/lib/opengauss/data'
ExecStart=/bin/bash -c 'source ~/.bashrc; gs_ctl start -D /var/lib/opengauss/data'
ExecStop=/bin/bash -c 'source ~/.bashrc; gs_ctl stop -D /var/lib/opengauss/data'
ExecReload=/bin/bash -c 'source ~/.bashrc; gs_ctl reload -D /var/lib/opengauss/data'
Delegate=yes
RemainAfterExit=yes