tdengine.spec 3.8 KB
Newer Older
H
hzcheng 已提交
1 2
%define homepath         /usr/local/taos
%define cfg_install_dir  /etc/taos
H
huili 已提交
3
%define __strip /bin/true
H
hzcheng 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

Name:		  tdengine
Version:	%{_version}
Release:	3%{?dist}
Summary:	tdengine from taosdata
Group:	  Application/Database
License:	AGPL
URL:		  www.taosdata.com

#BuildRoot:  %_topdir/BUILDROOT
BuildRoot:   %{_tmppath}/%{name}-%{version}-%{release}-root 

#Prefix: /usr/local/taos

#BuildRequires:	
#Requires:	

%description
Big Data Platform Designed and Optimized for IoT

#"prep" Nothing needs to be done 
#%prep
#%setup -q
#%setup -T 

#"build" Nothing needs to be done 
#%build
#%configure
#make %{?_smp_mflags}

%install
#make install DESTDIR=%{buildroot}
rm -rf %{buildroot}

echo topdir: %{_topdir}
echo version: %{_version}
echo buildroot: %{buildroot}

H
huili 已提交
42 43 44
versioninfo=$(%{_compiledir}/../packaging/tools/get_version.sh)
libfile="libtaos.so.${versioninfo}"

H
hzcheng 已提交
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
# create install path, and cp file
mkdir -p %{buildroot}%{homepath}/bin
mkdir -p %{buildroot}%{homepath}/cfg
mkdir -p %{buildroot}%{homepath}/connector
mkdir -p %{buildroot}%{homepath}/driver
mkdir -p %{buildroot}%{homepath}/examples
mkdir -p %{buildroot}%{homepath}/include
mkdir -p %{buildroot}%{homepath}/init.d
mkdir -p %{buildroot}%{homepath}/script

cp %{_compiledir}/../packaging/cfg/taos.cfg         %{buildroot}%{homepath}/cfg
cp %{_compiledir}/../packaging/rpm/taosd            %{buildroot}%{homepath}/init.d
cp %{_compiledir}/../packaging/tools/post.sh        %{buildroot}%{homepath}/script
cp %{_compiledir}/../packaging/tools/preun.sh       %{buildroot}%{homepath}/script
cp %{_compiledir}/build/bin/taos                    %{buildroot}%{homepath}/bin
60
cp %{_compiledir}/build/bin/taosd                   %{buildroot}%{homepath}/bin
S
slguan 已提交
61
cp %{_compiledir}/build/bin/taosdemo                %{buildroot}%{homepath}/bin
62
cp %{_compiledir}/build/bin/taosdump                %{buildroot}%{homepath}/bin
H
huili 已提交
63
cp %{_compiledir}/build/lib/${libfile}              %{buildroot}%{homepath}/driver
H
hzcheng 已提交
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
cp %{_compiledir}/../src/inc/taos.h                 %{buildroot}%{homepath}/include
cp -r %{_compiledir}/../src/connector/grafana       %{buildroot}%{homepath}/connector
cp -r %{_compiledir}/../src/connector/python        %{buildroot}%{homepath}/connector
cp -r %{_compiledir}/../src/connector/go            %{buildroot}%{homepath}/connector
cp %{_compiledir}/build/lib/taos-jdbcdriver*dist.*  %{buildroot}%{homepath}/connector
cp -r %{_compiledir}/../tests/examples/*            %{buildroot}%{homepath}/examples

#Scripts executed before installation
%pre
function is_using_systemd() {
    if pidof systemd &> /dev/null; then
        return 0
    else
        return 1
    fi
}

P
plum-lihui 已提交
81 82 83 84 85
csudo=""
if command -v sudo > /dev/null; then
    csudo="sudo"
fi

H
hzcheng 已提交
86 87 88
# Stop the service if running
if pidof taosd &> /dev/null; then
    if is_using_systemd; then
P
plum-lihui 已提交
89
        ${csudo} systemctl stop taosd || :
H
hzcheng 已提交
90
    else
P
plum-lihui 已提交
91
        ${csudo} service taosd stop || :
H
hzcheng 已提交
92 93 94 95 96 97 98
    fi
    echo "Stop taosd service success!"
    sleep 1
fi

# if taos.cfg already softlink, remove it
if [ -f %{cfg_install_dir}/taos.cfg ]; then
P
plum-lihui 已提交
99
    ${csudo} rm -f %{homepath}/cfg/taos.cfg   || :
H
hzcheng 已提交
100 101
fi 

H
huili 已提交
102 103 104
${csudo} rpm -e  tdengine || :
${csudo} rpm -e --noscripts tdengine || :

H
hzcheng 已提交
105 106
#Scripts executed after installation
%post
P
plum-lihui 已提交
107 108 109 110
csudo=""
if command -v sudo > /dev/null; then
    csudo="sudo"
fi
H
hzcheng 已提交
111
cd %{homepath}/script
P
plum-lihui 已提交
112
${csudo} ./post.sh
H
hzcheng 已提交
113 114 115
 
# Scripts executed before uninstall
%preun
P
plum-lihui 已提交
116 117 118 119
csudo=""
if command -v sudo > /dev/null; then
    csudo="sudo"
fi
H
hzcheng 已提交
120 121 122
# only remove package to call preun.sh, not but update(2) 
if [ $1 -eq 0 ];then
  cd %{homepath}/script
P
plum-lihui 已提交
123
  ${csudo} ./preun.sh
H
hzcheng 已提交
124 125 126 127 128 129 130
fi
 
# Scripts executed after uninstall
%postun
 
# clean build dir
%clean
P
plum-lihui 已提交
131 132 133 134 135
csudo=""
if command -v sudo > /dev/null; then
    csudo="sudo"
fi
${csudo} rm -rf %{buildroot}
H
hzcheng 已提交
136 137 138 139 140 141 142 143 144 145 146

#Specify the files to be packaged
%files
/*
#%doc

#Setting default permissions
%defattr  (-,root,root,0755)
#%{prefix}

#%changelog