提交 48792b3e 编写于 作者: W wangzelin.wzl

add build rpm logic

上级 1c828289
#!/bin/bash
PROJECT_DIR=$1
PROJECT_NAME=$2
VERSION=$3
RELEASE=$4
CUR_DIR=$(dirname $(readlink -f "$0"))
TOP_DIR=$CUR_DIR/.rpm_build
echo "[BUILD] args: CURDIR=${CUR_DIR} PROJECT_NAME=${PROJECT_NAME} VERSION=${VERSION} RELEASE=${RELEASE}"
# prepare rpm build dirs
rm -rf $TOP_DIR
mkdir -p $TOP_DIR/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
# build rpm
cd $CUR_DIR
export PROJECT_NAME=${PROJECT_NAME}
export VERSION=${VERSION}
export RELEASE=${RELEASE}
rpmbuild --define "_topdir $TOP_DIR" -bb $PROJECT_NAME.spec
find $TOP_DIR/ -name "*.rpm" -exec mv {} . 2>/dev/null \;
\ No newline at end of file
Name: obagent Name: obagent
Summary: ob agent program Summary: ob agent program
Group: alipay/oceanbase Group: oceanbase
Version: 1.1.1 Version: 1.1.1
Release: %(echo $RELEASE)%{?dist} Release: %(echo $RELEASE)%{?dist}
URL: http://rpm.corp.taobao.com/find.php?q=obagent URL: https://github.com/oceanbase/obagent
License: Commercial License: MulanPSL - 2.0
BuildArch: x86_64 aarch64 BuildArch: x86_64 aarch64
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description %description
obagent program obagent program
%define _prefix /home/admin %define _prefix /home/admin
%prep
rm -rf %{_sourcedir}/%{name}
mkdir -p %_sourcedir/%{name}
cp -r $OLDPWD/* %_sourcedir/%{name}
%build %build
cd %_sourcedir/%{name} cd $OLDPWD/../
make build make build
%install %install
cd %_sourcedir/%{name} cd $OLDPWD/../
mkdir -p $RPM_BUILD_ROOT/%{_prefix}/obagent/ mkdir -p $RPM_BUILD_ROOT/%{_prefix}/obagent/
mkdir -p $RPM_BUILD_ROOT/%{_prefix}/obagent/bin mkdir -p $RPM_BUILD_ROOT/%{_prefix}/obagent/bin
mkdir -p $RPM_BUILD_ROOT/%{_prefix}/obagent/conf mkdir -p $RPM_BUILD_ROOT/%{_prefix}/obagent/conf
...@@ -50,3 +44,7 @@ cp -r etc/* $RPM_BUILD_ROOT/%{_prefix}/obagent/conf ...@@ -50,3 +44,7 @@ cp -r etc/* $RPM_BUILD_ROOT/%{_prefix}/obagent/conf
%{_prefix}/obagent/conf/module_config/*.yaml %{_prefix}/obagent/conf/module_config/*.yaml
%{_prefix}/obagent/conf/prometheus_config/*.yaml %{_prefix}/obagent/conf/prometheus_config/*.yaml
%{_prefix}/obagent/conf/prometheus_config/rules/*.yaml %{_prefix}/obagent/conf/prometheus_config/rules/*.yaml
%changelog
* Tue Mar 29 2022 oceanbase
- obagent
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册