sysutils/backuppc: do not overwrite config files

PR:		192403
Submitted by:	maintainer
This commit is contained in:
William Grzybowski 2014-08-26 14:11:30 +00:00
parent 216b5a285f
commit 9baf10c8ef
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=366216
4 changed files with 35 additions and 56 deletions

View file

@ -3,7 +3,7 @@
PORTNAME= backuppc PORTNAME= backuppc
PORTVERSION= 3.3.0 PORTVERSION= 3.3.0
PORTREVISION= 4 PORTREVISION= 5
CATEGORIES= sysutils CATEGORIES= sysutils
MASTER_SITES= SF MASTER_SITES= SF
MASTER_SITE_SUBDIR= ${PORTNAME}/${PORTNAME}/${PORTVERSION} MASTER_SITE_SUBDIR= ${PORTNAME}/${PORTNAME}/${PORTVERSION}
@ -23,15 +23,14 @@ USE_RC_SUBR= backuppc
USES= perl5 USES= perl5
NO_BUILD= yes NO_BUILD= yes
NO_PACKAGE= Overwrites configuration files; set FORCE_PACKAGE if you want\
to build this package
USERS= backuppc USERS= backuppc
GROUPS= backuppc GROUPS= backuppc
CGIDIR?= ${PREFIX}/www/cgi-bin CGIDIR?= ${PREFIX}/www/cgi-bin
SUB_FILES= pkg-deinstall pkg-message SUB_FILES= pkg-deinstall pkg-message update.sh
SUB_LIST= CGIDIR=${CGIDIR}
PLIST_SUB+= CGIDIR=${CGIDIR:S,^${PREFIX}/,,} \ PLIST_SUB+= CGIDIR=${CGIDIR:S,^${PREFIX}/,,} \
DISTVERSION=${DISTVERSION} DISTVERSION=${DISTVERSION}
@ -39,13 +38,18 @@ PLIST_SUB+= CGIDIR=${CGIDIR:S,^${PREFIX}/,,} \
PORTDOCS= ChangeLog LICENSE README PORTDOCS= ChangeLog LICENSE README
OPTIONS_DEFINE= ARCHIVE_ZIP COMPRESS_ZLIB DOCS FILE_RSYNCP NMBLOOKUP \ OPTIONS_DEFINE= ARCHIVE_ZIP COMPRESS_ZLIB DOCS FILE_RSYNCP NMBLOOKUP \
RRDTOOL SMBCLIENT XML_RSS SMBCLIENT XML_RSS
OPTIONS_DEFAULT= ARCHIVE_ZIP COMPRESS_ZLIB
OPTIONS_RADIO= GRAPHS
OPTIONS_RADIO_GRAPHS= RRD_GRAPHS RRDTOOL
OPTIONS_DEFAULT= ARCHIVE_ZIP COMPRESS_ZLIB RRD_GRAPHS
ARCHIVE_ZIP_DESC= Perl module for Zip archive files ARCHIVE_ZIP_DESC= Perl module for Zip archive files
COMPRESS_ZLIB_DESC= Perl5 interface to zlib compression library COMPRESS_ZLIB_DESC= Perl5 interface to zlib compression library
FILE_RSYNCP_DESC= Perl Rsync client FILE_RSYNCP_DESC= Perl Rsync client
NMBLOOKUP_DESC= NetBIOS Name lookup tool NMBLOOKUP_DESC= NetBIOS Name lookup tool
RRD_GRAPHS_DESC= Apply graphs patch (but not install RRDTool)
RRDTOOL_DESC= Use RRDTool to generate pool statistic graphs RRDTOOL_DESC= Use RRDTool to generate pool statistic graphs
SMBCLIENT_DESC= Samba client SMBCLIENT_DESC= Samba client
XML_RSS_DESC= Perl extension to manage RSS files XML_RSS_DESC= Perl extension to manage RSS files
@ -66,6 +70,8 @@ RUN_DEPENDS+= nmblookup:${PORTSDIR}/net/samba-nmblookup
.endif .endif
.if ${PORT_OPTIONS:MRRDTOOL} .if ${PORT_OPTIONS:MRRDTOOL}
RUN_DEPENDS+= rrdtool:${PORTSDIR}/databases/rrdtool RUN_DEPENDS+= rrdtool:${PORTSDIR}/databases/rrdtool
.endif
.if ${PORT_OPTIONS:MRRD_GRAPHS} || ${PORT_OPTIONS:MRRDTOOL}
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bin-BackupPC \ EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bin-BackupPC \
${FILESDIR}/extra-patch-lib-BackupPC-CGI-GeneralInfo.pm ${FILESDIR}/extra-patch-lib-BackupPC-CGI-GeneralInfo.pm
.endif .endif
@ -76,12 +82,18 @@ RUN_DEPENDS+= smbclient:${PORTSDIR}/net/samba-smbclient
RUN_DEPENDS+= p5-XML-RSS>=0:${PORTSDIR}/textproc/p5-XML-RSS RUN_DEPENDS+= p5-XML-RSS>=0:${PORTSDIR}/textproc/p5-XML-RSS
.endif .endif
pre-patch:
@${CP} ${WRKSRC}/configure.pl ${WRKSRC}/update.pl
post-patch: post-patch:
@${REINPLACE_CMD} \ @${REINPLACE_CMD} \
-e 's|/etc/BackupPC\(/config.pl\)|${ETCDIR}\1|' \ -e 's|/etc/BackupPC\(/config.pl\)|${ETCDIR}\1|' \
-e 's|^\(foreach my $$dir ( qw(bin \)doc$$|\1${DOCSDIR_REL}|' \ -e 's|^\(foreach my $$dir ( qw(bin \)doc$$|\1${DOCSDIR_REL}|' \
-e 's|\($$DestDir$$Conf{InstallDir}/\)doc|\1${DOCSDIR_REL}|' \ -e 's|\($$DestDir$$Conf{InstallDir}/\)doc|\1${DOCSDIR_REL}|' \
${WRKSRC}/configure.pl ${WRKSRC}/configure.pl ${WRKSRC}/update.pl
@${REINPLACE_CMD} -E \
-e 's|^(use lib ")\.(/lib";)$$|\1${PREFIX}\2|' \
${WRKSRC}/update.pl
@${REINPLACE_CMD} \ @${REINPLACE_CMD} \
-e 's,"/doc/BackupPC.html","/${DOCSDIR_REL}/BackupPC.html",' \ -e 's,"/doc/BackupPC.html","/${DOCSDIR_REL}/BackupPC.html",' \
${WRKSRC}/lib/BackupPC/CGI/View.pm ${WRKSRC}/lib/BackupPC/CGI/View.pm
@ -95,15 +107,6 @@ post-patch:
${WRKSRC}/doc/BackupPC.html ${WRKSRC}/doc/BackupPC.pod ${WRKSRC}/doc/BackupPC.html ${WRKSRC}/doc/BackupPC.pod
do-install: do-install:
if [ -f ${ETCDIR}/config.pl ]; then \
${MKDIR} ${STAGEDIR}${ETCDIR}; \
${CP} -p ${ETCDIR}/config.pl ${STAGEDIR}${ETCDIR}/config.pl; \
fi
if [ -f ${ETCDIR}/hosts ]; then \
${MKDIR} ${STAGEDIR}${ETCDIR}; \
${CP} -p ${ETCDIR}/hosts ${STAGEDIR}${ETCDIR}/hosts; \
fi
cd ${WRKSRC} && ${PERL} configure.pl \ cd ${WRKSRC} && ${PERL} configure.pl \
--batch \ --batch \
--backuppc-user ${USERS} \ --backuppc-user ${USERS} \
@ -124,14 +127,10 @@ do-install:
${WRKSRC}/doc/BackupPC.pod ${WRKSRC}/${PORTNAME}.1 ${WRKSRC}/doc/BackupPC.pod ${WRKSRC}/${PORTNAME}.1
${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.1 ${STAGEDIR}${MANPREFIX}/man/man1 ${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.1 ${STAGEDIR}${MANPREFIX}/man/man1
cd ${WRKSRC} && ${INSTALL_MAN} ${PORTDOCS} ${STAGEDIR}${DOCSDIR} cd ${WRKSRC} && ${INSTALL_MAN} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}
${CP} ${WRKSRC}/conf/config.pl ${STAGEDIR}${ETCDIR}/config.pl.sample
if [ ! -f ${STAGEDIR}${ETCDIR}/config.pl.pre-${DISTVERSION} ]; then \ ${CP} ${WRKSRC}/conf/hosts ${STAGEDIR}${ETCDIR}/hosts.sample
> ${STAGEDIR}${ETCDIR}/config.pl.pre-${DISTVERSION}; \ ${CP} ${WRKDIR}/update.sh ${STAGEDIR}${ETCDIR}/update.sh
fi ${MKDIR} ${STAGEDIR}${PREFIX}/libexec/backuppc
${INSTALL} -d ${STAGEDIR}${PREFIX}/libexec/${PORTNAME} ${CP} ${WRKSRC}/update.pl ${STAGEDIR}${PREFIX}/libexec/backuppc/update.pl
cd ${STAGEDIR}${ETCDIR} && \
${CHGRP} wheel config.pl config.pl.pre-${DISTVERSION} && \
${MV} config.pl hosts config.pl.pre-${DISTVERSION} \
${STAGEDIR}${PREFIX}/libexec/${PORTNAME}/
.include <bsd.port.mk> .include <bsd.port.mk>

View file

@ -1,10 +0,0 @@
--- configure.pl.orig 2010-07-31 21:52:58.000000000 +0400
+++ configure.pl 2010-08-16 15:34:17.000000000 +0400
@@ -241,6 +241,7 @@
$Conf{InstallDir} ||= $opts{"install-dir"} || "/usr/local/BackupPC";
$Conf{LogDir} ||= $opts{"log-dir"} || "$Conf{TopDir}/log";
}
+ $Conf{LogDir} = $opts{"log-dir"};
#
# These are the programs whose paths we need to find

View file

@ -1,18 +1,16 @@
========================================================================== ==========================================================================
- You need to customize %%ETCDIR%%/config.pl . - If this is a new installation or version upgrade,
to create/update configuration you should run
If this is an upgrade, install BackupPC from port (not from package) %%ETCDIR%%/update.sh
and make sure the full path of the existing BackupPC
configuration directory is %%ETCDIR%% .
Otherwise you will need to make changes in config.pl by hand.
- Add the following line to /etc/rc.conf to enable BackupPC: - Add the following line to /etc/rc.conf to enable BackupPC:
backuppc_enable="YES" backuppc_enable="YES"
- Data directory is /var/db/BackupPC . - Data directory is /var/db/BackupPC
This is where all the PC backup data is stored. This is where all the backup data is stored.
This file system needs to be big enough This file system needs to be big enough
to accommodate all the PCs you expect to backup. to accommodate all the PCs you expect to backup.
========================================================================== ==========================================================================

View file

@ -1,8 +1,4 @@
@stopdaemon backuppc @stopdaemon backuppc
@unexec if cmp -s %D/%%ETCDIR%%/config.pl %D/%%ETCDIR%%/config.pl.sample; then rm -f %D/%%ETCDIR%%/config.pl; fi
@unexec if cmp -s %D/%%ETCDIR%%/hosts %D/%%ETCDIR%%/hosts.sample; then rm -f %D/%%ETCDIR%%/hosts; fi
@rmtry %%ETCDIR%%/config.pl.sample
@rmtry %%ETCDIR%%/hosts.sample
@mode 0555 @mode 0555
bin/BackupPC bin/BackupPC
bin/BackupPC_archive bin/BackupPC_archive
@ -80,7 +76,7 @@ lib/BackupPC/Zip/FileMember.pm
lib/Net/FTP/AutoReconnect.pm lib/Net/FTP/AutoReconnect.pm
lib/Net/FTP/RetrHandle.pm lib/Net/FTP/RetrHandle.pm
man/man1/backuppc.1.gz man/man1/backuppc.1.gz
%%DOCSDIR%%/BackupPC.html %%PORTDOCS%%%%DOCSDIR%%/BackupPC.html
%%PORTDOCS%%%%DOCSDIR%%/BackupPC.pod %%PORTDOCS%%%%DOCSDIR%%/BackupPC.pod
%%WWWDIR%%/0000000.gif %%WWWDIR%%/0000000.gif
%%WWWDIR%%/0000011.gif %%WWWDIR%%/0000011.gif
@ -143,7 +139,6 @@ man/man1/backuppc.1.gz
@dirrm lib/BackupPC @dirrm lib/BackupPC
@dirrm lib/Net/FTP @dirrm lib/Net/FTP
@dirrm lib/Net @dirrm lib/Net
@dirrm %%DOCSDIR%%
@dirrmtry %%WWWDIR%% @dirrmtry %%WWWDIR%%
@dirrmtry %%CGIDIR%% @dirrmtry %%CGIDIR%%
@exec install -d -o backuppc -g backuppc -m 0750 /var/log/BackupPC @exec install -d -o backuppc -g backuppc -m 0750 /var/log/BackupPC
@ -162,16 +157,13 @@ man/man1/backuppc.1.gz
@group backuppc @group backuppc
@dirrmtry %%ETCDIR%% @dirrmtry %%ETCDIR%%
@mode 0640 @mode 0640
libexec/backuppc/config.pl.pre-%%DISTVERSION%% @sample %%ETCDIR%%/config.pl.sample
@exec if [ -s %D/%F -a ! -f %D/%%ETCDIR%%/%f ]; then cp -p %D/%F %D/%%ETCDIR%%/; fi
libexec/backuppc/config.pl
@exec if [ ! -f %D/%%ETCDIR%%/%f ]; then cp -p %D/%F %D/%%ETCDIR%%/config.pl.sample; fi
@exec cp -p %D/%F %D/%%ETCDIR%%/
@mode 0644 @mode 0644
libexec/backuppc/hosts @sample %%ETCDIR%%/hosts.sample
@exec if [ ! -f %D/%%ETCDIR%%/%f ]; then cp -p %D/%F %D/%%ETCDIR%%/hosts.sample; fi
@exec cp -p %D/%F %D/%%ETCDIR%%/
@owner @owner
@group @group
@mode 0544
%%ETCDIR%%/update.sh
libexec/backuppc/update.pl
@mode @mode
@dirrm libexec/backuppc @dirrm libexec/backuppc