mirror of
https://github.com/netbirdio/FreeBSD-ports.git
synced 2026-05-22 18:42:42 -07:00
- Update to 3.3.0.
- Added rrdtool pool statistic graphs option. - Switch to sysutils/p5-File-Listing from www/p5-libwww dependency. - Convert to new options framework. - Trim Makefile header. PR: 178047 Submitted by: Alexander Moisseev <moiseev@mezonplus.ru> (maintainer)
This commit is contained in:
+30
-24
@@ -1,12 +1,8 @@
|
||||
# New ports collection makefile for: BackupPC
|
||||
# Date created: 19 Aug 2010
|
||||
# Whom: Alexander Moisseev <moiseev@mezonplus.ru>
|
||||
#
|
||||
# Created by: Alexander Moisseev <moiseev@mezonplus.ru>
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= backuppc
|
||||
PORTVERSION= 3.2.1
|
||||
PORTVERSION= 3.3.0
|
||||
CATEGORIES= sysutils
|
||||
MASTER_SITES= SF
|
||||
MASTER_SITE_SUBDIR= ${PORTNAME}/${PORTNAME}/${PORTVERSION}
|
||||
@@ -15,7 +11,7 @@ DISTNAME= BackupPC-${PORTVERSION}
|
||||
MAINTAINER= moiseev@mezonplus.ru
|
||||
COMMENT= System for backing PCs and laptops to a server
|
||||
|
||||
RUN_DEPENDS= p5-libwww>=0:${PORTSDIR}/www/p5-libwww
|
||||
RUN_DEPENDS= p5-File-Listing>=0:${PORTSDIR}/sysutils/p5-File-Listing
|
||||
|
||||
NO_BUILD= yes
|
||||
|
||||
@@ -34,31 +30,41 @@ PORTDOCS= ChangeLog LICENSE README BackupPC.html BackupPC.pod
|
||||
|
||||
MAN1= ${PORTNAME}.1
|
||||
|
||||
OPTIONS= COMPRESS_ZLIB "Perl5 interface to zlib compression library" on \
|
||||
ARCHIVE_ZIP "Perl module for Zip archive files" on \
|
||||
FILE_RSYNCP "Perl Rsync client" off \
|
||||
SMBCLIENT "Samba client" off \
|
||||
NMBLOOKUP "NetBIOS Name lookup tool" off \
|
||||
XML_RSS "Perl extension to manage RSS files" off
|
||||
OPTIONS_DEFINE= ARCHIVE_ZIP COMPRESS_ZLIB DOCS FILE_RSYNCP NMBLOOKUP \
|
||||
RRDTOOL SMBCLIENT XML_RSS
|
||||
OPTIONS_DEFAULT= ARCHIVE_ZIP COMPRESS_ZLIB
|
||||
|
||||
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
|
||||
RRDTOOL_DESC= Use RRDTool to generate pool statistic graphs
|
||||
SMBCLIENT_DESC= Samba client
|
||||
XML_RSS_DESC= Perl extension to manage RSS files
|
||||
|
||||
.include <bsd.port.options.mk>
|
||||
|
||||
.if defined(WITH_COMPRESS_ZLIB)
|
||||
RUN_DEPENDS+= p5-IO-Compress>=0:${PORTSDIR}/archivers/p5-IO-Compress
|
||||
.endif
|
||||
.if defined(WITH_ARCHIVE_ZIP)
|
||||
.if ${PORT_OPTIONS:MARCHIVE_ZIP}
|
||||
RUN_DEPENDS+= p5-Archive-Zip>=0:${PORTSDIR}/archivers/p5-Archive-Zip
|
||||
.endif
|
||||
.if defined(WITH_FILE_RSYNCP)
|
||||
.if ${PORT_OPTIONS:MCOMPRESS_ZLIB}
|
||||
RUN_DEPENDS+= p5-IO-Compress>=0:${PORTSDIR}/archivers/p5-IO-Compress
|
||||
.endif
|
||||
.if ${PORT_OPTIONS:MFILE_RSYNCP}
|
||||
RUN_DEPENDS+= p5-File-RsyncP>=0:${PORTSDIR}/net/p5-File-RsyncP
|
||||
.endif
|
||||
.if defined(WITH_SMBCLIENT)
|
||||
RUN_DEPENDS+= smbclient:${PORTSDIR}/net/samba-smbclient
|
||||
.endif
|
||||
.if defined(WITH_NMBLOOKUP)
|
||||
.if ${PORT_OPTIONS:MNMBLOOKUP}
|
||||
RUN_DEPENDS+= nmblookup:${PORTSDIR}/net/samba-nmblookup
|
||||
.endif
|
||||
.if defined(WITH_XML_RSS)
|
||||
.if ${PORT_OPTIONS:MRRDTOOL}
|
||||
RUN_DEPENDS+= rrdtool:${PORTSDIR}/databases/rrdtool
|
||||
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bin-BackupPC \
|
||||
${FILESDIR}/extra-patch-lib-BackupPC-CGI-GeneralInfo.pm
|
||||
.endif
|
||||
.if ${PORT_OPTIONS:MSMBCLIENT}
|
||||
RUN_DEPENDS+= smbclient:${PORTSDIR}/net/samba-smbclient
|
||||
.endif
|
||||
.if ${PORT_OPTIONS:MXML_RSS}
|
||||
RUN_DEPENDS+= p5-XML-RSS>=0:${PORTSDIR}/textproc/p5-XML-RSS
|
||||
.endif
|
||||
|
||||
@@ -108,7 +114,7 @@ post-install:
|
||||
@${EXEC} pod2man --section=1 --release=${PORTVERSION} --name=BackupPC --center=BackupPC" user guide" ${WRKSRC}/BackupPC.pod ${WRKSRC}/${PORTNAME}.1
|
||||
${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.1 ${MANPREFIX}/man/man1
|
||||
|
||||
.if !defined(NOPORTDOCS)
|
||||
.if ${PORT_OPTIONS:MDOCS}
|
||||
${MKDIR} ${DOCSDIR}
|
||||
@cd ${WRKSRC} && ${INSTALL_MAN} ${PORTDOCS} ${DOCSDIR}
|
||||
.endif
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
SHA256 (BackupPC-3.2.1.tar.gz) = 59b09c9ba5236e78cf183153b64ba348820c312275eddcf615d610673b7df054
|
||||
SIZE (BackupPC-3.2.1.tar.gz) = 511896
|
||||
SHA256 (BackupPC-3.3.0.tar.gz) = 8a9c1b6faa4502b4c40617be97e806813815d9e22544854d99983c3da7c1f69b
|
||||
SIZE (BackupPC-3.3.0.tar.gz) = 554155
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
--- bin/BackupPC.orig 2011-04-25 07:31:54.000000000 +0400
|
||||
+++ bin/BackupPC 2013-02-17 16:51:18.000000000 +0400
|
||||
@@ -1198,6 +1198,47 @@
|
||||
$Info{"${p}FileRepMax"},
|
||||
$Info{"${p}FileLinkMax"}, $Info{"${p}DirCnt"});
|
||||
}
|
||||
+
|
||||
+ #
|
||||
+ # RRDTool Graphing stuff
|
||||
+ #
|
||||
+ if ( -x "$BinDir/rrdtool" ) {
|
||||
+ my $date = time() + (24 * 3600);
|
||||
+ if ( ! -f "$LogDir/pool.rrd" ) {
|
||||
+ system("$BinDir/rrdtool create $LogDir/pool.rrd"
|
||||
+ . " --step 86400"
|
||||
+ . " DS:ckb:GAUGE:172800:0:U"
|
||||
+ . " DS:tps:GAUGE:172800:0:U"
|
||||
+ . " RRA:AVERAGE:0.5:1:1400"
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ #
|
||||
+ # Generate size totals prior to poolng and compression
|
||||
+ #
|
||||
+ my $sizeTot;
|
||||
+ foreach my $host ( sort(keys(%{$bpc->HostInfoRead()})) ) {
|
||||
+ my @Backups = $bpc->BackupInfoRead($host);
|
||||
+ for ( my $i = 0 ; $i < @Backups ; $i++ ) {
|
||||
+ $sizeTot += $Backups[$i]{size};
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ $sizeTot = $sizeTot / 1024;
|
||||
+
|
||||
+ system("$BinDir/rrdtool update $LogDir/pool.rrd"
|
||||
+ . " $date:"
|
||||
+ . ( $Info{"cpoolKb"} + $Info{"poolKb"} )
|
||||
+ . ":$sizeTot"
|
||||
+ );
|
||||
+
|
||||
+ printf(LOG "%sRRD Data: %s:%f:%f\n",
|
||||
+ $bpc->timeStamp,
|
||||
+ $date,
|
||||
+ $Info{"cpoolKb"} + $Info{"poolKb"},
|
||||
+ $sizeTot);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
} else {
|
||||
$CmdJob = "";
|
||||
@@ -0,0 +1,73 @@
|
||||
--- lib/BackupPC/CGI/GeneralInfo.pm.orig 2011-04-25 07:31:55.000000000 +0400
|
||||
+++ lib/BackupPC/CGI/GeneralInfo.pm 2013-02-17 16:52:16.000000000 +0400
|
||||
@@ -44,6 +44,47 @@
|
||||
GetStatusInfo("info jobs hosts queueLen");
|
||||
my $Privileged = CheckPermission();
|
||||
|
||||
+ #
|
||||
+ # Generate pool size RRDtool graph image
|
||||
+ #
|
||||
+ if ( $In{image} ne "" ) {
|
||||
+ $In{image} =~ /([0-9]+)/;
|
||||
+ my $weeks = $1;
|
||||
+ my $real = $<; ### SUID
|
||||
+ $< = $>; ### SUID
|
||||
+
|
||||
+ my $poolSizeGraph = "$BinDir/rrdtool graph -"
|
||||
+ . " --start=end-${weeks}w --end=-300"
|
||||
+ . ' --title="BackupPC Pool Size (' . ${weeks} . ' weeks)"'
|
||||
+ . ' --vertical-label=""'
|
||||
+ . ' --width=600 --height=100 --rigid --alt-autoscale-max'
|
||||
+ . ' --base=1024 --logarithmic --units=si'
|
||||
+ . ' --color BACK#FFFFFF --slope-mode --imgformat=PNG'
|
||||
+ . ' --font TITLE:10: --font AXIS:8: --font LEGEND:8: --font UNIT:8:'
|
||||
+ . ' --font-render-mode mono'
|
||||
+
|
||||
+ . ' DEF:ao="' . "$LogDir" . '/pool.rrd":ckb:AVERAGE'
|
||||
+ . ' DEF:aob="' . "$LogDir" . '/pool.rrd":tps:AVERAGE'
|
||||
+ . ' CDEF:a=ao,1024,*'
|
||||
+ . ' CDEF:b=aob,1024,*'
|
||||
+
|
||||
+ . ' AREA:a#95B8DB:"CPool in bytes "'
|
||||
+ . ' GPRINT:a:LAST:"Current\\:%8.2lf %s"'
|
||||
+ . ' GPRINT:a:AVERAGE:"Average\\:%8.2lf %s"'
|
||||
+ . ' GPRINT:a:MAX:"Maximum\\:%8.2lf %s\n"'
|
||||
+
|
||||
+ . ' LINE1:b#FF0000:"Prior to pooling and compression"'
|
||||
+ . ' GPRINT:b:LAST:"Current\\:%8.2lf %s"'
|
||||
+ . ' GPRINT:b:AVERAGE:"Average\\:%8.2lf %s"'
|
||||
+ . ' GPRINT:b:MAX:"Maximum\\:%8.2lf %s\\n"';
|
||||
+
|
||||
+ print "Content-type: image/png\n\n";
|
||||
+ print `$poolSizeGraph`;
|
||||
+
|
||||
+ $< = $real; ### SUID
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
my($jobStr, $statusStr);
|
||||
foreach my $host ( sort(keys(%Jobs)) ) {
|
||||
my $startTime = timeStamp2($Jobs{$host}{startTime});
|
||||
@@ -126,8 +167,20 @@
|
||||
} elsif ( $Info{cpoolFileCnt} > 0 ) {
|
||||
$poolInfo = $cpoolInfo;
|
||||
}
|
||||
- my $generalInfo = eval("qq{$Lang->{BackupPC_Server_Status_General_Info}}")
|
||||
- if ( $Privileged );
|
||||
+
|
||||
+ my $generalInfo = "";
|
||||
+ if ( $Privileged ) {
|
||||
+ $generalInfo = eval("qq{$Lang->{BackupPC_Server_Status_General_Info}}");
|
||||
+ $generalInfo .= '
|
||||
+<ul>
|
||||
+ <ul>
|
||||
+ <p><img src="' . $MyURL . '?image=4">
|
||||
+ <p><img src="' . $MyURL . '?image=52">
|
||||
+ </ul>
|
||||
+</ul>'
|
||||
+ if ( -r "$LogDir/pool.rrd" );
|
||||
+ }
|
||||
+
|
||||
my $content = eval("qq{$Lang->{BackupPC_Server_Status}}");
|
||||
Header($Lang->{H_BackupPC_Server_Status}, $content);
|
||||
Trailer();
|
||||
@@ -48,9 +48,12 @@ lib/BackupPC/Lang/en.pm
|
||||
lib/BackupPC/Lang/es.pm
|
||||
lib/BackupPC/Lang/fr.pm
|
||||
lib/BackupPC/Lang/it.pm
|
||||
lib/BackupPC/Lang/ja.pm
|
||||
lib/BackupPC/Lang/nl.pm
|
||||
lib/BackupPC/Lang/pl.pm
|
||||
lib/BackupPC/Lang/pt_br.pm
|
||||
lib/BackupPC/Lang/ru.pm
|
||||
lib/BackupPC/Lang/uk.pm
|
||||
lib/BackupPC/Lang/zh_CN.pm
|
||||
lib/BackupPC/Lib.pm
|
||||
lib/BackupPC/PoolWrite.pm
|
||||
@@ -133,11 +136,11 @@ lib/Net/FTP/RetrHandle.pm
|
||||
@unexec echo "If you are permanently removing BackupPC, you should manually delete:"
|
||||
@unexec echo
|
||||
@unexec echo " - the backuppc user/group: pw userdel backuppc"
|
||||
@unexec rmdir %D/%%ETCDIR%% 2>/dev/null || echo " - BackupPC configuration: rm -rf %D/%%ETCDIR%%"
|
||||
@unexec rmdir %%BPC_DATADIR%%/cpool 2>/dev/null || true
|
||||
@unexec rmdir %%BPC_DATADIR%%/pc 2>/dev/null || true
|
||||
@unexec rmdir %%BPC_DATADIR%%/pool 2>/dev/null || true
|
||||
@unexec rmdir %%BPC_DATADIR%%/trash 2>/dev/null || true
|
||||
@unexec rmdir %%BPC_DATADIR%% 2>/dev/null || echo " - BackupPC data directory: rm -rf %%BPC_DATADIR%%"
|
||||
@unexec rmdir /var/log/BackupPC 2>/dev/null || echo " - BackupPC logs directory: rm -rf /var/log/BackupPC"
|
||||
@unexec rmdir %D/%%ETCDIR%% 2>/dev/null || echo " - BackupPC configuration: rm -r %D/%%ETCDIR%%"
|
||||
@dirrmtry %%BPC_DATADIR%%/cpool
|
||||
@dirrmtry %%BPC_DATADIR%%/pc
|
||||
@dirrmtry %%BPC_DATADIR%%/pool
|
||||
@dirrmtry %%BPC_DATADIR%%/trash
|
||||
@unexec rmdir %%BPC_DATADIR%% 2>/dev/null || echo " - BackupPC data directory: rm -r %%BPC_DATADIR%%"
|
||||
@unexec rmdir /var/log/BackupPC 2>/dev/null || echo " - BackupPC logs directory: rm -r /var/log/BackupPC"
|
||||
@unexec echo
|
||||
|
||||
Reference in New Issue
Block a user