]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- added mount and umount command (so far secret)
authorArvin Schnell <aschnell@suse.de>
Wed, 3 Aug 2011 09:07:40 +0000 (11:07 +0200)
committerArvin Schnell <aschnell@suse.de>
Wed, 3 Aug 2011 09:07:40 +0000 (11:07 +0200)
tools/snapper.cc

index fa280d40ea6c82c2e4fe32766b3a12946e737b20..eea1100cd955d76510625d7578ad30a7e84469d9 100644 (file)
@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2011 Novell, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as published
+ * by the Free Software Foundation.
+ *
+ * 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, contact Novell, Inc.
+ *
+ * To contact Novell about this file by physical or electronic mail, you may
+ * find current contact information at www.novell.com.
+ */
+
 
 #include <stdlib.h>
 #include <string.h>
@@ -451,6 +472,60 @@ command_delete()
 }
 
 
+void
+help_mount()
+{
+    cout << _("  Mount snapshot:") << endl
+        << _("\tsnapper mount <number>") << endl
+        << endl;
+}
+
+
+void
+command_mount()
+{
+    getopts.parse("mount", GetOpts::no_options);
+    if (!getopts.hasArgs())
+    {
+       cerr << _("Command 'mount' needs at least one argument.") << endl;
+       exit(EXIT_FAILURE);
+    }
+
+    while (getopts.hasArgs())
+    {
+       Snapshots::iterator snapshot = readNum(getopts.popArg());
+       snapshot->mountFilesystemSnapshot();
+    }
+}
+
+
+void
+help_umount()
+{
+    cout << _("  Umount snapshot:") << endl
+        << _("\tsnapper umount <number>") << endl
+        << endl;
+}
+
+
+void
+command_umount()
+{
+    getopts.parse("mount", GetOpts::no_options);
+    if (!getopts.hasArgs())
+    {
+       cerr << _("Command 'mount' needs at least one argument.") << endl;
+       exit(EXIT_FAILURE);
+    }
+
+    while (getopts.hasArgs())
+    {
+       Snapshots::iterator snapshot = readNum(getopts.popArg());
+       snapshot->umountFilesystemSnapshot();
+    }
+}
+
+
 void
 help_diff()
 {
@@ -704,6 +779,8 @@ command_help()
     help_create();
     help_modify();
     help_delete();
+    // help_mount();   // secret until ext4 finished
+    // help_umount();  // secret until ext4 finished
     help_diff();
     help_rollback();
     help_cleanup();
@@ -755,6 +832,8 @@ main(int argc, char** argv)
     cmds["create"] = command_create;
     cmds["modify"] = command_modify;
     cmds["delete"] = command_delete;
+    cmds["mount"] = command_mount;
+    cmds["umount"] = command_umount;
     cmds["diff"] = command_diff;
     cmds["rollback"] = command_rollback;
     cmds["cleanup"] = command_cleanup;