From 8f5625f9cdf47f8e04be654c4954838b2df3e26d Mon Sep 17 00:00:00 2001 From: cbarratt Date: Mon, 29 Mar 2004 19:03:50 +0000 Subject: [PATCH] * The CSS definition has been removed from the config.pl file and is now a separate file, BackupPC_stnd.css. A new config variable, $Conf{CgiCSSFile}, gives the name of the CSS file to use. Suggested by Ender Mathias. * Fixed the filling of the host name select box for admins. The default $Conf{CgiNavBarAdminAllHosts} is now 1. Reported by Doug Lytle. * Cleaned up warning message for restore using rsync when checksum caching is on, but when file didn't have cached checksums. --- ChangeLog | 16 +++ bin/BackupPC_dump | 7 +- conf/BackupPC_stnd.css | 176 ++++++++++++++++++++++++ conf/config.pl | 228 ++++++------------------------- configure.pl | 25 +++- doc-src/BackupPC.pod | 28 +++- lib/BackupPC/CGI/Archive.pm | 12 +- lib/BackupPC/CGI/Lib.pm | 9 +- lib/BackupPC/CGI/Restore.pm | 10 +- lib/BackupPC/CGI/RestoreInfo.pm | 3 +- lib/BackupPC/CGI/Summary.pm | 9 +- lib/BackupPC/Lang/de.pm | 6 +- lib/BackupPC/Lang/en.pm | 4 +- lib/BackupPC/Lang/es.pm | 4 +- lib/BackupPC/Lang/fr.pm | 4 +- lib/BackupPC/Lang/it.pm | 6 +- lib/BackupPC/PoolWrite.pm | 8 +- lib/BackupPC/Xfer/RsyncFileIO.pm | 1 + makeDist | 7 +- 19 files changed, 330 insertions(+), 233 deletions(-) create mode 100644 conf/BackupPC_stnd.css diff --git a/ChangeLog b/ChangeLog index 2499045..bcb84d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,22 @@ # Version __VERSION__, __RELEASEDATE__ #------------------------------------------------------------------------ +* The CSS definition has been removed from the config.pl file and + is now a separate file, BackupPC_stnd.css. A new config variable, + $Conf{CgiCSSFile}, gives the name of the CSS file to use. + Suggested by Ender Mathias. + +* Fixed the filling of the host name select box for admins. + The default $Conf{CgiNavBarAdminAllHosts} is now 1. + Reported by Doug Lytle. + +* Cleaned up warning message for restore using rsync when checksum + caching is on, but when file didn't have cached checksums. + +#------------------------------------------------------------------------ +# Version 2.1.0beta0, 20 Mar 2004 +#------------------------------------------------------------------------ + * A failed full dump is now saved as a partial (incomplete) dump, provided it includes some files. This can be used for browsing, restoring etc, and will also form the basis of resuming full diff --git a/bin/BackupPC_dump b/bin/BackupPC_dump index 2b1d300..2f3b7a3 100755 --- a/bin/BackupPC_dump +++ b/bin/BackupPC_dump @@ -280,14 +280,15 @@ my $partialNum; if ( $Conf{FullPeriod} == -1 && !$opts{f} && !$opts{i} || $Conf{FullPeriod} == -2 ) { print(STDERR "Exiting because backups are disabled with" - . "\$Conf{FullPeriod} = $Conf{FullPeriod}\n") if ( $opts{v} ); + . " \$Conf{FullPeriod} = $Conf{FullPeriod}\n") if ( $opts{v} ); # # Tell BackupPC to ignore old failed backups on hosts that # have backups disabled. # print("backups disabled\n") - if ( $StatusHost{reason} ne "Reason_backup_done" - && time - $StatusHost{startTime} > 2 * 24 * 3600 ); + if ( defined($StatusHost{errorTime}) + && $StatusHost{reason} ne "Reason_backup_done" + && time - $StatusHost{errorTime} > 4 * 24 * 3600 ); NothingToDo($needLink); } diff --git a/conf/BackupPC_stnd.css b/conf/BackupPC_stnd.css new file mode 100644 index 0000000..c499bb7 --- /dev/null +++ b/conf/BackupPC_stnd.css @@ -0,0 +1,176 @@ +/* + * BackupPC standard CSS definitions + * + * Version 2.1.0beta0, released 20 Mar 2004. + * + * See http://backuppc.sourceforge.net. + * + * AUTHOR + * Craig Barratt + * + * COPYRIGHT + * Copyright (C) 2004 Craig Barratt + */ + +body { + font-family:arial,sans-serif; + font-size:1em; + background-color:#ffffff; + margin:2px 5px 0px 2px; + height:100% +} + +h1 { + font-family:arial,sans-serif; + font-size:1.5em; + color:#000000 +} + +h2 { + font-family:arial,sans-serif; + font-size:1em; + color:#000000 +} + +p { + font-family:arial,sans-serif; + font-size:.9em +} + +a { + font-family:arial,sans-serif; + color:#3333ff +} + +li { + font-size:.9em; +} + +a:hover { + color:#cc0000; + text-decoration:none +} + +a.NavCurrent { + font-weight:bold; +} + +a.navbar { + padding-left:5px; + padding-right:5px; +} + +.h1 { + font-family:arial,sans-serif; + font-size:1.5em; + color:#000000; + font-weight:bold; + background-color:#99cc33; + padding:3px; + padding-left:6px; + margin-bottom:5px; +} + +.h2 { + font-family:arial,sans-serif; + font-size:1em; + color:#000000; + font-weight:bold; + background-color:#ddeeee; + padding:3px; + padding-left:6px; + margin-top:3px; + margin-bottom:1px; +} + +.tableStnd { +} + +.tableheader { + font-size:.8em; + font-weight:bold; + background-color:#cccccc; +} + +.border { + font-size:.9em; +} + +.fviewheader { + font-weight:bold; + font-size:.8em; + color:#ffffff; + background-color:#999999; +} + +.fviewborder { + border-bottom:1px solid #000000; + border-left:1px dotted #666666; + background-color:#dddddd; + font-size:.9em; +} + +.fviewon { + background-color:#cccccc; +} + +.fviewoff { + background-color:#ffffff; +} + +.fview { + font-size:.8em; + font-family:arial,sans-serif; + text-decoration:none; + line-height:15px; +} + +.fviewbold { + font-size:.9em; + font-family:arial,sans-serif; + text-decoration:none; + line-height:15px; + font-weight:bold; +} + +.histView { + border-bottom:1px solid #000000; + border-left:2px solid #ffffff; + background-color:#dddddd; + font-size:.9em; +} + +.histViewMis { + border-bottom:1px solid #000000; + background-color:#ffdddd; +} + +div.NavMenu { + width:18%; + margin:0px; + background-color:#ddeeee; +} + +div.NavMenu a { + font-size:.8em; + display:block; + margin-left:8px; + padding:2px; +} + +div.NavTitle { + padding-left:10px; + background-color:#99cc33; + font-family:arial,sans-serif; + color:#000000; + font-weight:bold; + margin-bottom:2px; +} + +#Content { + float:right; + width:80%; + left:20%; + top:10px; + position:absolute; +} diff --git a/conf/config.pl b/conf/config.pl index 1b8054c..58991e1 100644 --- a/conf/config.pl +++ b/conf/config.pl @@ -108,6 +108,13 @@ $Conf{UmaskMode} = 027; # # The default value is every hour except midnight. # +# The first entry of $Conf{WakeupSchedule} is when BackupPC_nightly +# is run. No other backups can run while BackupPC_nightly is +# running. You might want to re-arrange the entries in +# $Conf{WakeupSchedule} (they don't have to be ascending) so that +# the first entry is when you want BackupPC_nightly to run +# (eg: when you don't expect a lot of regular backups to run). +# $Conf{WakeupSchedule} = [1..23]; # @@ -337,10 +344,6 @@ $Conf{TarShareName} = '/'; # being backed up (eg: a retired machine), but you wish to keep the # last backups available for browsing or restoring to other machines. # -# Also, you might create a virtual client (by setting $Conf{ClientNameAlias}) -# for restoring to a DVD or permanent media and you would set -# $Conf{FullPeriod} to -2 so that it is never backed up. -# $Conf{FullPeriod} = 6.97; # @@ -960,6 +963,14 @@ $Conf{RsyncArgs} = [ '--times', '--block-size=2048', '--recursive', + + # + # If you are using a patched client rsync that supports the + # --fixed-csumseed option (see http://backuppc.sourceforge.net), + # then uncomment this to enabled rsync checksum cachcing + # + #'--fixed-csumseed', + # # Add additional arguments here # @@ -977,17 +988,25 @@ $Conf{RsyncRestoreArgs} = [ # # Do not edit these! # - "--numeric-ids", - "--perms", - "--owner", - "--group", - "--devices", - "--links", - "--times", - "--block-size=2048", - "--relative", - "--ignore-times", - "--recursive", + '--numeric-ids', + '--perms', + '--owner', + '--group', + '--devices', + '--links', + '--times', + '--block-size=2048', + '--relative', + '--ignore-times', + '--recursive', + + # + # If you are using a patched client rsync that supports the + # --fixed-csumseed option (see http://backuppc.sourceforge.net), + # then uncomment this to enabled rsync checksum cachcing + # + #'--fixed-csumseed', + # # Add additional arguments here # @@ -1535,11 +1554,11 @@ $Conf{CgiDateFormatMMDD} = 1; # # If set, the complete list of hosts appears in the left navigation -# bar for administrators. Otherwise, just the hosts for which the -# user is listed in the host file (as either the user or in moreUsers) +# bar pull-down for administrators. Otherwise, just the hosts for which +# the user is listed in the host file (as either the user or in moreUsers) # are displayed. # -$Conf{CgiNavBarAdminAllHosts} = 0; +$Conf{CgiNavBarAdminAllHosts} = 1; # # Hilight colors based on status that are used in the PC summary page. @@ -1589,171 +1608,8 @@ $Conf{CgiExt2ContentType} = { }; $Conf{CgiImageDirURL} = ''; # -# CSS stylesheet for the CGI interface. -# -$Conf{CSSstylesheet} = <<'EOF'; - -EOF +# CSS stylesheet for the CGI interface. It is stored in the +# $Conf{CgiImageDir} directory and accessed via the +# $Conf{CgiImageDirURL} URL. +# +$Conf{CgiCSSFile} = 'BackupPC_stnd.css'; diff --git a/configure.pl b/configure.pl index 76ecb2e..1f787df 100755 --- a/configure.pl +++ b/configure.pl @@ -470,6 +470,16 @@ if ( $Conf{CgiImageDir} ne "" ) { (my $destImg = $img) =~ s{^images/}{}; InstallFile($img, "$Conf{CgiImageDir}/$destImg", 0444, 1); } + + # + # Install new CSS file, making a backup copy if necessary + # + my $cssBackup = "$Conf{CgiImageDir}/BackupPC_stnd.css.pre-__VERSION__"; + if ( -f "$Conf{CgiImageDir}/BackupPC_stnd.css" && !-f $cssBackup ) { + rename("$Conf{CgiImageDir}/BackupPC_stnd.css", $cssBackup); + } + InstallFile("conf/BackupPC_stnd.css", + "$Conf{CgiImageDir}/BackupPC_stnd.css", 0444, 0); } printf("Making init.d scripts\n"); @@ -533,6 +543,11 @@ if ( defined($Conf{SmbClientArgs}) ) { delete($Conf{SmbClientArgs}); } +# +# CSS is now stored in a file rather than a big config variable. +# +delete($Conf{CSSstylesheet}); + # # The blackout timing settings are now stored in a list of hashes, rather # than three scalar parameters. @@ -553,7 +568,15 @@ if ( defined($Conf{BlackoutHourBegin}) ) { # # $Conf{RsyncLogLevel} has been replaced by $Conf{XferLogLevel} # -$Conf{XferLogLevel} = $Conf{RsyncLogLevel}; +if ( defined($Conf{RsyncLogLevel}) ) { + $Conf{XferLogLevel} = $Conf{RsyncLogLevel}; + delete($Conf{RsyncLogLevel}); +} + +# +# In 2.1.0 the default for $Conf{CgiNavBarAdminAllHosts} is now 1 +# +$Conf{CgiNavBarAdminAllHosts} = 1; # # IncrFill should now be off diff --git a/doc-src/BackupPC.pod b/doc-src/BackupPC.pod index a8ddc27..96e6c1f 100644 --- a/doc-src/BackupPC.pod +++ b/doc-src/BackupPC.pod @@ -96,10 +96,13 @@ BackupPC is Open Source software hosted by SourceForge. =item Full Backup -A full backup is a complete backup of a share. BackupPC can be configured to -do a full backup at a regular interval (often weekly). BackupPC can also -be configured to keep a certain number of full backups, and to keep -a smaller number of very old full backups. +A full backup is a complete backup of a share. BackupPC can be +configured to do a full backup at a regular interval (typically +weekly). BackupPC can be configured to keep a certain number +of full backups. Exponential expiry is also supported, allowing +full backups with various vintages to be kept (for example, a +settable number of most recent weekly fulls, plus a settable +number of older fulls that are 2, 4, 8, or 16 weeks apart). =item Incremental Backup @@ -121,6 +124,23 @@ BackupPC's CGI interface "fills-in" incremental backups based on the last full backup, giving every backup a "full" appearance. This makes browsing and restoring backups easier. +=item Partial Backup + +When a full backup fails or is canceled, and some files have already +been backed up, BackupPC keeps a partial backup containing just the +files that were backed up successfully. The partial backup is removed +when the next successful backup completes, or if another full backup +fails resulting in a newer partial backup. A failed full backup +that has not backed up any files, or any failed incremental backup, +is removed; no partial backup is saved in these cases. + +The partial backup may be browsed or used to restore files just like +a successful full or incremental backup. + +With the rsync transfer method the partial backup is used to resume +the next full backup, avoiding the need to retransfer the file data +already in the partial backup. + =item Identical Files BackupPC pools identical files using hardlinks. By "identical diff --git a/lib/BackupPC/CGI/Archive.pm b/lib/BackupPC/CGI/Archive.pm index 864a2ea..758cac3 100644 --- a/lib/BackupPC/CGI/Archive.pm +++ b/lib/BackupPC/CGI/Archive.pm @@ -43,7 +43,11 @@ use Data::Dumper; sub action { my $archHost = $In{host}; + my $Privileged = CheckPermission(); + if ( !$Privileged ) { + ErrorExit($Lang->{Only_privileged_users_can_archive} ); + } if ( $In{type} == 0 ) { my($fullTot, $fullSizeTot, $incrTot, $incrSizeTot, $str, $strNone, $strGood, $hostCntGood, $hostCntNone, $checkBoxCnt, @@ -51,11 +55,7 @@ sub action $hostCntGood = $hostCntNone = $checkBoxCnt = $fullSizeTot = 0; GetStatusInfo("hosts"); - my $Privileged = CheckPermission(); - if ( !$Privileged ) { - ErrorExit($Lang->{Only_privileged_users_can_archive} ); - } foreach my $host ( sort(keys(%Status)) ) { my($fullDur, $incrCnt, $fullSize, $fullRate); my @Backups = $bpc->BackupInfoRead($host); @@ -98,7 +98,6 @@ EOF } else { my(@HostList, @BackupList, $HostListStr, $hiddenStr, $pathHdr, $badFileCnt, $reply, $str); - my $Privileged = CheckPermission(); my $args = { SplitPath => $bpc->{Conf}{SplitPath}, ParPath => $bpc->{Conf}{ParPath}, @@ -112,9 +111,6 @@ EOF topDir => $bpc->{TopDir}, }; - if ( !$Privileged ) { - ErrorExit($Lang->{Only_privileged_users_can_archive} ); - } ServerConnect(); for ( my $i = 0 ; $i < $In{fcbMax} ; $i++ ) { diff --git a/lib/BackupPC/CGI/Lib.pm b/lib/BackupPC/CGI/Lib.pm index aee4743..40950f8 100644 --- a/lib/BackupPC/CGI/Lib.pm +++ b/lib/BackupPC/CGI/Lib.pm @@ -320,9 +320,10 @@ sub CheckPermission $Privileged ||= $Conf{CgiAdminUsers} eq "*"; } $PrivAdmin = $Privileged; + return $Privileged if ( !defined($host) ); + $Privileged ||= $User eq $Hosts->{$host}{user}; $Privileged ||= defined($Hosts->{$host}{moreUsers}{$User}); - return $Privileged; } @@ -334,7 +335,7 @@ sub CheckPermission # sub GetUserHosts { - my($host, $getAll) = @_; + my($getAll) = @_; my @hosts; if ( $getAll && CheckPermission() ) { @@ -414,7 +415,7 @@ sub Header $title -$Conf{CSSstylesheet} + $Conf{CgiHeaders}
@@ -464,7 +465,7 @@ EOF