/[packages]/cauldron/backuppc/current/SPECS/backuppc.spec
ViewVC logotype

Contents of /cauldron/backuppc/current/SPECS/backuppc.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 234949 - (show annotations) (download)
Tue May 8 22:01:24 2012 UTC (11 years, 9 months ago) by pterjan
File size: 8693 byte(s)
- Fix initscript's LSB header
- Fix License tag
1 %define name backuppc
2 %define Name BackupPC
3 %define version 3.2.1
4 %define release %mkrel 5
5 %define debug_package %{nil}
6
7 %define _provides_exceptions perl(BackupPC::.*)
8 %define _requires_exceptions perl(BackupPC::.*)
9
10 Name: %{name}
11 Version: %{version}
12 Release: %{release}
13 Summary: High-performance, enterprise-grade backup system
14 Group: Archiving/Backup
15 License: GPLv2
16 url: http://backuppc.sourceforge.net
17 Source: http://sourceforge.net/projects/backuppc/files/backuppc/%version/%{Name}-%{version}.tar.gz
18 Source2: %{name}.init
19 Source3: BackupPC_Admin.c
20 Source4: backuppc.service
21 Source5: backuppc.tmpfiles
22 Patch0: %{name}-3.1.0-fhs.patch
23 Patch1: BackupPC-3.1.0-CVE-2009-3369.diff
24 # Correct upstream perl syntax (get rid of error messages at service start)
25 Patch2: BackupPC-3.2.1-CVE-2011-170886.diff
26 Requires: sendmail-command
27 Requires: apache
28 Requires(post): rpm-helper >= 0.24.8-1
29 Requires(preun): rpm-helper >= 0.24.8-1
30 Suggests: openssh-clients
31 Suggests: samba-client
32 Suggests: perl(File::RsyncP)
33
34 %description
35 BackupPC is a high-performance, enterprise-grade system
36 for backing up Linux, Win32, and laptops to a server's disk.
37 Features include clever pooling of identical files, no client-side
38 software, and a powerful Apache/CGI user interface.
39
40 %prep
41 %setup -q -n %{Name}-%{version}
42 %patch0 -p1
43 %patch1 -p0
44 %patch2 -p0
45
46 rm -rf images/CVS
47 # fix file perms
48 find lib -type f -exec chmod 644 {} \;
49 find bin -type f -exec chmod 755 {} \;
50 find doc -type f -exec chmod 644 {} \;
51 find . -maxdepth 1 -type f -exec chmod 644 {} \;
52 # fix perl shellbang
53 find . -type f -exec perl -pi -e 's|^#!/bin/perl|#!/usr/bin/perl|' {} \;
54
55 %build
56 gcc %SOURCE3 -o BackupPC_Admin
57 # set installation directory
58 find . -type f -exec perl -pi -e 's|__INSTALLDIR__|%{_datadir}/%{name}|' {} \;
59 find . -type f -exec perl -pi -e 's|__TOPDIR__|%{_localstatedir}/lib/%{name}|' {} \;
60 # set configuration
61 # the binaries path are disabled to avoid service failure at start
62 perl -pi \
63 -e 's|^\$Conf{BackupPCUser}.*|\$Conf{BackupPCUser} = "%{name}";|;' \
64 -e 's|^\$Conf{CgiDir}.*|\$Conf{CgiDir} = "%{_var}/www/%{name}";|;' \
65 -e 's|^\$Conf{InstallDir}.*|\$Conf{InstallDir} = "%{_datadir}/%{name}";|;' \
66 -e 's|^\$Conf{CgiImageDirURL}.*|\$Conf{CgiImageDirURL} = "/%{name}";|;' \
67 -e 's|^\$Conf{SshPath}.*|\$Conf{SshPath} = "";|;' \
68 -e 's|^\$Conf{SmbClientPath}.*|\$Conf{SmbClientPath} = "";|;' \
69 -e 's|^\$Conf{NmbLookupPath}.*|\$Conf{NmbLookupPath} = "";|;' \
70 -e 's|^\$Conf{PingPath}.*|\$Conf{PingPath} = "/bin/ping";|;' \
71 -e 's|^\$Conf{DfPath}.*|\$Conf{DfPath} = "/bin/df";|;' \
72 -e 's|^\$Conf{SplitPath}.*|\$Conf{SplitPath} = "/usr/bin/split";|;' \
73 -e 's|^\$Conf{CatPath}.*|\$Conf{CatPath} = "/bin/cat";|;' \
74 -e 's|^\$Conf{GzipPath}.*|\$Conf{GzipPath} = "/bin/gzip";|;' \
75 -e 's|^\$Conf{Bzip2Path}.*|\$Conf{Bzip2Path} = "/usr/bin/bzip2";|;' \
76 -e 's|^\$Conf{SendmailPath}.*|\$Conf{SendmailPath} = "/usr/sbin/sendmail";|;' \
77 -e 's|^\$Conf{ServerInitdPath}.*|\$Conf{ServerInitdPath} = "%{_initrddir}/%{name}";|;' \
78 -e 's|^\$Conf{BackupPCdPath}.*|\$Conf{BackupPCdPath} = "%{_datadir}/%{name}/bin/BackupPC";|;' \
79 -e 's|^\$Conf{TarClientPath}.*|\$Conf{TarClientPath} = "/bin/tar";|;' \
80 -e 's|^\$Conf{RsyncClientPath}.*|\$Conf{RsyncClientPath} = "/usr/bin/rsync";|;' \
81 -e 's|^\$Conf{SmbClientPath}.*|\$Conf{TarClientPath} = "/usr/bin/smbclient";|;' \
82 conf/config.pl
83
84 %install
85 rm -rf %{buildroot}
86
87 # constant files
88 install -d -m 755 %{buildroot}%{_datadir}/%{name}
89 cp -pr lib %{buildroot}%{_datadir}/%{name}
90 cp -pr bin %{buildroot}%{_datadir}/%{name}
91 cp -pr doc %{buildroot}%{_datadir}/%{name}
92
93 # web files
94 install -d -m 755 %{buildroot}%{_var}/www/%{name}
95 install -m 644 images/* %{buildroot}%{_var}/www/%{name}
96 install -m 644 conf/*.css %{buildroot}%{_var}/www/%{name}
97 install -m 644 conf/*.js %{buildroot}%{_var}/www/%{name}
98 install -m 755 cgi-bin/BackupPC_Admin %{buildroot}%{_var}/www/%{name}/BackupPC_Admin.cgi
99
100 # variable files
101 install -d -m 755 %{buildroot}%{_localstatedir}/lib/%{name}
102 install -d -m 755 %{buildroot}%{_localstatedir}/lib/%{name}/{cpool,log,pc,pool,trash}
103
104 # perl-suidperl is no longer avaialable, use a C wrapper
105 install -m 4755 BackupPC_Admin %{buildroot}%{_var}/www/%{name}
106
107 # configuration
108 install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}
109 install -m 644 conf/{hosts,config.pl} %{buildroot}%{_sysconfdir}/%{name}
110
111 # init script
112 install -d -m 755 %{buildroot}%{_initrddir}
113 install -m 755 %{SOURCE2} %{buildroot}%{_initrddir}/%{name}
114
115 # systemd
116 install -d -m 755 %{buildroot}%{_unitdir}
117 install -m 644 %{SOURCE4} %{buildroot}%{_unitdir}/backuppc.service
118 install -d -m 755 %{buildroot}%{_sysconfdir}/tmpfiles.d
119 install -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/tmpfiles.d//backuppc.conf
120
121 # logs
122 install -d -m 755 %{buildroot}%{_var}/log/%{name}
123
124 # apache configuration
125 install -d -m 755 %{buildroot}%{_webappconfdir}
126 cat > %{buildroot}%{_webappconfdir}/%{name}.conf <<EOF
127 # BackupPC Apache configuration
128 Alias /%{name} %{_var}/www/%{name}
129
130 <Directory %{_var}/www/%{name}>
131 Options ExecCGI
132 <Files BackupPC_Admin>
133 SetHandler cgi-script
134 </Files>
135 DirectoryIndex BackupPC_Admin
136 Allow from all
137 </Directory>
138 EOF
139
140 cat > README.mga <<EOF
141 Mageia RPM specific notes
142
143 Setup
144 -----
145 The Mageia setup improves the FHS compliance wrt. that used upstream:
146 - /var/www/backuppc ... files accessible from the web
147 - /usr/share/backuppc ... files non-accessible from the web
148 - /var/lib/backuppc ... files with varibales
149 - /etc/backuppc ... both global and per-host configuration files
150
151 Backuppc user; backup-data
152 --------------------------
153 Backup-data stored in another file-system can be made accessible to backuppc
154 by creating a soft link from /var/www/lib to the root of the backup-data
155 hierarchy. If backuppc is uninstalled (urpme backuppc), this data will not
156 be deleted - with the exception of a cpool directory that is empty; when,
157 subsequently, backuppc is newly installed, cpool must be manually created
158 (with uid:gid = backuppc:backkuppc).
159
160 To make backuppc access backup-data that exist prior to installing backkuppc,
161 make sure that the user "backuppc" exists BEFORE the package is installed, and
162 that its uid and gid matches the ownership of that data (otherwise the
163 package would automatically create the user with random uid and gid values).
164
165 Lighttpd server definition
166 --------------------------
167 When using lighttpd, the following definition in /etc/lighttpd/lighttpd.conf
168 should work:
169 $HTTP["url"] =~ "^/backuppc" {
170 server.document-root = "/var/www/backuppc"
171 cgi.assign = ( "BackupPC_Admin" => "" )
172 index-file.names = ( "BackupPC_Admin" )
173 alias.url = ( "/backuppc" => "/var/www/backuppc" )
174 dir-listing.activate = "disable"
175 $HTTP["remoteip"] != "127.0.0.1" {
176 auth.backend = "htpasswd"
177 auth.backend.htpasswd.userfile = "<password-dir>/passwd/backuppc"
178 auth.require += ( "" => ( "method" => "basic",
179 "realm" => "BackupPC",
180 "require" => "valid-user" ) )
181 }
182 }
183 <password-dir> is the directory where you keep the passwords for your server;
184 the suggested definition does not require authentication if the backuppc gui
185 is invoked from the machine that hosts the lighttpd server
186 EOF
187
188 %pre
189 %_pre_useradd %{name} %{_localstatedir}/lib/%{name} /bin/sh
190
191 %post
192 %_post_service %{name}
193
194 %preun
195 %_preun_service %{name}
196 if [ $1 -ne 0 ] ; then
197 # previous releases of backuppc had root as the owner - undo this fault
198 chown backuppc:backuppc %{_sysconfdir}/%{name}
199 fi
200
201 %postun
202 %_postun_userdel %{name}
203
204 %clean
205 rm -rf %{buildroot}
206
207 %files
208 %doc ChangeLog README LICENSE doc/* README.mga
209 # backuppc must be able to edig the config file and create backup files
210 %config(noreplace) %attr(0755,backuppc,backuppc) %{_sysconfdir}/%{name}
211 ##%config(noreplace) %attr(0640,backuppc,backuppc) %{_sysconfdir}/%{name}/config.pl
212 %config(noreplace) %attr(0640,backuppc,backuppc) %{_sysconfdir}/%{name}/*
213 %config(noreplace) %{_webappconfdir}/%{name}.conf
214 %{_initrddir}/%{name}
215 %{_unitdir}/%{name}.service
216 %{_sysconfdir}/tmpfiles.d/%{name}.conf
217 %{_datadir}/%{name}
218 #note: globbings like [^B]* or !(BackupPC*) don't work
219 %{_var}/www/%{name}/*.gif
220 %{_var}/www/%{name}/*.png
221 %{_var}/www/%{name}/*.css
222 %{_var}/www/%{name}/*.js
223 %{_var}/www/%{name}/*.ico
224 %attr(-,backuppc,backuppc) %{_var}/www/%{name}/BackupPC_Admin.cgi
225 %attr(-,backuppc,backuppc) %{_var}/www/%{name}/BackupPC_Admin
226 %attr(-,backuppc,backuppc) %{_var}/log/%{name}
227 %attr(-,backuppc,backuppc) %{_localstatedir}/lib/%{name}
228
229
230
231

  ViewVC Help
Powered by ViewVC 1.1.30