/[smeserver]/rpms/e-smith-backup/sme9/e-smith-backup-2.4.0-workstation-allowMounted1.patch
ViewVC logotype

Contents of /rpms/e-smith-backup/sme9/e-smith-backup-2.4.0-workstation-allowMounted1.patch

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


Revision 1.1 - (show annotations) (download)
Sat Apr 19 18:24:19 2014 UTC (10 years, 7 months ago) by wellsi
Branch: MAIN
CVS Tags: e-smith-backup-2_4_0-32_el6_sme, e-smith-backup-2_4_0-42_el6_sme, e-smith-backup-2_4_0-38_el6_sme, e-smith-backup-2_4_0-46_el6_sme, e-smith-backup-2_4_0-34_el6_sme, e-smith-backup-2_4_0-35_el6_sme, e-smith-backup-2_4_0-36_el6_sme, e-smith-backup-2_4_0-44_el6_sme, e-smith-backup-2_4_0-37_el6_sme, e-smith-backup-2_4_0-33_el6_sme, e-smith-backup-2_4_0-41_el6_sme, e-smith-backup-2_4_0-39_el6_sme, e-smith-backup-2_4_0-45_el6_sme, e-smith-backup-2_4_0-40_el6_sme, e-smith-backup-2_4_0-43_el6_sme, HEAD
* Sat Apr 19 2014 Ian Wells <esmith@wellsi.com> 2.4.0-32.sme
- Allow workstation backup to mounted drive [SME: 8144]

1 diff -ruN e-smith-backup-2.4.0.tmp/root/etc/e-smith/events/actions/workstation-backup-dar e-smith-backup-2.4.0/root/etc/e-smith/events/actions/workstation-backup-dar
2 --- e-smith-backup-2.4.0.tmp/root/etc/e-smith/events/actions/workstation-backup-dar 2014-04-19 10:43:57.000000000 -0700
3 +++ e-smith-backup-2.4.0/root/etc/e-smith/events/actions/workstation-backup-dar 2014-04-19 10:53:49.000000000 -0700
4 @@ -63,7 +63,8 @@
5 my $mail = $backupwk->prop('MailNotify') || 'yes';
6 my $frommail = $backupwk->prop('FromMail') || 'admin-backup';
7 my $tomail = $backupwk->prop('ToMail') || 'admin';
8 -my $mntdir = ($VFSType eq 'usb') ? "\/$smbshare" : $backupwk->prop('Mount') || '/mnt/smb';
9 +my $mntdir = $backupwk->prop('Mount') || '/mnt/smb';
10 +$mntdir = "\/$smbshare" if ($VFSType eq 'usb'); # ToDo change to $backupwk->prop('Mount')
11 my $deleteearly = $backupwk->prop('DeleteEarly') || 'false';
12
13 my $report = "From: $frommail\n";
14 @@ -77,33 +78,8 @@
15 # ping the SMB Host to see if it is awake
16 $report .= wol ($ether,$smbhost,$smbhostmac,$smbhostdelay);
17
18 -# verify backup directory not already mounted
19 -if (!checkMount ($mntdir))
20 -{
21 - ldie("Seems backup directory is already mounted. " .
22 - "It should not happen and maybe there is a zombie process " .
23 - "you must kill, or another backup in progress. \n");
24 -}
25 -
26 -# create the directory mount point if it does not exist
27 -createTree ($mntdir);
28 -
29 -# mount the backup directory
30 -my $err = dmount($smbhost,$smbshare,$mntdir,$login,$password,$VFSType);
31 -ldie("Error while mounting <//$smbhost/$smbshare>\n" . $err) if $err;
32 -
33 -# verify $mntdir is mounted
34 -if (checkMount ($mntdir))
35 -{
36 - # The mount should have suceeded, but sometimes it needs more time,
37 - # so sleep and then check again.
38 - sleep 5;
39 - if (checkMount ($mntdir))
40 - {
41 - ldie("Seems backup directory is not really mounted. It should not happen. \
42 - Verify availability of your backup volume. Stopping the backup now.\n");
43 - }
44 -}
45 +# mount backup
46 +bmount($mntdir,$smbhost,$smbshare,$VFSType);
47
48 # rotating backup indicators
49 $incnum++;
50 @@ -228,7 +204,7 @@
51 }
52
53 # unmount shared folder
54 -system("/bin/umount", "-f", "$mntdir");
55 +system("/bin/umount", "-f", "$mntdir") unless ($VFSType eq 'mnt');
56
57 # time now to update backup configuration
58 $backupwk->set_prop('SetNum', $setnum);
59 @@ -251,7 +227,10 @@
60 {
61 sendReport ($report,$errmsg);
62 }
63 - system("/bin/umount", "$mntdir") if (!checkMount ($mntdir));
64 + if (($VFSType ne 'mnt') && (!checkMount ($mntdir)))
65 + {
66 + system("/bin/umount", "-f", "$mntdir");
67 + }
68 die($errmsg);
69 }
70
71 @@ -494,3 +473,45 @@
72 return;
73 }
74
75 +sub bmount
76 +{
77 + my ($mntdir,$host,$share,$VFSType) = @_;
78 + # verify backup directory not already mounted
79 +
80 + if (!checkMount ($mntdir))
81 + {
82 + return if ($VFSType eq 'mnt');
83 + ldie("Seems backup directory is already mounted. " .
84 + "It should not happen and maybe there is a zombie process " .
85 + "you must kill, or another backup in progress. \n");
86 + }
87 + else
88 + {
89 + if ($VFSType eq 'mnt')
90 + {
91 + ldie("Seems backup directory is not mounted. " .
92 + "The backup directory must be mounted when using type 'mnt'. \n");
93 + }
94 + }
95 +
96 + # create the directory mount point if it does not exist
97 + createTree ($mntdir);
98 +
99 + # mount the backup directory
100 + my $err = dmount($host,$share,$mntdir,'','',$VFSType);
101 + ldie("Error while mounting <//$smbhost/$smbshare>\n" . $err) if $err;
102 +
103 + # verify $mntdir is mounted
104 + if (checkMount ($mntdir))
105 + {
106 + # The mount should have suceeded, but sometimes it needs more time,
107 + # so sleep and then check again.
108 + sleep 5;
109 + if (checkMount ($mntdir))
110 + {
111 + ldie("Seems backup directory is not really mounted. It should not happen. \
112 + Verify availability of your backup volume. Stopping the backup now.\n");
113 + }
114 + }
115 + return;
116 +}

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