| 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 [email protected] |
| 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 |
|
| 36 |
Summary: An automatic on-line backup system for UNIX. |
| 37 |
Name: boxbackup |
| 38 |
Version: ###DISTRIBUTION-VERSION-NUMBER### |
| 39 |
Release: 1%{?dist} |
| 40 |
License: BSD |
| 41 |
Group: Applications/Archiving |
| 42 |
Packager: [email protected] |
| 43 |
URL: http://www.boxbackup.org/ |
| 44 |
Source0: %{ident}.tgz |
| 45 |
Requires: openssl >= 0.9.7a |
| 46 |
BuildRoot: %{_tmppath}/%{ident}-%{release}-root |
| 47 |
BuildRequires: openssl >= 0.9.7a, openssl-devel |
| 48 |
|
| 49 |
%description |
| 50 |
Box Backup is a completely automatic on-line backup system. Backed up files |
| 51 |
are stored encrypted on a filesystem on a remote server, which does not need |
| 52 |
to be trusted. The backup server runs as a daemon on the client copying only |
| 53 |
the changes within files, and old versions and deleted files are retained. It |
| 54 |
is designed to be easy and cheap to run a server and (optional) RAID is |
| 55 |
implemented in userland for ease of use. |
| 56 |
|
| 57 |
%package client |
| 58 |
Summary: An automatic on-line backup system for UNIX. |
| 59 |
Group: Applications/Archiving |
| 60 |
|
| 61 |
%description client |
| 62 |
Box Backup is a completely automatic on-line backup system. Backed up files |
| 63 |
are stored encrypted on a filesystem on a remote server, which does not need |
| 64 |
to be trusted. The backup server runs as a daemon on the client copying only |
| 65 |
the changes within files, and old versions and deleted files are retained. It |
| 66 |
is designed to be easy and cheap to run a server and (optional) RAID is |
| 67 |
implemented in userland for ease of use. |
| 68 |
|
| 69 |
This package contains the client. |
| 70 |
|
| 71 |
%package server |
| 72 |
Summary: An automatic on-line backup system for UNIX. |
| 73 |
Group: System Environment/Daemons |
| 74 |
|
| 75 |
%description server |
| 76 |
Box Backup is a completely automatic on-line backup system. Backed up files |
| 77 |
are stored encrypted on a filesystem on a remote server, which does not need |
| 78 |
to be trusted. The backup server runs as a daemon on the client copying only |
| 79 |
the changes within files, and old versions and deleted files are retained. It |
| 80 |
is designed to be easy and cheap to run a server and (optional) RAID is |
| 81 |
implemented in userland for ease of use. |
| 82 |
|
| 83 |
This package contains the server. |
| 84 |
|
| 85 |
%prep |
| 86 |
%setup -q |
| 87 |
|
| 88 |
%build |
| 89 |
echo -e '%{version}\n%{name}' > VERSION.txt |
| 90 |
test -e configure || ./bootstrap |
| 91 |
%configure |
| 92 |
|
| 93 |
make |
| 94 |
|
| 95 |
%install |
| 96 |
rm -rf $RPM_BUILD_ROOT |
| 97 |
|
| 98 |
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{ident} |
| 99 |
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{ident}/bbreporter |
| 100 |
mkdir -p $RPM_BUILD_ROOT%{_bindir} |
| 101 |
mkdir -p $RPM_BUILD_ROOT%{_sbindir} |
| 102 |
mkdir -p $RPM_BUILD_ROOT%{init_dir} |
| 103 |
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/box/bbackupd |
| 104 |
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/box/bbstored |
| 105 |
mkdir -p $RPM_BUILD_ROOT%{_var}/lib/box |
| 106 |
|
| 107 |
install -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 |
|
| 118 |
install -m 644 contrib/bbreporter/LICENSE \ |
| 119 |
$RPM_BUILD_ROOT%{_docdir}/%{ident}/bbreporter |
| 120 |
install -m 755 contrib/bbreporter/bbreporter.py \ |
| 121 |
$RPM_BUILD_ROOT%{_docdir}/%{ident}/bbreporter |
| 122 |
|
| 123 |
# Client |
| 124 |
touch $RPM_BUILD_ROOT%{_sysconfdir}/box/bbackupd.conf |
| 125 |
install -m 755 contrib/%{distribution}/bbackupd $RPM_BUILD_ROOT%{init_dir} |
| 126 |
%if %{is_suse} |
| 127 |
ln -s ../../%{init_dir}/bbackupd $RPM_BUILD_ROOT%{_sbindir}/rcbbackupd |
| 128 |
%endif |
| 129 |
%define client_dir parcels/%{ident}-backup-client-linux-gnu |
| 130 |
install %{client_dir}/bbackupd $RPM_BUILD_ROOT%{_sbindir} |
| 131 |
install %{client_dir}/bbackupquery $RPM_BUILD_ROOT%{_sbindir} |
| 132 |
install %{client_dir}/bbackupctl $RPM_BUILD_ROOT%{_sbindir} |
| 133 |
install %{client_dir}/bbackupd-config $RPM_BUILD_ROOT%{_sbindir} |
| 134 |
|
| 135 |
# Server |
| 136 |
touch $RPM_BUILD_ROOT%{_sysconfdir}/box/bbstored.conf |
| 137 |
touch $RPM_BUILD_ROOT%{_sysconfdir}/box/raidfile.conf |
| 138 |
install -m 755 contrib/%{distribution}/bbstored $RPM_BUILD_ROOT%{init_dir} |
| 139 |
%if %{is_suse} |
| 140 |
ln -s ../../%{init_dir}/bbstored $RPM_BUILD_ROOT%{_sbindir}/rcbbstored |
| 141 |
%endif |
| 142 |
%define server_dir parcels/%{ident}-backup-server-linux-gnu |
| 143 |
install %{server_dir}/bbstored $RPM_BUILD_ROOT%{_sbindir} |
| 144 |
install %{server_dir}/bbstoreaccounts $RPM_BUILD_ROOT%{_sbindir} |
| 145 |
install %{server_dir}/bbstored-certs $RPM_BUILD_ROOT%{_sbindir} |
| 146 |
install %{server_dir}/bbstored-config $RPM_BUILD_ROOT%{_sbindir} |
| 147 |
install %{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 |
| 155 |
if [ ! -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" |
| 161 |
fi |
| 162 |
|
| 163 |
%post server |
| 164 |
/sbin/chkconfig --add bbstored |
| 165 |
if [ ! -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" |
| 171 |
fi |
| 172 |
|
| 173 |
%preun client |
| 174 |
if [ $1 = 0 ]; then |
| 175 |
%{init_dir}/bbackupd stop > /dev/null 2>&1 |
| 176 |
/sbin/chkconfig --del bbackupd |
| 177 |
fi |
| 178 |
|
| 179 |
%preun server |
| 180 |
if [ $1 = 0 ]; then |
| 181 |
%{init_dir}/bbstored stop > /dev/null 2>&1 |
| 182 |
/sbin/chkconfig --del bbstored |
| 183 |
fi |
| 184 |
|
| 185 |
|
| 186 |
%clean |
| 187 |
rm -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 <[email protected]> |
| 222 |
- Use dist tag in version |
| 223 |
|
| 224 |
* Thu May 29 2008 Martin Ebourne <[email protected]> |
| 225 |
- Fix paths to bbreporter files |
| 226 |
|
| 227 |
* Sat Jan 13 2006 Chris Wilson <[email protected]> |
| 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 <[email protected]> |
| 233 |
- Box now uses autoconf so use configure macro |
| 234 |
|
| 235 |
* Fri Oct 1 2004 Martin Ebourne <[email protected]> - 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 <[email protected]> - 0.08-2 |
| 240 |
- Added support for other distros |
| 241 |
- Changes for SUSE provided by Chris Smith <[email protected]> |
| 242 |
|
| 243 |
* Mon Sep 16 2004 Martin Ebourne <[email protected]> - 0.07-1 |
| 244 |
- Initial build |