commit
602a5594fa
9
autostart.sh
Executable file
9
autostart.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
result=`su - opengauss -c "source ~/.bash_profile; gs_ctl start -D /var/lib/opengauss/data"`
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Start openGauss database failed."
|
||||||
|
echo $result
|
||||||
|
else
|
||||||
|
echo "Start openGauss database success."
|
||||||
|
fi
|
||||||
44
og-edit.patch
Normal file
44
og-edit.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
diff -crN openGauss-server-2.1.0/src/bin/psql/startup.cpp openGauss-server-2.1.0-edit/src/bin/psql/startup.cpp
|
||||||
|
*** openGauss-server-2.1.0/src/bin/psql/startup.cpp 2021-12-13 16:23:09.000000000 +0800
|
||||||
|
--- openGauss-server-2.1.0-edit/src/bin/psql/startup.cpp 2022-01-22 22:08:39.420475340 +0800
|
||||||
|
***************
|
||||||
|
*** 257,262 ****
|
||||||
|
--- 257,266 ----
|
||||||
|
pset.popt.topt.recordSep.separator_zero = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (options.port == NULL) {
|
||||||
|
+ options.port = GetEnvStr("PORT");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (options.username == NULL)
|
||||||
|
password_prompt = pg_strdup(_("Password: "));
|
||||||
|
else {
|
||||||
|
***************
|
||||||
|
*** 1334,1337 ****
|
||||||
|
KEY_LEN);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
! }
|
||||||
|
\ No newline at end of file
|
||||||
|
--- 1338,1341 ----
|
||||||
|
KEY_LEN);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
! }
|
||||||
|
diff -crN openGauss-server-2.1.0/src/gausskernel/dbmind/db4ai/executor/Makefile openGauss-server-2.1.0-edit/src/gausskernel/dbmind/db4ai/executor/Makefile
|
||||||
|
*** openGauss-server-2.1.0/src/gausskernel/dbmind/db4ai/executor/Makefile 2021-12-13 16:23:09.000000000 +0800
|
||||||
|
--- openGauss-server-2.1.0-edit/src/gausskernel/dbmind/db4ai/executor/Makefile 2022-01-22 22:09:13.399068986 +0800
|
||||||
|
***************
|
||||||
|
*** 11,20 ****
|
||||||
|
|
||||||
|
include $(top_builddir)/src/Makefile.global
|
||||||
|
|
||||||
|
- PLATFORM_ARCH = $(shell uname -p)
|
||||||
|
- ifeq ($(PLATFORM_ARCH),x86_64)
|
||||||
|
- override CPPFLAGS += -mavx
|
||||||
|
- endif
|
||||||
|
|
||||||
|
ifneq "$(MAKECMDGOALS)" "clean"
|
||||||
|
ifneq "$(MAKECMDGOALS)" "distclean"
|
||||||
|
--- 11,16 ----
|
||||||
49
opengauss-server.spec
Normal file → Executable file
49
opengauss-server.spec
Normal file → Executable file
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
Name: opengauss
|
Name: opengauss
|
||||||
Version: 2.1.0
|
Version: 2.1.0
|
||||||
Release: 2
|
Release: 3
|
||||||
Summary: openGauss is an open source relational database management system
|
Summary: openGauss is an open source relational database management system
|
||||||
License: MulanPSL-2.0 and MIT and BSD and zlib and TCL and Apache-2.0 and BSL-1.0
|
License: MulanPSL-2.0 and MIT and BSD and zlib and TCL and Apache-2.0 and BSL-1.0
|
||||||
URL: https://gitee.com/opengauss/openGauss-server
|
URL: https://gitee.com/opengauss/openGauss-server
|
||||||
@ -21,8 +21,11 @@ Source1: %{cjson_name}-%{cjson_version}.tar.gz
|
|||||||
Source2: %{zlib_name}-%{zlib_version}.tar.gz
|
Source2: %{zlib_name}-%{zlib_version}.tar.gz
|
||||||
Source3: %{protobuf_name}-%{protobuf_version}.tar.gz
|
Source3: %{protobuf_name}-%{protobuf_version}.tar.gz
|
||||||
Source4: %{orc_name}-%{orc_version}.tar.gz
|
Source4: %{orc_name}-%{orc_version}.tar.gz
|
||||||
Source5: opengauss-bashprofile
|
Source5: opengauss-bashprofile
|
||||||
|
Source6: opengauss.service
|
||||||
|
Source7: autostart.sh
|
||||||
|
|
||||||
|
Patch0: og-edit.patch
|
||||||
Patch1: 0001-cJSON.patch
|
Patch1: 0001-cJSON.patch
|
||||||
Patch20: 0001-zlib.patch
|
Patch20: 0001-zlib.patch
|
||||||
Patch21: 0002-zlib.patch
|
Patch21: 0002-zlib.patch
|
||||||
@ -32,7 +35,7 @@ Patch40: 0001-orc.patch
|
|||||||
|
|
||||||
BuildRequires: cmake gcc gcc-c++ openssl-devel python
|
BuildRequires: cmake gcc gcc-c++ openssl-devel python
|
||||||
BuildRequires: cjson lz4-devel protobuf-devel snappy-devel zstd-devel boost-devel
|
BuildRequires: cjson lz4-devel protobuf-devel snappy-devel zstd-devel boost-devel
|
||||||
BuildRequires: libcgroup-devel curl-devel unixODBC-devel jemalloc-devel
|
BuildRequires: libcgroup-devel libcurl-devel unixODBC-devel jemalloc-devel
|
||||||
BuildRequires: java-1.8.0-openjdk-devel libedit-devel libaio-devel
|
BuildRequires: java-1.8.0-openjdk-devel libedit-devel libaio-devel
|
||||||
BuildRequires: bison flex DCF
|
BuildRequires: bison flex DCF
|
||||||
%ifnarch aarch64 %{arm}
|
%ifnarch aarch64 %{arm}
|
||||||
@ -44,7 +47,7 @@ BuildRequires: numactl-devel
|
|||||||
%global __requires_exclude %{_privatelibs}
|
%global __requires_exclude %{_privatelibs}
|
||||||
|
|
||||||
Requires: lz4-devel protobuf-devel snappy-devel zstd-devel boost-devel
|
Requires: lz4-devel protobuf-devel snappy-devel zstd-devel boost-devel
|
||||||
Requires: libcgroup-devel curl-devel unixODBC-devel jemalloc-devel
|
Requires: libcgroup-devel libcurl-devel unixODBC-devel jemalloc-devel
|
||||||
Requires: java-1.8.0-openjdk-devel libedit-devel libaio-devel
|
Requires: java-1.8.0-openjdk-devel libedit-devel libaio-devel
|
||||||
Requires: DCF
|
Requires: DCF
|
||||||
%ifnarch aarch64 %{arm}
|
%ifnarch aarch64 %{arm}
|
||||||
@ -63,6 +66,9 @@ openGauss kernel : openGauss is an open source relational database management sy
|
|||||||
%setup -q -D -T -a 3
|
%setup -q -D -T -a 3
|
||||||
%setup -q -D -T -a 4
|
%setup -q -D -T -a 4
|
||||||
|
|
||||||
|
pushd openGauss-server-%{version}
|
||||||
|
%patch0 -p1
|
||||||
|
popd
|
||||||
|
|
||||||
pushd %{cjson_name}-%{cjson_version}
|
pushd %{cjson_name}-%{cjson_version}
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
@ -164,6 +170,7 @@ popd
|
|||||||
pushd openGauss-server-%{version}
|
pushd openGauss-server-%{version}
|
||||||
%make_install -s %{?_smp_mflags}
|
%make_install -s %{?_smp_mflags}
|
||||||
mkdir -p %{buildroot}/var/lib/opengauss/data
|
mkdir -p %{buildroot}/var/lib/opengauss/data
|
||||||
|
mkdir -p %{buildroot}/%{apppath}/script
|
||||||
cp build/script/opengauss_config_file_mini %{buildroot}/%{apppath}/share/postgresql/
|
cp build/script/opengauss_config_file_mini %{buildroot}/%{apppath}/share/postgresql/
|
||||||
popd
|
popd
|
||||||
|
|
||||||
@ -172,6 +179,9 @@ install -d -m 700 $RPM_BUILD_ROOT%{?_localstatedir}/lib/opengauss/data
|
|||||||
|
|
||||||
# opengauss .bash_profile
|
# opengauss .bash_profile
|
||||||
install -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{?_localstatedir}/lib/opengauss/.bash_profile
|
install -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{?_localstatedir}/lib/opengauss/.bash_profile
|
||||||
|
# auto start files
|
||||||
|
install -m 644 %{SOURCE6} %{buildroot}/%{apppath}/script/opengauss.service
|
||||||
|
install -m 700 %{SOURCE7} %{buildroot}/%{apppath}/script/autostart.sh
|
||||||
|
|
||||||
%pre
|
%pre
|
||||||
/usr/sbin/groupadd -g 39 -o -r opengauss >/dev/null 2>&1 || :
|
/usr/sbin/groupadd -g 39 -o -r opengauss >/dev/null 2>&1 || :
|
||||||
@ -233,12 +243,39 @@ start_opengauss(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_service(){
|
||||||
|
cp %{apppath}/script/opengauss.service /usr/lib/systemd/system/
|
||||||
|
systemctl enable opengauss.service
|
||||||
|
}
|
||||||
|
|
||||||
# for install step
|
# for install step
|
||||||
if [ $1 = 1 ]; then
|
if [ $1 = 1 ]; then
|
||||||
set_mini_configparam
|
set_mini_configparam
|
||||||
|
add_service
|
||||||
start_opengauss
|
start_opengauss
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
%postun
|
||||||
|
remove_service(){
|
||||||
|
servicename=/usr/lib/systemd/system/opengauss.service
|
||||||
|
if [ -f $servicename ]; then
|
||||||
|
systemctl disable opengauss.service
|
||||||
|
rm $servicename
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
clear_database(){
|
||||||
|
pid=$(ps -ef | grep /var/lib/opengauss/data | grep -v grep | awk '{print $2}')
|
||||||
|
if [ "$pid" != "" ]; then
|
||||||
|
kill -9 $pid
|
||||||
|
fi
|
||||||
|
if [ -d /var/lib/opengauss/data ]; then
|
||||||
|
rm -rf /var/lib/opengauss/data
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
if [ "$1" = "0" ]; then
|
||||||
|
remove_service
|
||||||
|
clear_database
|
||||||
|
fi
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr (-,root,root)
|
%defattr (-,root,root)
|
||||||
@ -251,9 +288,11 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Jan 22 2022 zhangxubo <zhangxubo1@huawei.com> - 2.1.0-3
|
||||||
|
- Fix bugs: #I4RVNX
|
||||||
|
|
||||||
* Mon Dec 13 2021 zhangxubo <zhangxubo1@huawei.com> - 2.1.0-2
|
* Mon Dec 13 2021 zhangxubo <zhangxubo1@huawei.com> - 2.1.0-2
|
||||||
- Fix bugs: Mask dependencies acquired during installation
|
- Fix bugs: Mask dependencies acquired during installation
|
||||||
|
|
||||||
|
|
||||||
* Wed Dec 1 2021 zhangxubo <zhangxubo1@huawei.com> - 2.1.0-1
|
* Wed Dec 1 2021 zhangxubo <zhangxubo1@huawei.com> - 2.1.0-1
|
||||||
- Package init
|
- Package init
|
||||||
|
|||||||
12
opengauss.service
Executable file
12
opengauss.service
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Start openGauss server
|
||||||
|
After=local-fs.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=idle
|
||||||
|
ExecStart=/usr/local/opengauss/script/autostart.sh
|
||||||
|
Delegate=yes
|
||||||
|
RemainAfterExit=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Loading…
x
Reference in New Issue
Block a user