source: box/trunk/contrib/rpm/boxbackup.spec @ 2685

Revision 2685, 8.2 KB checked in by chris, 2 years ago (diff)

Really fix boxbackup spec.

  • Property svn:eol-style set to LF
Line 
1%define bb_user_id 171
2%define ident %{name}-%{version}
3
4# In official distribution tarballs, distribution files are copied to
5# the base directory (where configure is), so distribution_dir should be empty.
6# This is the default, overridden by the following block in non-distribution
7# builds.
8%define distribution_dir ''
9
10# BOX_PRIVATE_BEGIN
11# In unofficial tarballs, made from svn, distribution files are still in
12# distribution/boxbackup, so the following line overrides the default above:
13# (this section will be removed automatically from distribution tarballs
14# by infrastructure/makedistribution.pl)
15%define distribution_dir distribution/boxbackup/
16# BOX_PRIVATE_END
17
18# Detect distribution. So far we only special-case SUSE. If you need to make
19# any distro specific changes to get the package building on your system
20# please email them to boxbackup-dev@boxbackup.org
21#%define is_fc   %(test -e %{_sysconfdir}/fedora-release && echo 1 || echo 0)
22#%define is_mdk  %(test -e %{_sysconfdir}/mandrake-release && echo 1 || echo 0)
23#%define is_rh   %(test -e %{_sysconfdir}/redhat-release && echo 1 || echo 0)
24%define is_suse %(test -e %{_sysconfdir}/SuSE-release && echo 1 || echo 0)
25
26%if %{is_suse}
27%define init_dir %{_sysconfdir}/init.d
28%define distribution suse
29%define rc_start rc
30%else
31%define init_dir %{_sysconfdir}/rc.d/init.d
32%define distribution redhat
33%define rc_start "service "
34%endif
35
36Summary: An automatic on-line backup system for UNIX.
37Name: boxbackup
38Version: ###DISTRIBUTION-VERSION-NUMBER###
39Release: 1%{?dist}
40License: BSD
41Group: Applications/Archiving
42Packager: boxbackup-dev@boxbackup.org
43URL: http://www.boxbackup.org/
44Source0: %{ident}.tgz
45Requires: openssl >= 0.9.7a
46BuildRoot: %{_tmppath}/%{ident}-%{release}-root
47BuildRequires: openssl >= 0.9.7a, openssl-devel
48
49%description
50Box Backup is a completely automatic on-line backup system. Backed up files
51are stored encrypted on a filesystem on a remote server, which does not need
52to be trusted. The backup server runs as a daemon on the client copying only
53the changes within files, and old versions and deleted files are retained. It
54is designed to be easy and cheap to run a server and (optional) RAID is
55implemented in userland for ease of use.
56
57%package client
58Summary: An automatic on-line backup system for UNIX.
59Group: Applications/Archiving
60
61%description client
62Box Backup is a completely automatic on-line backup system. Backed up files
63are stored encrypted on a filesystem on a remote server, which does not need
64to be trusted. The backup server runs as a daemon on the client copying only
65the changes within files, and old versions and deleted files are retained. It
66is designed to be easy and cheap to run a server and (optional) RAID is
67implemented in userland for ease of use.
68
69This package contains the client.
70
71%package server
72Summary: An automatic on-line backup system for UNIX.
73Group: System Environment/Daemons
74
75%description server
76Box Backup is a completely automatic on-line backup system. Backed up files
77are stored encrypted on a filesystem on a remote server, which does not need
78to be trusted. The backup server runs as a daemon on the client copying only
79the changes within files, and old versions and deleted files are retained. It
80is designed to be easy and cheap to run a server and (optional) RAID is
81implemented in userland for ease of use.
82
83This package contains the server.
84
85%prep
86%setup -q
87
88%build
89echo -e '%{version}\n%{name}' > VERSION.txt
90test -e configure || ./bootstrap
91%configure
92
93make
94
95%install
96rm -rf $RPM_BUILD_ROOT
97
98mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{ident}
99mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{ident}/bbreporter
100mkdir -p $RPM_BUILD_ROOT%{_bindir}
101mkdir -p $RPM_BUILD_ROOT%{_sbindir}
102mkdir -p $RPM_BUILD_ROOT%{init_dir}
103mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/box/bbackupd
104mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/box/bbstored
105mkdir -p $RPM_BUILD_ROOT%{_var}/lib/box
106
107install -m 644 -t $RPM_BUILD_ROOT%{_docdir}/%{ident} \
108        BUGS.txt \
109        VERSION.txt \
110        ExceptionCodes.txt \
111        LICENSE-GPL.txt \
112        LICENSE-DUAL.txt \
113        %{distribution_dir}CONTACT.txt \
114        %{distribution_dir}DOCUMENTATION.txt \
115        %{distribution_dir}LINUX.txt \
116        %{distribution_dir}THANKS.txt
117
118install -m 644 contrib/bbreporter/LICENSE \
119        $RPM_BUILD_ROOT%{_docdir}/%{ident}/bbreporter
120install -m 755 contrib/bbreporter/bbreporter.py \
121        $RPM_BUILD_ROOT%{_docdir}/%{ident}/bbreporter
122
123# Client
124touch $RPM_BUILD_ROOT%{_sysconfdir}/box/bbackupd.conf
125install -m 755 contrib/%{distribution}/bbackupd $RPM_BUILD_ROOT%{init_dir}
126%if %{is_suse}
127ln -s ../../%{init_dir}/bbackupd $RPM_BUILD_ROOT%{_sbindir}/rcbbackupd
128%endif
129%define client_dir parcels/%{ident}-backup-client-linux-gnu
130install %{client_dir}/bbackupd $RPM_BUILD_ROOT%{_sbindir}
131install %{client_dir}/bbackupquery $RPM_BUILD_ROOT%{_sbindir}
132install %{client_dir}/bbackupctl $RPM_BUILD_ROOT%{_sbindir}
133install %{client_dir}/bbackupd-config $RPM_BUILD_ROOT%{_sbindir}
134
135# Server
136touch $RPM_BUILD_ROOT%{_sysconfdir}/box/bbstored.conf
137touch $RPM_BUILD_ROOT%{_sysconfdir}/box/raidfile.conf
138install -m 755 contrib/%{distribution}/bbstored $RPM_BUILD_ROOT%{init_dir}
139%if %{is_suse}
140ln -s ../../%{init_dir}/bbstored $RPM_BUILD_ROOT%{_sbindir}/rcbbstored
141%endif
142%define server_dir parcels/%{ident}-backup-server-linux-gnu
143install %{server_dir}/bbstored $RPM_BUILD_ROOT%{_sbindir}
144install %{server_dir}/bbstoreaccounts $RPM_BUILD_ROOT%{_sbindir}
145install %{server_dir}/bbstored-certs $RPM_BUILD_ROOT%{_sbindir}
146install %{server_dir}/bbstored-config $RPM_BUILD_ROOT%{_sbindir}
147install %{server_dir}/raidfile-config $RPM_BUILD_ROOT%{_sbindir}
148
149%pre server
150%{_sbindir}/useradd -c "Box Backup" -u %{bb_user_id} \
151        -s /sbin/nologin -r -d / box 2> /dev/null || :
152
153%post client
154/sbin/chkconfig --add bbackupd
155if [ ! -f %{_sysconfdir}/box/bbackupd.conf ]; then
156        echo "You should run the following to configure the client:"
157        echo "bbackupd-config %{_sysconfdir}/box lazy <account-number> <server-host>" \
158             "%{_var}/lib/box <backup-directories>"
159        echo "Then follow the instructions. Use this to start the client:"
160        echo "%{rc_start}bbackupd start"
161fi
162
163%post server
164/sbin/chkconfig --add bbstored
165if [ ! -f %{_sysconfdir}/box/bbstored.conf ]; then
166        echo "You should run the following to configure the server:"
167        echo "raidfile-config %{_sysconfdir}/box 2048 <store-directory> [<raid-directories>]"
168        echo "bbstored-config %{_sysconfdir}/box" `hostname` box
169        echo "Then follow the instructions. Use this to start the server:"
170        echo "%{rc_start}bbstored start"
171fi
172
173%preun client
174if [ $1 = 0 ]; then
175        %{init_dir}/bbackupd stop > /dev/null 2>&1
176        /sbin/chkconfig --del bbackupd
177fi
178
179%preun server
180if [ $1 = 0 ]; then
181        %{init_dir}/bbstored stop > /dev/null 2>&1
182        /sbin/chkconfig --del bbstored
183fi
184
185
186%clean
187rm -rf $RPM_BUILD_ROOT
188
189%files client
190%defattr(-,root,root,-)
191%dir %attr(700,root,root) %{_sysconfdir}/box/bbackupd
192%dir %attr(755,root,root) %{_var}/lib/box
193%doc %{_docdir}/%{ident}/*.txt
194%config %{init_dir}/bbackupd
195%if %{is_suse}
196%{_sbindir}/rcbbackupd
197%endif
198%config %ghost %{_sysconfdir}/box/bbackupd.conf
199%{_sbindir}/bbackupd
200%{_sbindir}/bbackupquery
201%{_sbindir}/bbackupctl
202%{_sbindir}/bbackupd-config
203
204%files server
205%defattr(-,root,root,-)
206%dir %attr(700,box,root) %{_sysconfdir}/box/bbstored
207%config %{init_dir}/bbstored
208%if %{is_suse}
209%{_sbindir}/rcbbstored
210%endif
211%config %ghost %{_sysconfdir}/box/bbstored.conf
212%config %ghost %{_sysconfdir}/box/raidfile.conf
213%{_sbindir}/bbstored
214%{_sbindir}/bbstoreaccounts
215%{_sbindir}/bbstored-certs
216%{_sbindir}/bbstored-config
217%{_sbindir}/raidfile-config
218%doc %{_docdir}/%{ident}/bbreporter
219
220%changelog
221* Thu Apr 23 2009 Martin Ebourne <martin@zepler.org>
222- Use dist tag in version
223
224* Thu May 29 2008 Martin Ebourne <martin@zepler.org>
225- Fix paths to bbreporter files
226
227* Sat Jan 13 2006 Chris Wilson <chris+box@qwirx.com>
228- Support building from an unofficial tarball (from svn) by changing
229  %{distribution_dir} at the top.
230- Write our RPM version number into VERSION.txt and hence compile it in
231
232* Wed Dec 28 2005 Martin Ebourne <martin@zepler.org>
233- Box now uses autoconf so use configure macro
234
235* Fri Oct  1 2004 Martin Ebourne <martin@zepler.org> - 0.08-3
236- Moved most of the exes to /usr/sbin
237- SUSE updates from Chris Smith
238
239* Fri Sep 24 2004 Martin Ebourne <martin@zepler.org> - 0.08-2
240- Added support for other distros
241- Changes for SUSE provided by Chris Smith <chris.smith@nothingbutnet.co.nz>
242
243* Mon Sep 16 2004 Martin Ebourne <martin@zepler.org> - 0.07-1
244- Initial build
Note: See TracBrowser for help on using the repository browser.