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

Contents of /rpms/e-smith-devtools/sme10/e-smith-devtools-2.6.0-bz11993-backup.patch

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


Revision 1.3 - (show annotations) (download)
Sat Jul 30 04:30:09 2022 UTC (21 months, 2 weeks ago) by jpp
Branch: MAIN
CVS Tags: e-smith-devtools-2_6_0-14_el7_sme, HEAD
Changes since 1.2: +3 -7 lines
* Fri Jul 29 2022 Jean-Philippe Pialasse <tests@pialasse.com> 2.6.0-14.sme
- remove duplication with Dar backup [SME: 11993]

1 diff -Nur --no-dereference e-smith-devtools-2.6.0.old/Backup.pm e-smith-devtools-2.6.0/Backup.pm
2 --- e-smith-devtools-2.6.0.old/Backup.pm 1969-12-31 19:00:00.000000000 -0500
3 +++ e-smith-devtools-2.6.0/Backup.pm 2022-07-30 00:28:03.796000000 -0400
4 @@ -0,0 +1,116 @@
5 +#----------------------------------------------------------------------
6 +# copyright (C) 2013-2022 Koozali Foundation
7 +#
8 +# This program is free software; you can redistribute it and/or modify
9 +# it under the terms of the GNU General Public License as published by
10 +# the Free Software Foundation; either version 2 of the License, or
11 +# (at your option) any later version.
12 +#
13 +# This program is distributed in the hope that it will be useful,
14 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
15 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 +# GNU General Public License for more details.
17 +#
18 +# You should have received a copy of the GNU General Public License
19 +# along with this program; if not, write to the Free Software
20 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 +#
22 +#----------------------------------------------------------------------
23 +package esmith::Build::Backup;
24 +
25 +use strict;
26 +use warnings;
27 +use Exporter;
28 +use File::Basename;
29 +use File::Path;
30 +
31 +our @ISA = qw(Exporter);
32 +our @EXPORT = qw();
33 +our @EXPORT_OK = qw(
34 + backup_excludes
35 + backup_includes
36 + );
37 +our %EXPORT_TAGS = (
38 + all => [ qw!backup_excludes backup_includes! ]
39 + );
40 +
41 +our $VERSION = sprintf '%d.%03d', q$Revision: 1.2 $ =~ /: (\d+).(\d+)/;
42 +
43 +=head1 NAME
44 +
45 +esmith::Build::Backup - A library for creating backup include and exclude during rpm construction.
46 +
47 +=head1 SYNOPSIS
48 +
49 + use esmith::Build::Backup qw(:all);
50 +
51 + backup_includes("smeserver-ContribName", qw(/list/of/path /you/need/to /include/to /backup));
52 +
53 +=head1 DESCRIPTION
54 +
55 +=cut
56 +
57 +=head2 backup_includes
58 +
59 +This function populates both /etc/backup-data.d/ for core console backup and template for
60 +/etc/dar/DailyBackup.dcf which is dar workstation backup file, if the directories do
61 +not exist, it will create them.
62 +
63 + ie. backup_includes("smeserver-ContribName", qw(/list/of/path /you/need/to /include/to /backup))
64 +
65 +=cut
66 +sub backup_includes
67 +{
68 + my ($name, @paths) = @_;
69 + my $core = "root/etc/backup-data.d";
70 + my $corefilename = "$core/${name}.include";
71 +
72 + unless (-d $core)
73 + {
74 + mkpath $core or die "Could not create dir $core: $!";
75 + }
76 +
77 + open(CFH, '>', $corefilename) or die $!;
78 + foreach my $str (@paths)
79 + {
80 + $str =~ s|/$||;
81 + print CFH "$str\n";
82 + }
83 + close(CFH);
84 + # add template expand to smeserver-ContribName-update
85 + use esmith::Build::CreateLinks qw(templates2events);
86 + templates2events("/etc/dar/DailyBackup.dcf","${name}-update");
87 +}
88 +
89 +=head2 backup_excludes
90 +
91 +This function populates both /etc/backup-data.d/ for core console backup and template for
92 +/etc/dar/DailyBackup.dcf which is dar workstation backup file, if the directories do
93 +not exist, it will create them.
94 +
95 + ie. backup_excludes("smeserver-ContribName", qw(/list/of/path /you/need/to /exclude/from /backup))
96 +
97 +=cut
98 +sub backup_excludes
99 +{
100 + my ($name, @paths) = @_;
101 + my $core = "root/etc/backup-data.d";
102 + my $corefilename = "$core/${name}.exclude";
103 +
104 + unless (-d $core)
105 + {
106 + mkpath $core or die "Could not create dir $core: $!";
107 + }
108 +
109 + open(CFH, '>', $corefilename) or die $!;
110 + foreach my $str (@paths)
111 + {
112 + $str =~ s|/$||;
113 + print CFH "$str\n";
114 + }
115 + close(CFH);
116 + # add template expand to smeserver-ContribName-update
117 + use esmith::Build::CreateLinks qw(templates2events);
118 + templates2events("/etc/dar/DailyBackup.dcf","${name}-update");
119 +}
120 +

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