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
PORTVERSION= 3.3.0
PORTREVISION= 4
PORTREVISION= 5
CATEGORIES= sysutils
MASTER_SITES= SF
MASTER_SITE_SUBDIR= ${PORTNAME}/${PORTNAME}/${PORTVERSION}
@ -23,15 +23,14 @@ USE_RC_SUBR= backuppc
USES= perl5
NO_BUILD= yes
NO_PACKAGE= Overwrites configuration files; set FORCE_PACKAGE if you want\
to build this package
USERS= backuppc
GROUPS= backuppc
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}/,,} \
DISTVERSION=${DISTVERSION}
@ -39,13 +38,18 @@ PLIST_SUB+= CGIDIR=${CGIDIR:S,^${PREFIX}/,,} \
PORTDOCS= ChangeLog LICENSE README
OPTIONS_DEFINE= ARCHIVE_ZIP COMPRESS_ZLIB DOCS FILE_RSYNCP NMBLOOKUP \
RRDTOOL SMBCLIENT XML_RSS
OPTIONS_DEFAULT= ARCHIVE_ZIP COMPRESS_ZLIB
SMBCLIENT XML_RSS
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
COMPRESS_ZLIB_DESC= Perl5 interface to zlib compression library
FILE_RSYNCP_DESC= Perl Rsync client
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
SMBCLIENT_DESC= Samba client
XML_RSS_DESC= Perl extension to manage RSS files
@ -66,6 +70,8 @@ RUN_DEPENDS+= nmblookup:${PORTSDIR}/net/samba-nmblookup
.endif
.if ${PORT_OPTIONS:MRRDTOOL}
RUN_DEPENDS+= rrdtool:${PORTSDIR}/databases/rrdtool
.endif
.if ${PORT_OPTIONS:MRRD_GRAPHS} || ${PORT_OPTIONS:MRRDTOOL}
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bin-BackupPC \
${FILESDIR}/extra-patch-lib-BackupPC-CGI-GeneralInfo.pm
.endif
@ -76,12 +82,18 @@ RUN_DEPENDS+= smbclient:${PORTSDIR}/net/samba-smbclient
RUN_DEPENDS+= p5-XML-RSS>=0:${PORTSDIR}/textproc/p5-XML-RSS
.endif
pre-patch:
@${CP} ${WRKSRC}/configure.pl ${WRKSRC}/update.pl
post-patch:
@${REINPLACE_CMD} \
-e 's|/etc/BackupPC\(/config.pl\)|${ETCDIR}\1|' \
-e 's|^\(foreach my $$dir ( qw(bin \)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} \
-e 's,"/doc/BackupPC.html","/${DOCSDIR_REL}/BackupPC.html",' \
${WRKSRC}/lib/BackupPC/CGI/View.pm
@ -95,15 +107,6 @@ post-patch:
${WRKSRC}/doc/BackupPC.html ${WRKSRC}/doc/BackupPC.pod
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 \
--batch \
--backuppc-user ${USERS} \
@ -124,14 +127,10 @@ do-install:
${WRKSRC}/doc/BackupPC.pod ${WRKSRC}/${PORTNAME}.1
${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.1 ${STAGEDIR}${MANPREFIX}/man/man1
cd ${WRKSRC} && ${INSTALL_MAN} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}
if [ ! -f ${STAGEDIR}${ETCDIR}/config.pl.pre-${DISTVERSION} ]; then \
> ${STAGEDIR}${ETCDIR}/config.pl.pre-${DISTVERSION}; \
fi
${INSTALL} -d ${STAGEDIR}${PREFIX}/libexec/${PORTNAME}
cd ${STAGEDIR}${ETCDIR} && \
${CHGRP} wheel config.pl config.pl.pre-${DISTVERSION} && \
${MV} config.pl hosts config.pl.pre-${DISTVERSION} \
${STAGEDIR}${PREFIX}/libexec/${PORTNAME}/
${CP} ${WRKSRC}/conf/config.pl ${STAGEDIR}${ETCDIR}/config.pl.sample
${CP} ${WRKSRC}/conf/hosts ${STAGEDIR}${ETCDIR}/hosts.sample
${CP} ${WRKDIR}/update.sh ${STAGEDIR}${ETCDIR}/update.sh
${MKDIR} ${STAGEDIR}${PREFIX}/libexec/backuppc
${CP} ${WRKSRC}/update.pl ${STAGEDIR}${PREFIX}/libexec/backuppc/update.pl
.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)
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.
%%ETCDIR%%/update.sh
- Add the following line to /etc/rc.conf to enable BackupPC:
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
to accommodate all the PCs you expect to backup.
==========================================================================

View file

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