~teejee2008/timeshift/trunk

276 by Tony George
fstab and crypttab files will be updated correctly on target system when system is restored or cloned
1
using TeeJee.Logging;
2
using TeeJee.FileSystem;
3
using TeeJee.Devices;
4
using TeeJee.JsonHelper;
5
using TeeJee.ProcessHelper;
6
using TeeJee.GtkHelper;
7
using TeeJee.System;
8
using TeeJee.Misc;
9
using Json;
10
11
public class MountEntry : GLib.Object{
12
	public Device device = null;
13
	public string mount_point = "";
14
	public string mount_options = "";
15
	
16
	public MountEntry(Device? device, string mount_point, string mount_options){
17
		this.device = device;
18
		this.mount_point = mount_point;
19
		this.mount_options = mount_options;
20
	}
21
22
	public string subvolume_name(){
23
		if (mount_options.contains("subvol=")){
24
			return mount_options.split("subvol=")[1].split(",")[0].strip();
25
		}
26
		else{
27
			return "";
28
		}
29
	}
30
31
	public static MountEntry? find_entry_by_mount_point(
32
		Gee.ArrayList<MountEntry> entries, string mount_path){
33
			
34
		foreach(var entry in entries){
35
			if (entry.mount_point == mount_path){
36
				return entry;
37
			}
38
		}
39
		return null;
40
	}
41
}