1
2
3
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
| Name: fastdfs
Version: 5.0.5
Release: 7%{?dist}
Summary: FastDFS server and client
License: GPL
Group: Arch/Tech
URL: https://github.com/happyfish100/fastdfs
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Source0: %{name}-%{version}.tar.gz
Source1: fdfs_trackerd.init
Source2: fdfs_storaged.init
Source10: fdfs_trackerd.service
Source20: fdfs_storaged.service
Source3: tracker.conf
Source4: storage.conf
Source5: client.conf
Source6: http.conf
Requires: %__cp %__mv %__chmod %__grep %__mkdir %__install %__id
BuildRequires: gcc
BuildRequires: glibc-devel
BuildRequires: libtool
BuildRequires: make
BuildRequires: libfastcommon-devel
Requires(post): chkconfig
%description
This package provides tracker & storage of fastdfs
%package tracker
Summary: fastdfs tracker
Requires: fastdfs
Requires: libfastcommon
%package storage
Summary: fastdfs storage
Requires: fastdfs
Requires: libfastcommon
%package tool
Summary: fastdfs tools
Requires: libfastcommon
%package -n libfdfsclient
Summary: The client dynamic library of fastdfs
Requires: libfastcommon
%package -n libfdfsclient-devel
Summary: The client header of fastdfs
Requires: libfdfsclient
%description tracker
This package provides tracker of fastdfs
%description storage
This package provides storage of fastdfs
%description -n libfdfsclient
This package is client dynamic library of fastdfs
%description -n libfdfsclient-devel
This package is client header of fastdfs client
%description tool
This package is tools for fastdfs
%prep
%setup -q
%build
# FIXME: I need to fix the upstream Makefile to use LIBDIR et al. properly and
# send the upstream maintainer a patch.
# add DOCDIR to the configure part
./make.sh
%install
rm -rf %{buildroot}
DESTDIR=$RPM_BUILD_ROOT ./make.sh install
mkdir -p $RPM_BUILD_ROOT%{_bindir}
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/fdfs
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/fastdfs/{client,storage,tracker}
cp conf/storage_ids.conf $RPM_BUILD_ROOT%{_sysconfdir}/fdfs/
cp conf/mime.types $RPM_BUILD_ROOT%{_sysconfdir}/fdfs/
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/init.d/fdfs_storaged
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/init.d/fdfs_trackerd
rm -rf $RPM_BUILD_ROOT%{_bindir}/restart.sh
rm -rf $RPM_BUILD_ROOT%{_bindir}/stop.sh
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/fdfs/tracker.conf.sample
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/fdfs/storage.conf.sample
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/fdfs/client.conf.sample
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/fdfs/storage_ids.conf.sample
# install SYSV init stuff
%{__mkdir} -p $RPM_BUILD_ROOT%{_initrddir}
%{__install} -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/fdfs_trackerd
%{__install} -m 755 %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/fdfs_storaged
%{__install} -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/fdfs/tracker.conf
%{__install} -m 644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/fdfs/storage.conf
%{__install} -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/fdfs/client.conf
%{__install} -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/fdfs/http.conf
%pre
# Add the "fdfs" user
getent group fdfs >/dev/null || groupadd -r fdfs
getent passwd fdfs >/dev/null || \
useradd -r -g fdfs -s /sbin/nologin \
-d /var/lib/fastdfs -c "fastdfs user" fdfs
exit 0
%post tracker
/sbin/chkconfig --add fdfs_trackerd
%preun tracker
service stop fdfs_trackerd || true
/sbin/chkconfig --del fdfs_trackerd
%post storage
/sbin/chkconfig --add fdfs_storaged
%preun storage
service stop fdfs_storaged || true
/sbin/chkconfig --del fdfs_storaged
%postun
%clean
rm -rf $RPM_BUILD_ROOT
pushd common;make -s clean ;popd
pushd tracker;make -s clean ;popd
pushd storage;make -s clean ;popd
pushd test;make -s clean ;popd
pushd client ;make -s clean ;popd
%files
%defattr(-,root,root,-)
%dir %{_sysconfdir}/fdfs
%dir %attr(0755,fdfs,fdfs) %{_sharedstatedir}/fastdfs
%files tracker
%defattr(-,root,root,-)
%{_bindir}/fdfs_trackerd
%{_initrddir}/fdfs_trackerd
%config(noreplace) %{_sysconfdir}/fdfs/tracker.conf
%dir %attr(0755,fdfs,fdfs) %{_sharedstatedir}/fastdfs/tracker
%files storage
%defattr(-,root,root,-)
%{_bindir}/fdfs_storaged
%{_initrddir}/fdfs_storaged
%config(noreplace) %{_sysconfdir}/fdfs/storage.conf
%dir %attr(0755,fdfs,fdfs) %{_sharedstatedir}/fastdfs/storage
%files -n libfdfsclient
%{_libdir}/libfdfsclient*
%config(noreplace) %{_sysconfdir}/fdfs/client.conf
%config(noreplace) %{_sysconfdir}/fdfs/http.conf
%config(noreplace) %{_sysconfdir}/fdfs/mime.types
%config(noreplace) %{_sysconfdir}/fdfs/storage_ids.conf
%dir %attr(0755,fdfs,fdfs) %{_sharedstatedir}/fastdfs/client
%files -n libfdfsclient-devel
%defattr(-,root,root,-)
%{_includedir}/fastdfs/*
%files tool
%{_bindir}/fdfs_monitor
%{_bindir}/fdfs_test
%{_bindir}/fdfs_test1
%{_bindir}/fdfs_crc32
%{_bindir}/fdfs_upload_file
%{_bindir}/fdfs_download_file
%{_bindir}/fdfs_delete_file
%{_bindir}/fdfs_file_info
%{_bindir}/fdfs_appender_test
%{_bindir}/fdfs_appender_test1
%{_bindir}/fdfs_append_file
%{_bindir}/fdfs_upload_appender
%changelog
* Thu Nov 05 2015 Purple Grape <purplegrape4@gmail.com>
- new init scripts
- run as user fdfs by default
* Mon Jun 23 2014 Zaixue Liao <liaozaixue@yongche.com>
- first RPM release (1.0)
|