Ticket #49571: backuppc.Portfile

File backuppc.Portfile, 7.7 KB (added by mojca (Mojca Miklavec), 9 years ago)

backuppc against Perl5.22

Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 125016 2014-09-02 20:19:02Z mf2k@macports.org $
3
4PortSystem          1.0
5PortGroup           active_variants 1.1
6PortGroup           perl5 1.0
7
8name                backuppc
9categories          sysutils
10version             3.1.0
11revision            3
12maintainers         nomaintainer
13license             GPL-2+
14homepage            http://backuppc.sourceforge.net/
15
16description         BackupPC is a high-performance, enterprise-grade system for backing up Linux, WinXX and Mac OS X PCs and laptops to a server.
17long_description    ${description} BackupPC is highly configurable and easy to install and maintain.
18
19platforms           darwin
20
21master_sites        sourceforge
22
23# TODO:
24# - remove 5.16 once we upgrade to 5.22 as default
25# - remove the variants once mod_perl2 switches to 5.22 only
26perl5.require_variant   yes
27perl5.conflict_variants yes
28perl5.branches          5.16 5.22
29perl5.create_variants   ${perl5.branches}
30# TODO: this has to be the same branch as for mod_perl2
31perl5.default_branch    5.22
32require_active_variants mod_perl2 ${perl5.variant}
33
34depends_lib         port:bzip2 \
35                    port:gnutar \
36                    port:gzip \
37                    port:mod_perl2 \
38                    port:openssh \
39                    port:p${perl5.major}-archive-zip \
40                    port:p${perl5.major}-compress-raw-zlib \
41                    port:p${perl5.major}-file-rsyncp \
42                    port:par2 \
43                    port:perl${perl5.major} \
44                    port:rsync \
45                    port:samba3
46
47
48distname            BackupPC-${version}
49
50checksums           rmd160  22d4cb6dd76f846fde489a301852f50e8db1ae1d \
51                    sha256  49a2744cb9aaf27b298ec3d2e83e46fdb86fb3596922beb3904cb6ae552c148a
52
53configure.args      --batch \
54                    --backuppc-user=backuppc \
55                    --cgi-dir ${prefix}/var/wwwbackup/cgi-bin \
56                    --data-dir ${prefix}/var/backups \
57                    --dest-dir ${destroot} \
58                    --html-dir ${prefix}/var/wwwbackup/htdocs/backuppc \
59                    --html-dir-url /backuppc \
60                    --install-dir ${prefix}  \
61                    --config-dir ${prefix}/etc/BackupPC
62
63patchfiles          patch-configure.pl.diff \
64                    patch-lib-backuppc-cgi-view.pm.diff
65
66destroot.violate_mtree  yes
67
68destroot.keepdirs   ${destroot}${prefix}/var/backups \
69                    ${destroot}${prefix}/var/backups/cpool \
70                    ${destroot}${prefix}/var/backups/log \
71                    ${destroot}${prefix}/var/backups/trash \
72                    ${destroot}${prefix}/var/backups/pool \
73                    ${destroot}${prefix}/var/backups/pc \
74                    ${destroot}${prefix}/var/backups/ \
75                    ${destroot}${prefix}/var/log/BackupPC \
76                    ${destroot}${prefix}/var/wwwbackup/htdocs\
77                    ${destroot}${prefix}/var/wwwbackup/logs
78
79set hostname [exec "hostname"]
80
81pre-configure {
82    ui_debug  "Hostname: ${hostname}"
83    configure.args-append --hostname ${hostname}
84}
85
86configure {
87    reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/configure.pl
88    reinplace "s|@@PREFIX@@|${prefix}/|g" ${worksrcpath}/lib/BackupPC/CGI/View.pm
89
90    addgroup backuppc
91    set gid [existsgroup backuppc]
92    adduser backuppc gid=${gid} realname=BackupPC
93}
94
95build {}
96
97destroot {
98    # destroot for the web skeleton
99    xinstall -d -m 770 -g backuppc -o backuppc ${destroot}${prefix}/var/wwwbackup
100    xinstall -d -m 770 -g backuppc -o backuppc ${destroot}${prefix}/var/wwwbackup/cgi-bin
101    xinstall -d -m 770 -g backuppc -o backuppc ${destroot}${prefix}/var/wwwbackup/conf
102    xinstall -m 600 -g backuppc -o backuppc ${filespath}/httpd.conf ${destroot}${prefix}/var/wwwbackup/conf/
103
104    xinstall -m 600 -g backuppc -o backuppc ${filespath}/mime.types ${destroot}${prefix}/var/wwwbackup/conf
105    xinstall -m 600 -g backuppc -o backuppc ${filespath}/magic ${destroot}${prefix}/var/wwwbackup/conf
106
107    xinstall -d -m 770 -g backuppc -o backuppc ${destroot}${prefix}/var/wwwbackup/htdocs
108    xinstall -m 600 -g backuppc -o backuppc ${filespath}/favicon.ico ${destroot}${prefix}/var/wwwbackup/htdocs/
109
110    xinstall -d -m 770 -g backuppc -o backuppc ${destroot}${prefix}/var/wwwbackup/logs
111
112    # destroot for backuppc
113    xinstall -d -m 770 -g backuppc -o backuppc ${destroot}${prefix}/var/backups
114    xinstall -d -m 770 -g backuppc -o backuppc ${destroot}${prefix}/var/log/BackupPC
115
116    # create backup directory
117    system -W ${worksrcpath} "${prefix}/bin/perl${perl5.major} configure.pl ${configure.args}"
118    xinstall -d -m 755 ${destroot}${prefix}/share/doc/
119    move ${destroot}${prefix}/doc ${destroot}${prefix}/share/doc/BackupPC
120
121    # install the launch scripts
122    xinstall -d -m 755 ${destroot}/Library/LaunchDaemons
123
124    xinstall ${filespath}/net.sourceforge.backuppc.plist \
125            ${destroot}/Library/LaunchDaemons/
126
127    # Install extras
128    xinstall -d -m 755 ${destroot}${prefix}/share/BackupPC/extras
129    xinstall ${filespath}/backuppc_config_template.rb \
130            ${destroot}${prefix}/share/BackupPC/extras
131    xinstall ${filespath}/backuppc_auth.conf ${destroot}${prefix}/share/BackupPC/extras
132    reinplace "s|@@PREFIX@@|${prefix}|g" ${destroot}${prefix}/share/BackupPC/extras/backuppc_auth.conf
133
134    xinstall ${filespath}/org.macports.backuppc.apache2.plist \
135            ${destroot}/Library/LaunchDaemons/
136    reinplace "s|@@PREFIX@@|${prefix}|g" ${destroot}/Library/LaunchDaemons/org.macports.backuppc.apache2.plist
137    reinplace "s|@@CONFPATH@@|${prefix}/var/wwwbackup/conf/|g" ${destroot}/Library/LaunchDaemons/org.macports.backuppc.apache2.plist
138    reinplace "s|@@PREFIX@@|${prefix}|g" ${destroot}${prefix}/var/wwwbackup/conf/httpd.conf
139    reinplace "s|@@HOSTNAME@@|${hostname}|g" ${destroot}${prefix}/var/wwwbackup/conf/httpd.conf
140    reinplace "s|@@PREFIX@@|${prefix}|g" ${destroot}/Library/LaunchDaemons/net.sourceforge.backuppc.plist
141}
142
143notes "There are several more things you will need to do:
144
145    - Browse through the config file, ${prefix}/etc/BackupPC/config.pl,
146      and make sure all the settings are correct.  In particular,
147      you will need to set \$Conf{CgiAdminUsers} so you have
148      administration privileges in the CGI interface.
149
150    - Change the \$Conf{}
151
152    - Edit the list of hosts to backup in ${prefix}/etc/BackupPC/hosts.
153
154    - Read the documentation in ${prefix}/share/doc/BackupPC/BackupPC.html.
155      Please pay special attention to the security section.
156
157    - Verify that the CGI script BackupPC_Admin runs correctly.  You might
158      need to change the permissions or group ownership of BackupPC_Admin.
159      If this is an upgrade and you are using mod_perl, you will need
160      to restart Apache.  Otherwise it will have stale code.
161
162    - BackupPC should be ready to start.  Don't forget to run it
163      as user backuppc!  The installation also contains an
164      /Library/LaunchDaemons/net.sourceforge.backuppc.plist launchd
165      so that BackupPC can auto-start on boot. To enable this daemon
166      execute the following command:
167      cd /Library/LaunchDaemons
168      sudo launchctl load net.sourceforge.backuppc.plist
169
170    - The data directory is set to ${prefix}/var/backups. Please ensure
171      You have enough space for your backups at this location. You may
172      wish to create a custom mount point point for you backup volume
173      if necessary.
174
175    - To hide the backuppc user in the login window, you may execute
176
177      defaults write /Library/Preferences/com.apple.loginwindow
178
179    - Please see the ${prefix}/share/BackupPC/extras directory for client
180      setup scripts, sample apache.conf files, and more.
181    "