Просмотр исходного кода

Updated diskoverview for newer version of Debian

Toby Chui 1 год назад
Родитель
Сommit
3995f9f95a
2 измененных файлов с 18 добавлено и 3 удалено
  1. 1 1
      mod/disk/diskmg/diskmg.go
  2. 17 2
      web/SystemAO/desktop/utils/diskoverview.html

+ 1 - 1
mod/disk/diskmg/diskmg.go

@@ -51,7 +51,7 @@ type LsblkF struct {
 			Fstype     string      `json:"fstype"`
 			Label      interface{} `json:"label"`
 			UUID       string      `json:"uuid"`
-			Fsavail    string      `json:"fsavail"`
+			Fsavail    int64       `json:"fsavail"`
 			Fsuse      string      `json:"fsuse%"`
 			Mountpoint string      `json:"mountpoint"`
 		} `json:"children"`

+ 17 - 2
web/SystemAO/desktop/utils/diskoverview.html

@@ -108,8 +108,23 @@
                             if (thisDiskInfo.children.length > 0){
                                 //Try to extract mountpoint as name
                                 let mountpoint = thisDiskInfo.children[0].mountpoint;
-                                if (mountpoint == null || mountpoint == undefined){
-                                    mountpoint = "";
+                                if (mountpoint == null || mountpoint == undefined || mountpoint == ""){
+                                    //Not mounted via arozos. Try to get the mountpoint from other partitions
+                                    if (thisDiskInfo.children.length > 1){
+                                        //Multiple partitions, combine them into /dev/sdX(1+2+3)
+                                        mountpoint = "/dev/" + thisDiskInfo.children[0].name;
+                                        mountpoint = mountpoint.replace(/[0-9]/g, ""); //Remove the partition number
+                                        mountpoint += "[";
+                                        for (var j = 0; j < thisDiskInfo.children.length; j++){
+                                            let partitionNumber = thisDiskInfo.children[j].name.replace(/[a-zA-Z]/g, "");
+                                            mountpoint += partitionNumber + "+";
+                                        }
+                                        mountpoint = mountpoint.slice(0, -1); //Remove the last +
+                                        mountpoint += "]";
+                                    }else{
+                                        //Single partition
+                                        mountpoint = "/dev/"  + thisDiskInfo.children[0].name;
+                                    }
                                 }
 
                                 diskName = mountpoint;