36 public static double KB = 1000;
37 public static double MB = 1000 *
KB;
38 public static double GB = 1000 *
MB;
40 public static double KiB = 1024;
41 public static double MiB = 1024 *
KiB;
42 public static double GiB = 1024 *
MiB;
96 symlinks =
new Gee.ArrayList<
string>();
108 string std_out, std_err;
109 int status =
exec_sync(
"lsblk --bytes --pairs --output HOTPLUG,PKNAME,VENDOR,SERIAL,REV", out std_out, out std_err);
161 if (mnt.mount_point == mount_path){
162 if (subvolname.length == 0){
165 else if (mnt.mount_options.contains(
"subvol=%s".printf(subvolname))
166 || mnt.mount_options.contains(
"subvol=/%s".printf(subvolname))){
217 return (
type ==
"part") &&
fstype.down().contains(
"luks");
221 return (
type ==
"crypt");
225 return (
type ==
"part") &&
fstype.down().contains(
"lvm2_member");
235 if (child.has_linux_filesystem()){
259 foreach(var dev_df
in list_df){
262 dev.size_bytes = dev_df.size_bytes;
263 dev.used_bytes = dev_df.used_bytes;
264 dev.available_bytes = dev_df.available_bytes;
265 dev.used_percent = dev_df.used_percent;
273 foreach(var dev_mtab
in list_mtab){
276 dev.mount_points = dev_mtab.mount_points;
285 log_debug(
"Device: get_filesystems(): %d".printf(list.size));
292 foreach (var part
in list){
302 foreach (var part
in list){
313 if (dev.
pkname.length == 0){
return; }
315 var top_kname = dev.
pkname;
317 foreach (var part
in list){
318 if (part.kname == top_kname){
319 if (part.pkname.length > 0){
320 top_kname = part.pkname;
325 dev.pkname_toplevel = top_kname;
332 string std_out, std_err;
333 exec_sync(
"dmsetup deps -o blkdevname", out std_out, out std_err);
344 foreach(
string line
in std_out.split(
"\n")){
345 if (line.strip().length == 0) {
continue; }
349 rex =
new Regex(
"""([^:]*)\:.*\((.*)\)""");
351 if (rex.match (line, 0, out match)){
353 string child_name = match.fetch(1).strip();
354 string parent_kname = match.fetch(2).strip();
357 foreach(var dev
in list){
358 if ((dev.kname == parent_kname)){
365 foreach(var dev
in list){
366 if ((dev.mapped_name == child_name)){
372 if ((
parent !=
null) && (child !=
null)){
397 for (
int i = list.size - 1; i >= 0; --i) {
399 if (list[i].
pkname !=
"") {
429 var list =
new Gee.ArrayList<
Device>();
439 cmd =
"lsblk --bytes --pairs --output NAME,KNAME,LABEL,UUID,TYPE,FSTYPE,SIZE,MOUNTPOINT,MODEL,RO,RM,MAJ:MIN";
442 cmd =
"lsblk --bytes --pairs --output NAME,KNAME,LABEL,UUID,TYPE,FSTYPE,SIZE,MOUNTPOINT,MODEL,RO,HOTPLUG,MAJ:MIN,PARTLABEL,PARTUUID,PKNAME,VENDOR,SERIAL,REV";
445 if (dev_name.length > 0){
446 cmd +=
" %s".printf(dev_name);
449 ret_val =
exec_sync(cmd, out std_out, out std_err);
472 foreach(
string line
in std_out.split(
"\n")){
473 if (line.strip().length == 0) {
continue; }
477 rex =
new Regex(
"""NAME="(.*)
" KNAME="(.*)
" LABEL="(.*)
" UUID="(.*)
" TYPE="(.*)
" FSTYPE="(.*)
" SIZE="(.*)
" MOUNTPOINT="(.*)
" MODEL="(.*)
" RO="([0-9]+)
" RM="([0-9]+)
" MAJ[_:]MIN="([0-9:]+)
"""");
480 rex =
new Regex(
"""NAME="(.*)
" KNAME="(.*)
" LABEL="(.*)
" UUID="(.*)
" TYPE="(.*)
" FSTYPE="(.*)
" SIZE="(.*)
" MOUNTPOINT="(.*)
" MODEL="(.*)
" RO="([0-9]+)
" HOTPLUG="([0-9]+)
" MAJ[_:]MIN="([0-9:]+)
" PARTLABEL="(.*)
" PARTUUID="(.*)
" PKNAME="(.*)
" VENDOR="(.*)
" SERIAL="(.*)
" REV="(.*)
"""");
483 if (rex.match (line, 0, out match)){
489 pi.name = match.fetch(++pos).strip();
490 pi.kname = match.fetch(++pos).strip();
492 pi.label = match.fetch(++pos);
493 pi.uuid = match.fetch(++pos).strip();
495 pi.type = match.fetch(++pos).strip().down();
497 pi.fstype = match.fetch(++pos).strip().down();
498 pi.fstype = (pi.fstype ==
"crypto_luks") ?
"luks" : pi.
fstype;
499 pi.fstype = (pi.fstype ==
"lvm2_member") ?
"lvm2" : pi.
fstype;
501 pi.size_bytes = int64.parse(match.fetch(++pos).strip());
503 var mp = match.fetch(++pos).strip();
508 pi.model = match.fetch(++pos).strip();
510 pi.read_only = (match.fetch(++pos).strip() ==
"1");
512 pi.removable = (match.fetch(++pos).strip() ==
"1");
514 string txt = match.fetch(++pos).strip();
515 if (txt.contains(
":")){
516 pi.major =
int.parse(txt.split(
":")[0]);
517 pi.minor =
int.parse(txt.split(
":")[1]);
522 pi.partlabel = match.fetch(++pos);
523 pi.partuuid = match.fetch(++pos).strip();
525 pi.pkname = match.fetch(++pos).strip();
526 pi.vendor = match.fetch(++pos).strip();
527 pi.serial = match.fetch(++pos).strip();
528 pi.revision = match.fetch(++pos).strip();
532 pi.device =
"/dev/%s".printf(pi.
kname);
534 if (pi.
uuid.length > 0){
535 pi.device_by_uuid =
"/dev/disk/by-uuid/%s".printf(pi.
uuid);
538 if (pi.
label.length > 0){
539 pi.device_by_label =
"/dev/disk/by-label/%s".printf(pi.
label);
543 pi.device_by_partuuid =
"/dev/disk/by-partuuid/%s".printf(pi.
partuuid);
547 pi.device_by_partlabel =
"/dev/disk/by-partlabel/%s".printf(pi.
partlabel);
574 foreach(var dev
in list){
575 var dev_by_uuid =
path_combine(
"/dev/disk/by-uuid/", dev.uuid);
577 dev.symlinks.add(dev_by_uuid);
585 File f_dev_mapper = File.new_for_path (
"/dev/mapper");
587 FileEnumerator enumerator = f_dev_mapper.enumerate_children (
589 FileAttribute.STANDARD_NAME, FileAttribute.STANDARD_SYMLINK_TARGET),
590 FileQueryInfoFlags.NOFOLLOW_SYMLINKS);
593 while ((info = enumerator.next_file ()) !=
null) {
595 if (info.get_name() ==
"control") {
continue; }
597 File f_mapped = f_dev_mapper.resolve_relative_path(info.get_name());
599 string mapped_file = f_mapped.get_path();
600 string mapped_device = info.get_symlink_target();
601 mapped_device = mapped_device.replace(
"..",
"/dev");
607 foreach(var dev
in list){
608 if (dev.device == mapped_device){
609 dev.mapped_name = mapped_file.replace(
"/dev/mapper/",
"");
610 dev.symlinks.add(mapped_file);
623 foreach (var part
in list){
631 for (
int i = list.size - 1; i >= 0; --i) {
637 for (
int j = list.size - 1; j > i; --j) {
639 for (
int k = j - 1; k >= 0; --k) {
652 for (
int i = list.size - 1; i >= 0; --i) {
655 list[i].type =
"disk";
656 list[i].model = list[i].name;
659 for (
int j = list.size - 1; j >= 0; --j) {
672 for (
int i = list.size - 1; i >= 0; --i) {
673 if (list[i].
type ==
"dmraid") {
678 for (
int j = list.size - 1; j > i; --j) {
680 for (
int k = j - 1; k >= 0; --k) {
692 for (
int i = list.size - 1; i >= 0; --i) {
693 if (list[i].
type ==
"dmraid") {
695 list[i].type =
"disk";
696 list[i].model = list[i].name;
699 for (
int j = list.size - 1; j >= 0; --j) {
700 if ((i != j) && (list[j].
type ==
"dmraid") && (list[j].
kname == list[i].
kname)) {
729 var list =
new Gee.ArrayList<
Device>();
738 cmd =
"/sbin/blkid" + ((dev_name.length > 0) ?
" " + dev_name:
"");
746 var msg =
"blkid: " +
_(
"Failed to get partition list");
747 msg += (dev_name.length > 0) ?
": " + dev_name :
"";
762 foreach(
string line
in std_out.split(
"\n")){
763 if (line.strip().length == 0) {
continue; }
767 pi.device = line.split(
":")[0].strip();
769 if (pi.
device.length == 0) {
continue; }
773 if (!pi.
device.has_prefix(
"/dev/")){
777 if (pi.
device.has_prefix(
"/dev/sd") || pi.
device.has_prefix(
"/dev/hd") || pi.
device.has_prefix(
"/dev/mapper/") || pi.
device.has_prefix(
"/dev/dm")) {
780 else if (pi.
device.has_prefix(
"/dev/disk/by-uuid/")){
782 pi.uuid = pi.
device.replace(
"/dev/disk/by-uuid/",
"");
791 rex =
new Regex(
"""LABEL=\"([^\"]*)\"""");
792 if (rex.match (line, 0, out match)){
793 pi.label = match.fetch(1);
796 rex =
new Regex(
"""UUID=\"([^\"]*)\"""");
797 if (rex.match (line, 0, out match)){
798 pi.uuid = match.fetch(1).strip();
801 rex =
new Regex(
"""TYPE=\"([^\"]*)\"""");
802 if (rex.match (line, 0, out match)){
803 pi.fstype = match.fetch(1).strip();
812 if (pi.
uuid.length > 0){
817 log_debug(
"Device: get_block_devices_using_blkid(): %d".printf(list.size));
829 var list =
new Gee.ArrayList<
Device>();
838 if (dev_name_or_mount_point.length > 0){
846 ret_val =
exec_sync(cmd, out std_out, out std_err);
861 string[] lines = std_out.split(
"\n");
864 foreach(
string line
in lines){
866 if (++line_num == 1) {
continue; }
867 if (line.strip().length == 0) {
continue; }
874 foreach(
string val
in line.split(
" ")){
876 if (val.strip().length == 0){
continue; }
880 pi.device = val.strip();
883 pi.fstype = val.strip();
886 pi.size_bytes = uint64.parse(val.strip());
889 pi.used_bytes = uint64.parse(val.strip());
892 pi.available_bytes = uint64.parse(val.strip());
895 pi.used_percent = val.strip();
923 if (pi.uuid.length > 0){
928 log_debug(
"Device: get_disk_space_using_df(): %d".printf(list.size));
938 var list =
new Gee.ArrayList<
Device>();
940 string mtab_path =
"/etc/mtab";
941 string mtab_lines =
"";
947 mtab_path =
"/proc/mounts";
948 f = File.new_for_path(mtab_path);
949 if(!f.query_exists()){
950 mtab_path =
"/proc/self/mounts";
951 f = File.new_for_path(mtab_path);
952 if(!f.query_exists()){
953 mtab_path =
"/etc/mtab";
954 f = File.new_for_path(mtab_path);
955 if(!f.query_exists()){
998 string[] lines = mtab_lines.split(
"\n");
999 var mount_list =
new Gee.ArrayList<
string>();
1001 for (
int i = lines.length - 1; i >= 0; i--){
1003 bool ignoreEntry =
false;
1005 string line = lines[i].strip();
1006 if (line.length == 0) {
continue; }
1015 foreach(
string val
in line.split(
" ")){
1016 if (val.strip().length == 0){
continue; }
1017 if (ignoreEntry){
break; }
1020 pi.device = val.strip();
1023 mp.mount_point = val.strip().replace(
"""\040""",
" ");
1026 if (mp.mount_point.contains(
"/docker")){
1031 if (!mount_list.contains(mp.mount_point)){
1032 mount_list.add(mp.mount_point);
1033 pi.mount_points.add(mp);
1037 pi.fstype = val.strip();
1040 mp.mount_options = val.strip();
1048 if (ignoreEntry) {
continue; }
1060 if (pi.uuid.length > 0){
1067 foreach(var item
in pi.mount_points){
1068 dev.mount_points.add(item);
1074 log_debug(
"Device: get_mounted_filesystems_using_mtab(): %d".printf(list.size));
1093 var list =
Device.get_disk_space_using_df(path_to_check);
1108 if (dev.device ==
device){
1120 if (dev_name_or_uuid.has_prefix(
"/dev")){
1121 device = dev_name_or_uuid;
1125 uuid = dev_name_or_uuid;
1126 device =
"/dev/disk/by-uuid/%s".printf(
uuid);
1135 return dev.mount_points;
1144 var mps =
Device.get_device_mount_points(dev_name_or_uuid);
1153 var list =
Device.get_mounted_filesystems_using_mtab();
1154 foreach (var dev
in list){
1155 foreach(var mp
in dev.mount_points){
1156 if (mp.mount_point.has_prefix(mount_point)){
1179 string dev_alias = _dev_alias;
1181 if (dev_alias.down().has_prefix(
"uuid=")){
1183 dev_alias = dev_alias.split(
"=",2)[1].strip().down();
1189 dev_alias = link_path.replace(
"../../../",
"/dev/").replace(
"../../",
"/dev/").replace(
"../",
"/dev/");
1192 foreach(var dev
in list){
1194 if (dev.device == dev_alias){
1197 else if (dev.uuid == dev_alias){
1200 else if (dev.label == dev_alias){
1203 else if (dev.partuuid == dev_alias){
1206 else if (dev.partlabel == dev_alias){
1209 else if (dev.device_by_uuid == dev_alias){
1212 else if (dev.device_by_label == dev_alias){
1215 else if (dev.device_by_partuuid == dev_alias){
1218 else if (dev.device_by_partlabel == dev_alias){
1221 else if (dev.device_mapper == dev_alias){
1224 else if (dev.mapped_name == dev_alias){
1234 this.device = dev2.
device;
1235 this.name = dev2.
name;
1236 this.kname = dev2.
kname;
1237 this.pkname = dev2.
pkname;
1238 this.label = dev2.
label;
1239 this.uuid = dev2.
uuid;
1242 this.type = dev2.
type;
1243 this.fstype = dev2.
fstype;
1251 this.parent = dev2.
parent;
1254 this.vendor = dev2.
vendor;
1255 this.model = dev2.
model;
1256 this.serial = dev2.
serial;
1268 if (
uuid.length > 0){
1269 if (dev.uuid ==
uuid){
1275 if (dev.device ==
device){
1293 if (dev_df !=
null){
1306 if (dev_name_or_uuid.length == 0){
1311 var cmd =
"udisksctl mount -b '%s'".printf(dev_name_or_uuid);
1313 int status = Posix.system(cmd);
1316 if (parent_window !=
null){
1317 string msg =
"Failed to mount: %s".printf(dev_name_or_uuid);
1318 gtk_messagebox(
"Error", msg, parent_window,
true);
1322 return (status == 0);
1330 string msg =
"%s: %s".printf(
_(
"Could not find file"), iso_file_path);
1335 var cmd =
"udisksctl loop-setup -r -f '%s'".printf(
1339 string std_out, std_err;
1340 int exit_code =
exec_sync(cmd, out std_out, out std_err);
1342 if (exit_code == 0){
1343 log_msg(
"%s".printf(std_out));
1346 if (!std_out.contains(
" as ")){
1347 log_error(
"Could not determine loop device");
1351 loop_device = std_out.split(
" as ")[1].replace(
".",
"").strip();
1352 log_msg(
"loop_device: %s".printf(loop_device));
1355 foreach(var dev
in list){
1356 if ((dev.pkname == loop_device.replace(
"/dev/",
"")) && (dev.fstype ==
"iso9660")){
1357 loop_device = dev.device;
1366 public static bool unmount_udisks(
string dev_name_or_uuid, Gtk.Window? parent_window){
1368 if (dev_name_or_uuid.length == 0){
1373 var cmd =
"udisksctl unmount -b '%s'".printf(dev_name_or_uuid);
1375 int status = Posix.system(cmd);
1378 if (parent_window !=
null){
1379 string msg =
"Failed to unmount: %s".printf(dev_name_or_uuid);
1380 gtk_messagebox(
"Error", msg, parent_window,
true);
1384 return (status == 0);
1388 Device luks_device,
string mapped_name,
string passphrase, Gtk.Window? parent_window,
1389 out
string message, out
string details){
1397 Device unlocked_device =
null;
1398 string std_out =
"", std_err =
"";
1401 if (!luks_device.
fstype.contains(
"luks") && !luks_device.
fstype.contains(
"crypt")){
1402 message =
_(
"This device is not encrypted");
1403 details =
_(
"Failed to unlock device");
1409 foreach(var part
in list){
1410 if (part.pkname == luks_device.kname){
1411 unlocked_device = part;
1412 message =
_(
"Device is unlocked");
1413 details =
_(
"Unlocked device is mapped to '%s'").printf(part.mapped_name);
1418 string luks_pass = passphrase;
1421 if ((luks_name ==
null) || (luks_name.length == 0)){
1422 luks_name =
"%s_crypt".printf(luks_device.kname);
1425 if (parent_window ==
null){
1429 if ((luks_pass ==
null) || (luks_pass.length == 0)){
1434 counter.kill_process_on_timeout(
"cryptsetup", 20,
true);
1435 string cmd =
"cryptsetup luksOpen '%s' '%s'".printf(luks_device.device, luks_name);
1447 var cmd =
"echo -n -e '%s' | cryptsetup luksOpen --key-file - '%s' '%s'\n".printf(
1456 message =
_(
"Wrong password");
1457 details =
_(
"Failed to unlock device");
1469 if ((luks_pass ==
null) || (luks_pass.length == 0)){
1473 log_debug(
"Prompting user for passphrase..");
1476 _(
"Encrypted Device"),
1477 _(
"Enter passphrase to unlock '%s'").printf(luks_device.name),
1478 parent_window,
true);
1480 if (luks_pass ==
null){
1482 message =
_(
"Failed to unlock device");
1483 details =
_(
"User cancelled the password prompt");
1484 log_debug(
"User cancelled the password prompt");
1489 if ((luks_pass !=
null) && (luks_pass.length > 0)){
1493 var cmd =
"echo -n -e '%s' | cryptsetup luksOpen --key-file - '%s' '%s'\n".printf(
1502 message =
_(
"Wrong password");
1503 details =
_(
"Failed to unlock device");
1514 foreach(var part
in list){
1515 if (part.pkname == luks_device.kname){
1516 unlocked_device = part;
1521 bool is_error =
false;
1522 if (unlocked_device ==
null){
1523 message =
_(
"Failed to unlock device") +
" '%s'".printf(luks_device.device);
1528 message =
_(
"Unlocked successfully");
1529 details =
_(
"Unlocked device is mapped to '%s'").printf(unlocked_device.mapped_name);
1532 if (parent_window !=
null){
1533 gtk_messagebox(message, details, parent_window, is_error);
1536 return unlocked_device;
1541 var cmd =
"cryptsetup luksClose %s".printf(
kname);
1545 string std_out, std_err;
1551 if (parent_window !=
null){
1552 string msg =
"Failed to lock device: %s".printf(
kname);
1553 gtk_messagebox(
"Error", msg, parent_window,
true);
1557 return (status == 0);
1572 string dev_name_or_uuid,
string mount_point,
string mount_options =
"",
bool silent =
false){
1589 if (dev_name_or_uuid.has_prefix(
"/dev")){
1590 device = dev_name_or_uuid;
1594 uuid = dev_name_or_uuid;
1595 device =
"/dev/disk/by-uuid/%s".printf(
uuid);
1601 var mps =
Device.get_device_mount_points(dev_name_or_uuid);
1605 foreach(var mp
in mps){
1610 foreach(var mp
in mps){
1611 if ((mp.mount_point == mount_point) && mp.mount_options.contains(mount_options)){
1613 var msg =
"%s is mounted at: %s".printf(
device, mount_point);
1614 if (mp.mount_options.length > 0){
1615 msg +=
", options: %s".printf(mp.mount_options);
1617 log_msg(
"\n%s\n".printf(msg));
1630 if (mount_options.length > 0){
1631 cmd =
"mount -o %s \"%s\" \"%s\"".printf(mount_options,
device, mount_point);
1634 cmd =
"mount \"%s\" \"%s\"".printf(
device, mount_point);
1636 log_debug(
"mount command: %s".printf(cmd));
1638 ret_val =
exec_sync(cmd, out std_out, out std_err);
1641 log_error (
"Failed to mount device '%s' at mount point '%s'".printf(
device, mount_point));
1648 log_msg (
"Mounted '%s'%s at '%s'".printf(
1650 (mount_options.length > 0) ?
" (%s)".printf(mount_options) :
"",
1669 string dev_name_or_uuid,
string mount_options =
"",
string mount_prefix =
"/run"){
1680 if (dev_name_or_uuid.has_prefix(
"/dev")){
1681 device = dev_name_or_uuid;
1682 uuid =
Device.get_device_uuid(dev_name_or_uuid);
1685 uuid = dev_name_or_uuid;
1686 device =
"/dev/disk/by-uuid/%s".printf(
uuid);
1692 var list =
Device.get_block_devices_using_lsblk();
1695 return dev.mount_points[0].mount_point;
1700 string mount_point =
"%s/%s".printf(mount_prefix,
uuid);
1703 File file = File.new_for_path(mount_point);
1704 if (!file.query_exists()){
1705 file.make_directory_with_parents();
1715 if (
mount(
uuid, mount_point, mount_options)){
1734 if (!
Device.mount_point_in_use(mount_point)) {
1742 string cmd_unmount =
"cat /proc/mounts | awk '{print $2}' | grep '%s' | sort -r | xargs umount".printf(mount_point);
1744 log_debug(
_(
"Unmounting from") +
": '%s'".printf(mount_point));
1748 Process.spawn_command_line_sync(cmd, out std_out, out std_err, out ret_val);
1765 if (!
Device.mount_point_in_use(mount_point)) {
1793 string text =
kname;
1803 string text =
kname;
1806 text +=
" (%s)".printf(
pkname);
1832 if (
type ==
"disk"){
1833 s +=
"<b>" +
kname +
"</b> ~";
1837 if (
model.length > 0){
1846 s += (label.length > 0) ?
" (" +
label +
")":
"";
1847 s += (fstype.length > 0) ?
" ~ " +
fstype :
"";
1864 if (
type ==
"disk"){
1868 if (
model.length > 0){
1872 if (s.strip().length == 0){
1882 s += (label.length > 0) ?
" (" +
label +
")":
"";
1883 s += (fstype.length > 0) ?
" ~ " +
fstype :
"";
1895 if (
type ==
"disk"){
1906 if (
label.length > 0){
1907 s +=
" (%s)".printf(
label);
1910 s +=
" ~ %s".printf(
fstype);
1923 s += (label.length > 0) ?
" (" +
label +
")":
"";
1924 s += (uuid.length > 0) ?
" ~ " +
uuid :
"";
1925 s += (fstype.length > 0) ?
" ~ " +
fstype :
"";
1932 if (
used.length > 0){
1941 if (
used.length > 0){
1953 if (
type ==
"disk"){
1954 tt +=
"%-15s: %s\n".printf(
_(
"Device"),
device);
1955 tt +=
"%-15s: %s\n".printf(
_(
"Vendor"),
vendor);
1956 tt +=
"%-15s: %s\n".printf(
_(
"Model"),
model);
1957 tt +=
"%-15s: %s\n".printf(
_(
"Serial"),
serial);
1958 tt +=
"%-15s: %s\n".printf(
_(
"Revision"),
revision);
1960 tt +=
"%-15s: %s\n".printf(
_(
"Size"),
1964 tt +=
"%-15s: %s\n".printf(
_(
"Device"),
1968 tt +=
"%-15s: %s\n".printf(
_(
"Parent Device"),
parent.
device);
1970 tt +=
"%-15s: %s\n".printf(
_(
"UUID"),
uuid);
1971 tt +=
"%-15s: %s\n".printf(
_(
"Type"),
type);
1972 tt +=
"%-15s: %s\n".printf(
_(
"Filesystem"),
fstype);
1973 tt +=
"%-15s: %s\n".printf(
_(
"Label"),
label);
1975 tt +=
"%-15s: %s\n".printf(
_(
"Size"),
1978 tt +=
"%-15s: %s\n".printf(
_(
"Used"),
1981 tt +=
"%-15s: %s\n".printf(
_(
"System"),
dist_info);
1984 return "<tt>%s</tt>".printf(tt);
1992 log_msg(
"\n> get_block_devices_using_lsblk()");
2002 log_msg(
"\n> get_mounted_filesystems_using_mtab()");
2008 log_msg(
"\n> get_disk_space_using_df()");
2014 log_msg(
"\n> get_filesystems()");
2026 log_debug(
"%-12s ,%-5s ,%-5s ,%-36s ,%s".printf(
2035 foreach(var dev
in list){
2036 log_debug(
"%-12s ,%-5s ,%-5s ,%-36s ,%s".printf(
2105 "> mount_points (mount_options)"
2110 foreach(var dev
in list){
2113 foreach(var mp
in dev.mount_points){
2114 mps +=
"\n %s -> ".printf(mp.mount_point);
2115 if (mp.mount_options.length > 0){
2116 mps +=
" %s".printf(mp.mount_options);
2134 log_debug(
"%-15s %-12s %15s %15s %15s %10s".printf(
2145 foreach(var dev
in list){
2146 log_debug(
"%-15s %-12s %15s %15s %15s %10s".printf(
static bool automount_udisks_iso(string iso_file_path, out string loop_device, Gtk.Window? parent_window)
string description_usage()
string description_simple_formatted()
string description_full_free()
static Gee.ArrayList< Device > get_disk_space_using_df(string dev_name_or_mount_point="")
static string automount(string dev_name_or_uuid, string mount_options="", string mount_prefix="/run")
static bool device_is_mounted(string dev_name_or_uuid)
static void find_child_devices(Gee.ArrayList< Device > list, Device parent)
static Gee.ArrayList< MountEntry > get_device_mount_points(string dev_name_or_uuid)
static ? Device get_device_by_path(string path_to_check)
bool has_linux_filesystem()
Device? first_linux_child()
static string get_device_uuid(string device)
static void test_lsblk_version()
static ? Device find_device_in_list(Gee.ArrayList< Device > list, string _dev_alias)
void copy_fields_from(Device dev2)
static string resolve_device_name(string dev_alias)
string device_by_partlabel
static Gee.ArrayList< Device > device_list
string short_name_with_alias
static void find_child_devices_using_dmsetup(Gee.ArrayList< Device > list)
Gee.ArrayList< string > symlinks
string description_free()
bool is_on_encrypted_partition()
string description_formatted()
static Gee.ArrayList< Device > get_filesystems(bool get_space=true, bool get_mounts=true)
string short_name_with_parent
static Gee.ArrayList< Device > get_block_devices_using_lsblk(string dev_name="")
static string lsblk_version
bool is_encrypted_partition()
static bool unmount_udisks(string dev_name_or_uuid, Gtk.Window? parent_window)
string full_name_with_parent
Gee.ArrayList< Device > children
static bool luks_lock(string kname, Gtk.Window? parent_window)
static void print_device_mounts(Gee.ArrayList< Device > list)
static bool mount(string dev_name_or_uuid, string mount_point, string mount_options="", bool silent=false)
static ? Device luks_unlock(Device luks_device, string mapped_name, string passphrase, Gtk.Window? parent_window, out string message, out string details)
string device_by_partuuid
bool is_mounted_at_path(string subvolname, string mount_path)
Gee.ArrayList< MountEntry > mount_points
static ? Device get_device_by_uuid(string uuid)
static Gee.ArrayList< Device > get_block_devices_using_blkid(string dev_name="")
static bool unmount(string mount_point)
static bool mount_point_in_use(string mount_point)
string description_full()
string description_simple()
static void find_toplevel_parent(Gee.ArrayList< Device > list, Device dev)
string full_name_with_alias
static void print_device_list(Gee.ArrayList< Device > list)
static ? Device get_device_by_name(string file_name)
static int remove_parents(Gee.ArrayList< Device > list, Device dev)
static bool lsblk_is_ancient
static Gee.ArrayList< Device > get_mounted_filesystems_using_mtab()
static void print_device_disk_space(Gee.ArrayList< Device > list)
static bool automount_udisks(string dev_name_or_uuid, Gtk.Window? parent_window)
string device_name_with_parent
MountEntry(Device? device, string mount_point, string mount_options)
bool file_exists(string file_path)
string escape_single_quote(string file_path)
string file_get_symlink_target(string file_path)
string? file_read(string file_path)
bool file_is_symlink(string file_path)
string path_combine(string path1, string path2)
string format_file_size(uint64 size, bool binary_units=false, string unit="", bool show_units=true, int decimals=1)
bool dir_create(string dir_path, bool show_message=false)
string? gtk_inputbox(string title, string message, Gtk.Window? parent_win, bool mask_password=false)
void log_debug(string message)
void log_error(string message, bool highlight=false, bool is_warning=false)
void log_msg(string message, bool highlight=false)
int exec_script_sync(string script, out string? std_out=null, out string? std_err=null, bool supress_errors=false, bool run_as_admin=false, bool cleanup_tmp=true, bool print_to_terminal=false)
int exec_sync(string cmd, out string? std_out=null, out string? std_err=null)