Commit 3f9fae37 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Fixed whitespaces

parent 6ae1e226
#!/usr/bin/perl -w
# Copyright (c) 2010-2012, AllWorldIT
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
......@@ -136,7 +136,7 @@ GetOptions(\%optctl,
"exclude-data",
"data-dir=s@",
"exclude-file=s@",
"exclude-path=s@",
......@@ -273,7 +273,7 @@ if (defined($optctl{'compress'})) {
$optctl{'compress'} ne "bzip2" &&
$optctl{'compress'} ne "gzip" &&
$optctl{'compress'} ne "none"
) {
) {
print(STDERR "ERROR: Compression is invalid, valid values are: xz bzip2 gzip none\n\n");
displayHelp();
exit 1;
......@@ -299,7 +299,7 @@ if (defined($optctl{'manifest-format'})) {
if (
$optctl{'manifest-format'} ne "null" &&
$optctl{'manifest-format'} ne "newline"
) {
) {
print(STDERR "ERROR: Manifest format is invalid, valid values are: null newline\n\n");
displayHelp();
exit 1;
......@@ -473,7 +473,7 @@ sub backup
# If we have a manifest, we should have a backup, therefore a format and sequence
} elsif (
-f "$dest/$path/dbackup0.manifest" && (
!defined($origPathAttribs{$path}->{'format'}) ||
!defined($origPathAttribs{$path}->{'format'}) ||
!defined($origPathAttribs{$path}->{'sequence'})
)
) {
......@@ -578,32 +578,32 @@ sub backup
!defined($origDirList{$path}->{$item}->{'mtime'}) ||
$origDirList{$path}->{$item}->{'mtime'} ne $mtime
) {
printLog(LOG_DEBUG,"S: Directory '[$source]/($path)/$item' was modified\n");
printLog(LOG_DEBUG,"S: Directory '[$source]/($path)/$item' was modified\n");
$doBackup{$path} |= ST_DIR_CHANGED;
# Check if uid matches
} elsif (
!defined($origDirList{$path}->{$item}->{'uid'}) ||
$origDirList{$path}->{$item}->{'uid'} ne $uid
) {
printLog(LOG_DEBUG,"S: Directory '[$source]/($path)/$item' UID was changed\n");
printLog(LOG_DEBUG,"S: Directory '[$source]/($path)/$item' UID was changed\n");
$doBackup{$path} |= ST_DIR_CHANGED;
# Check if gid matches
} elsif (
!defined($origDirList{$path}->{$item}->{'gid'}) ||
$origDirList{$path}->{$item}->{'gid'} ne $gid
) {
printLog(LOG_DEBUG,"S: Directory '[$source]/($path)/$item' GID was changed\n");
printLog(LOG_DEBUG,"S: Directory '[$source]/($path)/$item' GID was changed\n");
$doBackup{$path} |= ST_DIR_CHANGED;
# Check if mode matches
} elsif (
!defined($origDirList{$path}->{$item}->{'mode'}) ||
$origDirList{$path}->{$item}->{'mode'} ne $mode
) {
printLog(LOG_DEBUG,"S: Directory '[$source]/($path)/$item' MODE was changed\n");
printLog(LOG_DEBUG,"S: Directory '[$source]/($path)/$item' MODE was changed\n");
$doBackup{$path} |= ST_DIR_CHANGED;
}
# Record details...
# Record details...
$srcDirList{$path}->{$item}->{'size'} = $size;
$srcDirList{$path}->{$item}->{'ctime'} = $ctime;
$srcDirList{$path}->{$item}->{'atime'} = $atime;
......@@ -635,7 +635,7 @@ sub backup
!defined($origFileList{$path}->{$item}->{'size'}) ||
$origFileList{$path}->{$item}->{'size'} ne $size
) {
printLog(LOG_DEBUG,"S: File '[$source]/($path)/$item' has different size\n");
printLog(LOG_DEBUG,"S: File '[$source]/($path)/$item' has different size\n");
$state |= ST_FILE_CHANGED;
#
......@@ -646,7 +646,7 @@ sub backup
# !defined($origFileList{$path}->{$item}->{'ctime'}) ||
# $origFileList{$path}->{$item}->{'ctime'} ne $ctime
# ) {
# printLog(LOG_DEBUG,"S: File '[$source]/($path)/$item' was recreated\n");
# printLog(LOG_DEBUG,"S: File '[$source]/($path)/$item' was recreated\n");
# $state |= ST_FILE_CHANGED;
# Check if mtime matches
......@@ -654,7 +654,7 @@ sub backup
!defined($origFileList{$path}->{$item}->{'mtime'}) ||
$origFileList{$path}->{$item}->{'mtime'} ne $mtime
) {
printLog(LOG_DEBUG,"S: File '[$source]/($path)/$item' was modified\n");
printLog(LOG_DEBUG,"S: File '[$source]/($path)/$item' was modified\n");
$state |= ST_FILE_CHANGED;
# Check if uid matches
......@@ -662,7 +662,7 @@ sub backup
!defined($origFileList{$path}->{$item}->{'uid'}) ||
$origFileList{$path}->{$item}->{'uid'} ne $uid
) {
printLog(LOG_DEBUG,"S: File '[$source]/($path)/$item' UID was changed\n");
printLog(LOG_DEBUG,"S: File '[$source]/($path)/$item' UID was changed\n");
$state |= ST_FILE_ATTR_CHANGED
# Check if gid matches
......@@ -670,7 +670,7 @@ sub backup
!defined($origFileList{$path}->{$item}->{'gid'}) ||
$origFileList{$path}->{$item}->{'gid'} ne $gid
) {
printLog(LOG_DEBUG,"S: File '[$source]/($path)/$item' GID was changed\n");
printLog(LOG_DEBUG,"S: File '[$source]/($path)/$item' GID was changed\n");
$state |= ST_FILE_ATTR_CHANGED;
# Check if mode matches
......@@ -678,7 +678,7 @@ sub backup
!defined($origFileList{$path}->{$item}->{'mode'}) ||
$origFileList{$path}->{$item}->{'mode'} ne $mode
) {
printLog(LOG_DEBUG,"S: File '[$source]/($path)/$item' MODE was changed\n");
printLog(LOG_DEBUG,"S: File '[$source]/($path)/$item' MODE was changed\n");
$state |= ST_FILE_ATTR_CHANGED;
}
......@@ -687,7 +687,7 @@ sub backup
$doBackup{$path} |= ST_FILE_CHANGED;
}
# Record details...
# Record details...
$srcFileList{$path}->{$item}->{'size'} = $size;
$srcFileList{$path}->{$item}->{'ctime'} = $ctime;
$srcFileList{$path}->{$item}->{'atime'} = $atime;
......@@ -766,7 +766,7 @@ sub backup
# If files changed we blow everything away
} else {
$newPathAttribs{$path}->{'sequence'} = 0;
# Remove old files
# Remove old files
removeBackups(
"$dest/$path",
$origPathAttribs{$path}->{'format'},
......@@ -816,7 +816,7 @@ sub backup
$newPathAttribs{$path}->{'manifest.format'} = "null";
} else {
$newPathAttribs{$path}->{'manifest.format'} = "newline";
}
}
}
}
......@@ -867,7 +867,7 @@ sub backup
# Change dir and start backup
system(
"tar",
"tar",
"--create",
"--verbose",
# Output file
......@@ -899,7 +899,7 @@ sub backup
}
# if (($doBackup{$path} & ST_DIR_SYS) != ST_DIR_SYS) {
} else {
# Remove old files
# Remove old files
removeBackups(
"$dest/$path",
$origPathAttribs{$path}->{'format'},
......@@ -936,7 +936,7 @@ sub backup
$gz->gzwrite(join("\0",
"a",
$item,
$newPathAttribs{$path}->{$item}
$newPathAttribs{$path}->{$item}
)."\n"
);
}
......@@ -1003,7 +1003,7 @@ sub backup
# This basically does our backup for us...
find (
{
{
preprocess => \&backup_preprocess,
wanted => \&backup_process,
postprocess => \&backup_postprocess
......@@ -1016,7 +1016,7 @@ sub backup
my @rmlist;
# Total item by item
find (
{
{
wanted => sub { },
# We just need post processing ...
postprocess => sub {
......@@ -1129,7 +1129,7 @@ sub restore
if ( ! -f "$source/$path/dbackup$seq.tar$tarExt" ) {
# If we have any other part of the backup, show a message
if (
( -f "$source/$path/dbackup$seq.index" ||
( -f "$source/$path/dbackup$seq.index" ||
-f "$source/$path/dbackup$seq.manifest" ||
-f "$source/$path/dbackup$seq.snar" ) && $seq > 0
) {
......@@ -1192,7 +1192,7 @@ sub restore
# Change dir and start backup
system(
"tar",
"tar",
"--extract",
# Output file
"--file", "$source/$path/dbackup$seq.tar$tarExt",
......@@ -1299,7 +1299,7 @@ sub restore
# This basically does our backup for us...
find (
{
{
preprocess => \&restore_preprocess,
wanted => \&restore_process,
postprocess => \&restore_postprocess
......@@ -1365,7 +1365,7 @@ Usage: $0 [args] <src> <dst>
--exclude-path=pcre PCRE to exclude paths from backup.
--exclude-file=pcre PCRE to exclude files from backup.
--exclude-fs-type=fstype Filesystem type to exclude.
--data-dir=dir Add an additional data directory.
......@@ -1391,7 +1391,7 @@ Builtins:
data-dirs:
$dataDirStr
EOF
}
}
#
......@@ -1404,7 +1404,7 @@ sub loadStateFile {
# Read in backup state file, we do it here because we may not have a backup file
# to restore
my $gz = gzopen($statefile,"rb")
my $gz = gzopen($statefile,"rb")
or die "FATAL ERROR: Failed to open '$statefile': $!";
# Read in file list
my $line;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment