Mailinglist Archive: yast-commit (502 mails)
| < Previous | Next > |
[yast-commit] r64566 - in /branches/SuSE-Code-11-SP1-Branch/backup: VERSION package/yast2-backup.changes src/Backup.ycp src/ui.ycp
- From: locilka@xxxxxxxxxxxxxxxxx
- Date: Thu, 23 Jun 2011 14:43:39 -0000
- Message-id: <20110623144340.32D7932641@svn2.opensuse.org>
Author: locilka
Date: Thu Jun 23 16:43:39 2011
New Revision: 64566
URL: http://svn.opensuse.org/viewcvs/yast?rev=64566&view=rev
Log:
- Fixed handling /etc/mtab while creating backup archive on NFS
share. Archive must contain the mtab file without a temporary
NFS entry, otherwise it breaks during restoration (BNC #675259).
- 2.17.10
Modified:
branches/SuSE-Code-11-SP1-Branch/backup/VERSION
branches/SuSE-Code-11-SP1-Branch/backup/package/yast2-backup.changes
branches/SuSE-Code-11-SP1-Branch/backup/src/Backup.ycp
branches/SuSE-Code-11-SP1-Branch/backup/src/ui.ycp
Modified: branches/SuSE-Code-11-SP1-Branch/backup/VERSION
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/backup/VERSION?rev=64566&r1=64565&r2=64566&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/backup/VERSION (original)
+++ branches/SuSE-Code-11-SP1-Branch/backup/VERSION Thu Jun 23 16:43:39 2011
@@ -1 +1 @@
-2.17.9
+2.17.10
Modified: branches/SuSE-Code-11-SP1-Branch/backup/package/yast2-backup.changes
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/backup/package/yast2-backup.changes?rev=64566&r1=64565&r2=64566&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/backup/package/yast2-backup.changes
(original)
+++ branches/SuSE-Code-11-SP1-Branch/backup/package/yast2-backup.changes Thu
Jun 23 16:43:39 2011
@@ -1,4 +1,12 @@
------------------------------------------------------------------
+Thu Jun 23 16:39:40 CEST 2011 - locilka@xxxxxxx
+
+- Fixed handling /etc/mtab while creating backup archive on NFS
+ share. Archive must contain the mtab file without a temporary
+ NFS entry, otherwise it breaks during restoration (BNC #675259).
+- 2.17.10
+
+------------------------------------------------------------------
Fri Jan 7 14:17:26 CET 2011 - locilka@xxxxxxx
- Excluding '/var/lib/ntp/proc' directory and filesystem type
Modified: branches/SuSE-Code-11-SP1-Branch/backup/src/Backup.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/backup/src/Backup.ycp?rev=64566&r1=64565&r2=64566&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/backup/src/Backup.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/backup/src/Backup.ycp Thu Jun 23 16:43:39
2011
@@ -30,6 +30,8 @@
import "FileUtils";
import "String";
import "Service";
+import "Directory";
+import "String";
include "backup/functions.ycp";
@@ -459,13 +461,90 @@
}
/**
+ * When creating backup on NFS share, /etc/mtab is modified after mounting the
NFS
+ * share to a temporary directory. This causes problems later after restoring
+ * the backup because mountpoint was only temporary and doesn't exist anymore.
+ *
+ * See BNC #675259
+ */
+string temporary_mtab_file = sformat("%1/temporary_mtab_file",
Directory::tmpdir);
+string mtab_file = "/etc/mtab";
+
+/**
+ * Stores the content of /etc/mtab to a 'safe place'
+ */
+boolean BackupMtab () {
+ // nothing to backup
+ if (! FileUtils::Exists (mtab_file)) {
+ y2error ("There is no mtab file!");
+ return false;
+ }
+
+ y2milestone ("Creating backup of %1 to %2\n---\n%3\n---",
+ mtab_file, temporary_mtab_file,
+ SCR::Execute (.target.bash_output, sformat ("cat '%1'", String::Quote
(mtab_file)))
+ );
+
+ // creating backup by `cat` - the original file attributes are kept intact
+ if ((integer) SCR::Execute (.target.bash,
+ sformat ("cat '%1' > '%2'", String::Quote (mtab_file), String::Quote
(temporary_mtab_file))
+ ) != 0) {
+ y2error ("Cannot backup %1 to %2", mtab_file, temporary_mtab_file);
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Restores the original content of /etc/mtab
+ */
+boolean RestoreMtab () {
+ // nothing to restore from
+ if (! FileUtils::Exists (temporary_mtab_file)) {
+ y2error ("There is no mtab file (%1) to restore", temporary_mtab_file);
+ return false;
+ }
+
+ y2milestone ("Restoring backup of %1 from %2", mtab_file,
temporary_mtab_file);
+
+ // restoring by `cat` - the original file attributes are kept intact
+ if ((integer) SCR::Execute (.target.bash,
+ sformat ("cat '%1' > '%2'", String::Quote (temporary_mtab_file),
String::Quote (mtab_file))
+ ) != 0) {
+ y2error ("Cannot restore content of %1 to %2", temporary_mtab_file,
mtab_file);
+ return false;
+ }
+
+ y2milestone ("Current %1 file contains\n---\n%2\n---",
+ mtab_file,
+ SCR::Execute (.target.bash_output, sformat ("cat '%1'", String::Quote
(mtab_file)))
+ );
+
+ // cleaning up
+ if ((integer) SCR::Execute (.target.bash, sformat ("rm -f '%1'",
temporary_mtab_file)) != 0) {
+ y2error ("Cannot remove temporary mtab file %1", temporary_mtab_file);
+ return false;
+ }
+
+ return true;
+}
+
+/**
* Pre-backup function - mount NFS share if required
* @return boolean true on success
*/
global define boolean PrepareBackup() ``{
if (target_type == `nfs && nfsmount == nil)
{
+ // BNC #675259: Backup /etc/mtab before it's changed by mounting a NFS
share
+ BackupMtab();
+
nfsmount = Nfs::Mount(nfsserver, nfsexport, nil, "", "");
+
+ // BNC #675259: Restore backup of /etc/mtab before the backup archive
is created
+ RestoreMtab();
+
return nfsmount != nil;
}
Modified: branches/SuSE-Code-11-SP1-Branch/backup/src/ui.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/backup/src/ui.ycp?rev=64566&r1=64565&r2=64566&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/backup/src/ui.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/backup/src/ui.ycp Thu Jun 23 16:43:39 2011
@@ -932,14 +932,17 @@
continue;
}
- string dir = substring(Backup::archive_name, 0,
findlastof(Backup::archive_name, "/"));
- // testing if the directory exists or if it is possible to
create it
- string error_message = IsPossibleToCreateDirectoryOrExists(dir);
- if (error_message != "") {
+ if (regexpmatch (Backup::archive_name, "/")) {
+ string dir = substring (Backup::archive_name, 0, findlastof
(Backup::archive_name, "/"));
+
+ // testing if the directory exists or if it is possible to
create it
+ string error_message = IsPossibleToCreateDirectoryOrExists
(dir);
+ if (error_message != "") {
Popup::Error(error_message);
-
- cont = false;
- continue;
+
+ cont = false;
+ continue;
+ }
}
if (!Backup::multi_volume)
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
Date: Thu Jun 23 16:43:39 2011
New Revision: 64566
URL: http://svn.opensuse.org/viewcvs/yast?rev=64566&view=rev
Log:
- Fixed handling /etc/mtab while creating backup archive on NFS
share. Archive must contain the mtab file without a temporary
NFS entry, otherwise it breaks during restoration (BNC #675259).
- 2.17.10
Modified:
branches/SuSE-Code-11-SP1-Branch/backup/VERSION
branches/SuSE-Code-11-SP1-Branch/backup/package/yast2-backup.changes
branches/SuSE-Code-11-SP1-Branch/backup/src/Backup.ycp
branches/SuSE-Code-11-SP1-Branch/backup/src/ui.ycp
Modified: branches/SuSE-Code-11-SP1-Branch/backup/VERSION
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/backup/VERSION?rev=64566&r1=64565&r2=64566&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/backup/VERSION (original)
+++ branches/SuSE-Code-11-SP1-Branch/backup/VERSION Thu Jun 23 16:43:39 2011
@@ -1 +1 @@
-2.17.9
+2.17.10
Modified: branches/SuSE-Code-11-SP1-Branch/backup/package/yast2-backup.changes
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/backup/package/yast2-backup.changes?rev=64566&r1=64565&r2=64566&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/backup/package/yast2-backup.changes
(original)
+++ branches/SuSE-Code-11-SP1-Branch/backup/package/yast2-backup.changes Thu
Jun 23 16:43:39 2011
@@ -1,4 +1,12 @@
------------------------------------------------------------------
+Thu Jun 23 16:39:40 CEST 2011 - locilka@xxxxxxx
+
+- Fixed handling /etc/mtab while creating backup archive on NFS
+ share. Archive must contain the mtab file without a temporary
+ NFS entry, otherwise it breaks during restoration (BNC #675259).
+- 2.17.10
+
+------------------------------------------------------------------
Fri Jan 7 14:17:26 CET 2011 - locilka@xxxxxxx
- Excluding '/var/lib/ntp/proc' directory and filesystem type
Modified: branches/SuSE-Code-11-SP1-Branch/backup/src/Backup.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/backup/src/Backup.ycp?rev=64566&r1=64565&r2=64566&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/backup/src/Backup.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/backup/src/Backup.ycp Thu Jun 23 16:43:39
2011
@@ -30,6 +30,8 @@
import "FileUtils";
import "String";
import "Service";
+import "Directory";
+import "String";
include "backup/functions.ycp";
@@ -459,13 +461,90 @@
}
/**
+ * When creating backup on NFS share, /etc/mtab is modified after mounting the
NFS
+ * share to a temporary directory. This causes problems later after restoring
+ * the backup because mountpoint was only temporary and doesn't exist anymore.
+ *
+ * See BNC #675259
+ */
+string temporary_mtab_file = sformat("%1/temporary_mtab_file",
Directory::tmpdir);
+string mtab_file = "/etc/mtab";
+
+/**
+ * Stores the content of /etc/mtab to a 'safe place'
+ */
+boolean BackupMtab () {
+ // nothing to backup
+ if (! FileUtils::Exists (mtab_file)) {
+ y2error ("There is no mtab file!");
+ return false;
+ }
+
+ y2milestone ("Creating backup of %1 to %2\n---\n%3\n---",
+ mtab_file, temporary_mtab_file,
+ SCR::Execute (.target.bash_output, sformat ("cat '%1'", String::Quote
(mtab_file)))
+ );
+
+ // creating backup by `cat` - the original file attributes are kept intact
+ if ((integer) SCR::Execute (.target.bash,
+ sformat ("cat '%1' > '%2'", String::Quote (mtab_file), String::Quote
(temporary_mtab_file))
+ ) != 0) {
+ y2error ("Cannot backup %1 to %2", mtab_file, temporary_mtab_file);
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Restores the original content of /etc/mtab
+ */
+boolean RestoreMtab () {
+ // nothing to restore from
+ if (! FileUtils::Exists (temporary_mtab_file)) {
+ y2error ("There is no mtab file (%1) to restore", temporary_mtab_file);
+ return false;
+ }
+
+ y2milestone ("Restoring backup of %1 from %2", mtab_file,
temporary_mtab_file);
+
+ // restoring by `cat` - the original file attributes are kept intact
+ if ((integer) SCR::Execute (.target.bash,
+ sformat ("cat '%1' > '%2'", String::Quote (temporary_mtab_file),
String::Quote (mtab_file))
+ ) != 0) {
+ y2error ("Cannot restore content of %1 to %2", temporary_mtab_file,
mtab_file);
+ return false;
+ }
+
+ y2milestone ("Current %1 file contains\n---\n%2\n---",
+ mtab_file,
+ SCR::Execute (.target.bash_output, sformat ("cat '%1'", String::Quote
(mtab_file)))
+ );
+
+ // cleaning up
+ if ((integer) SCR::Execute (.target.bash, sformat ("rm -f '%1'",
temporary_mtab_file)) != 0) {
+ y2error ("Cannot remove temporary mtab file %1", temporary_mtab_file);
+ return false;
+ }
+
+ return true;
+}
+
+/**
* Pre-backup function - mount NFS share if required
* @return boolean true on success
*/
global define boolean PrepareBackup() ``{
if (target_type == `nfs && nfsmount == nil)
{
+ // BNC #675259: Backup /etc/mtab before it's changed by mounting a NFS
share
+ BackupMtab();
+
nfsmount = Nfs::Mount(nfsserver, nfsexport, nil, "", "");
+
+ // BNC #675259: Restore backup of /etc/mtab before the backup archive
is created
+ RestoreMtab();
+
return nfsmount != nil;
}
Modified: branches/SuSE-Code-11-SP1-Branch/backup/src/ui.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/backup/src/ui.ycp?rev=64566&r1=64565&r2=64566&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/backup/src/ui.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/backup/src/ui.ycp Thu Jun 23 16:43:39 2011
@@ -932,14 +932,17 @@
continue;
}
- string dir = substring(Backup::archive_name, 0,
findlastof(Backup::archive_name, "/"));
- // testing if the directory exists or if it is possible to
create it
- string error_message = IsPossibleToCreateDirectoryOrExists(dir);
- if (error_message != "") {
+ if (regexpmatch (Backup::archive_name, "/")) {
+ string dir = substring (Backup::archive_name, 0, findlastof
(Backup::archive_name, "/"));
+
+ // testing if the directory exists or if it is possible to
create it
+ string error_message = IsPossibleToCreateDirectoryOrExists
(dir);
+ if (error_message != "") {
Popup::Error(error_message);
-
- cont = false;
- continue;
+
+ cont = false;
+ continue;
+ }
}
if (!Backup::multi_volume)
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
| < Previous | Next > |