/[smeserver]/rpms/e-smith-backup/sme10/e-smith-backup-2.6.0.Add_Or_Remove_Path_In_Backup.patch
ViewVC logotype

Annotation of /rpms/e-smith-backup/sme10/e-smith-backup-2.6.0.Add_Or_Remove_Path_In_Backup.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (hide annotations) (download)
Fri Jan 8 18:54:31 2021 UTC (3 years, 5 months ago) by jpp
Branch: MAIN
CVS Tags: e-smith-backup-2_6_0-24_el7_sme, e-smith-backup-2_6_0-19_el7_sme, e-smith-backup-2_6_0-29_el7_sme, e-smith-backup-2_6_0-20_el7_sme, e-smith-backup-2_6_0-23_el7_sme, e-smith-backup-2_6_0-21_el7_sme, e-smith-backup-2_6_0-28_el7_sme, e-smith-backup-2_6_0-22_el7_sme, e-smith-backup-2_6_0-27_el7_sme, e-smith-backup-2_6_0-25_el7_sme, e-smith-backup-2_6_0-26_el7_sme, HEAD
Changes since 1.3: +0 -0 lines
* Fri Jan 08 2021 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-19.sme
- add update event [SME: 11124]

1 stephdl 1.2 diff -Nur e-smith-backup-2.6.0.old/root/etc/backup-data.d/backup.exclude e-smith-backup-2.6.0.new/root/etc/backup-data.d/backup.exclude
2     --- e-smith-backup-2.6.0.old/root/etc/backup-data.d/backup.exclude 1970-01-01 01:00:00.000000000 +0100
3     +++ e-smith-backup-2.6.0.new/root/etc/backup-data.d/backup.exclude 2016-07-28 11:34:23.176591482 +0200
4     @@ -0,0 +1,2 @@
5     +# All folder/file paths added here will NOT be saved
6     +# For Example : /usr/share/wordpress/config
7     diff -Nur e-smith-backup-2.6.0.old/root/etc/backup-data.d/backup.include e-smith-backup-2.6.0.new/root/etc/backup-data.d/backup.include
8     --- e-smith-backup-2.6.0.old/root/etc/backup-data.d/backup.include 1970-01-01 01:00:00.000000000 +0100
9     +++ e-smith-backup-2.6.0.new/root/etc/backup-data.d/backup.include 2016-07-28 11:34:09.967619535 +0200
10     @@ -0,0 +1,2 @@
11     +# All folder/file paths added here will be saved
12     +# For Example : /usr/share/wordpress
13 stephdl 1.1 diff -Nur e-smith-backup-2.6.0.old/root/usr/share/perl5/vendor_perl/esmith/Backup.pm e-smith-backup-2.6.0.new/root/usr/share/perl5/vendor_perl/esmith/Backup.pm
14     --- e-smith-backup-2.6.0.old/root/usr/share/perl5/vendor_perl/esmith/Backup.pm 2016-02-05 00:08:22.000000000 +0100
15     +++ e-smith-backup-2.6.0.new/root/usr/share/perl5/vendor_perl/esmith/Backup.pm 2016-07-27 03:49:04.109295338 +0200
16     @@ -19,15 +19,37 @@
17    
18     @ISA = qw(Exporter);
19    
20     +#path to *.include/*.exclude files
21     +my $BackupDir = '/etc/backup-data.d/';
22     +
23     =head1 NAME
24    
25     esmith::Backup - interface to server backup/restore information
26    
27     =head1 SYNOPSIS
28    
29     + # When you want to add or remove files/folders
30     + # in your backup, make files in /etc/backup-data.d
31     + # with one or several path name inside (one per line)
32     + # eg : /opt/myContrib
33     + # /usr/share/myContrib
34     + #
35     + # FileName.include -> add more files/folders
36     + # FileName.exclude -> remove files/folder
37     +
38     use esmith::Backup;
39     my $backup = new esmith::Backup;
40    
41     + #retrieve the list of your backup exclusions
42     + my @backup_excludes = $backup->excludes;
43     + #or
44     + my @backup_excludes = esmith::Backup->excludes;
45     +
46     + # retrieve the list of your backup inclusions
47     + my @backup_list = $backup->restore_list;
48     + #or
49     + my @backup_list = esmith::Backup->restore_list;
50     +
51     =head1 DESCRIPTION
52    
53     This module provides an abstracted interface to the backup/restore
54     @@ -70,7 +92,7 @@
55     {
56     my ($self) = @_;
57    
58     - return (
59     + my @backup = (
60     'home/e-smith',
61     'etc/e-smith/templates-custom',
62     'etc/e-smith/templates-user-custom',
63     @@ -84,8 +106,102 @@
64     'etc/samba/secrets.tdb',
65     'etc/samba/smbpasswd',
66     );
67     + #add all paths in .include files
68     + push @backup, $self->includes;
69     + return @backup;
70     }
71    
72     +
73     +=head2 uniq
74     +
75     +Remove all duplicates from the given array.
76     +
77     +=cut
78     +
79     +sub uniq {
80     + return keys %{{ map { $_ => 1 } @_ }};
81     +}
82     +
83     +
84     +=head2 load_file_list
85     +
86     +head2 load_file_list
87     +Given a file name, return all lines in an array.
88     +
89     +=cut
90     +
91     +sub load_file_list
92     +{
93     + my ($self, $file) = @_;
94     + my @paths;
95     + open (FILE, $file) or die 'Unable to open the list file: $file';
96     +
97     + while (<FILE>) {
98     +
99     + #sanitise the line
100     + s/^\s+|\s+$//g;
101     + s/^\/+|\/+$|\n+//g;
102     + s/\/+/\//g;
103     + #we don't want blank line or space
104     + next if /^$|\s+/;
105     + # we don't want some characters
106     + next if /`|'|"|;|&|\||#|\\|:|\*|<|>/;
107     +
108     + push(@paths, $_);
109     + }
110     + close(FILE);
111     +
112     + return @paths;
113     +}
114     +
115     +
116     +=head2 load_files_from_dir
117     +
118     +Given a directory and an extension, return all lines
119     +from all files using load_file_list function.
120     +
121     +=cut
122     +sub load_files_from_dir
123     +{
124     + my ($self, $dir, $extension ) = @_;
125     + my @ret;
126     + my @files = <$dir*.$extension>;
127     + foreach my $file (@files) {
128     + push(@ret,$self->load_file_list($file));
129     + }
130     + return @ret;
131     +}
132     +
133     +=head2 includes
134     +
135     +Takes a directory as argument.
136     +Returns a list of files from all .include files inside the given directory.
137     +All duplicates are removed.
138     +
139     +=cut
140     +
141     +sub includes
142     +{
143     + my ($self) = @_;
144     + return uniq($self->load_files_from_dir($BackupDir,'include'));
145     +}
146     +
147     +
148     +=head2 excludes
149     +
150     +Takes a directory as argument.
151     +Returns a list of files from all .exclude files inside the given directory.
152     +All duplicates are removed.
153     +
154     +=cut
155     +
156     +sub excludes
157     +{
158     + my ($self) = @_;
159     + return uniq($self->load_files_from_dir($BackupDir,'exclude'));
160     +}
161     +
162     +
163     =head2 merge_passwd
164    
165     Merge password files. Takes a filename of a restored password

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed