Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PXB-3422 Telemetry should be updated to know if PXB is pro #1628

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

. /usr/share/debconf/confmodule

exit 0
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,19 @@ build_srpm(){
percona-xtrabackup.spec
fi
#
cd ${WORKDIR}/rpmbuild/SOURCES
wget https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh
cd ${WORKDIR}/rpmbuild/SPECS
line_number=$(grep -n SOURCE999 percona-xtrabackup.spec | awk -F ':' '{print $1}')
cp ../SOURCES/call-home.sh ./
awk -v n=$line_number 'NR <= n {print > "part1.txt"} NR > n {print > "part2.txt"}' percona-xtrabackup.spec
head -n -1 part1.txt > temp && mv temp part1.txt
echo "cat <<'CALLHOME' > /tmp/call-home.sh" >> part1.txt
cat call-home.sh >> part1.txt
echo "CALLHOME" >> part1.txt
cat part2.txt >> part1.txt
rm -f call-home.sh part2.txt
mv part1.txt percona-xtrabackup.spec
cd $WORKDIR
#
mv -fv $TARFILE $WORKDIR/rpmbuild/SOURCES
Expand Down Expand Up @@ -597,6 +610,7 @@ build_source_deb(){
sed -i "s:Conflicts\: percona-xtrabackup-test-pro:Conflicts\: percona-xtrabackup-test:g" debian/control
cp debian/percona-xtrabackup-84.docs debian/percona-xtrabackup-pro-84.docs
cp debian/percona-xtrabackup-84.install debian/percona-xtrabackup-pro-84.install
cp debian/percona-xtrabackup-84.postinst debian/percona-xtrabackup-pro-84.postinst
cp debian/percona-xtrabackup-84.lintian-overrides debian/percona-xtrabackup-pro-84.lintian-overrides
cp debian/percona-xtrabackup-test-84.install debian/percona-xtrabackup-test-pro-84.install
cp debian/percona-xtrabackup-test-84.lintian-overrides debian/percona-xtrabackup-test-pro-84.lintian-overrides
Expand Down Expand Up @@ -655,6 +669,22 @@ build_deb(){
dpkg-source -x $DSC
cd $DIRNAME
dch -m -D "$OS_NAME" --force-distribution -v "$VERSION-$DEB_RELEASE.$OS_NAME" 'Update distribution'
postfix=""
if [ x"${FIPSMODE}" == x1 ]; then
postfix="-pro"
fi
cd debian/
wget https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh
sed -i 's:exit 0::' percona-xtrabackup"${postfix}"-84.postinst
echo "cat <<'CALLHOME' > /tmp/call-home.sh" >> percona-xtrabackup"${postfix}"-84.postinst
cat call-home.sh >> percona-xtrabackup"${postfix}"-84.postinst
echo "CALLHOME" >> percona-xtrabackup"${postfix}"-84.postinst
echo "bash +x /tmp/call-home.sh -f \"PRODUCT_FAMILY_PXB\" -v \"${VERSION}-${DEB_RELEASE}"${postfix}"\" -d \"PACKAGE\" &>/dev/null || :" >> percona-xtrabackup"${postfix}"-84.postinst
echo "rm -rf /tmp/call-home.sh" >> percona-xtrabackup"${postfix}"-84.postinst
echo "exit 0" >> percona-xtrabackup"${postfix}"-84.postinst
rm -f call-home.sh
cd ../

dpkg-buildpackage -rfakeroot -uc -us -b

cd ${WORKDIR}
Expand Down
10 changes: 10 additions & 0 deletions storage/innobase/xtrabackup/utils/percona-xtrabackup.spec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Group: Applications/Databases
License: GPLv2
URL: http://www.percona.com/software/percona-xtrabackup
Source: percona-xtrabackup-%{version}%{xb_version_extra}.tar.gz
Source999: call-home.sh

BuildRequires: %{cmake_bin}, libaio-devel, libgcrypt-devel, ncurses-devel, readline-devel, zlib-devel, libev-devel openssl-devel
BuildRequires: libcurl-devel
Expand Down Expand Up @@ -127,6 +128,15 @@ rm -rf $RPM_BUILD_ROOT/%{_mandir}/man1/l*
rm -rf $RPM_BUILD_ROOT/%{_mandir}/man1/p*
rm -rf $RPM_BUILD_ROOT/%{_mandir}/man1/z*

%post
cp %SOURCE999 /tmp/ 2>/dev/null ||
%if 0%{?enable_fipsmode}
bash /tmp/call-home.sh -f "PRODUCT_FAMILY_PXB" -v %{xb_version_major}.%{xb_version_minor}.%{xb_version_patch}-%{xb_version_extra}-%{xb_rpm_version_extra}-pro -d "PACKAGE" &>/dev/null || :
%else
bash /tmp/call-home.sh -f "PRODUCT_FAMILY_PXB" -v %{xb_version_major}.%{xb_version_minor}.%{xb_version_patch}-%{xb_version_extra}-%{xb_rpm_version_extra} -d "PACKAGE" &>/dev/null || :
%endif
rm -f /tmp/call-home.sh

%clean
rm -rf $RPM_BUILD_ROOT

Expand Down
Loading