]> Git [git.vados.ru] :: Repos - Mikrotiks/ros.vados.ru.git/commitdiff
nb
authorvados-dev <192440777+vados-dev@users.noreply.github.com>
Wed, 1 Apr 2026 04:58:05 +0000 (07:58 +0300)
committervados-dev <192440777+vados-dev@users.noreply.github.com>
Wed, 1 Apr 2026 04:58:05 +0000 (07:58 +0300)
html/AM-setup.rsc

index 20f920a26e479f03170ef577d81487bca459a5ac..17e6ec4f3cbc2ba1496e4693b453553bc3ad6076 100644 (file)
@@ -74,41 +74,45 @@ if ($ScriptUpdatesCRLF != false) do={
     };
     :delay 1s;
   };
+
+:local MkTmpfs do={
+  :local TmpFs [ /disk/find where slot=tmpfs type=tmpfs ];
+  :if ([ :len $TmpFs ] = 1) do={
+    :if ([ /disk/get $TmpFs disabled ] = true) do={
+      :log info ("The tmpfs is disabled, enabling.");
+      /disk/enable $TmpFs;
+    }
+    :return true;
+  }
+  :log info ("Creating disk of type tmpfs.");
+  /file/remove "tmpfs";
+#  $RmDir "tmpfs";
+  :onerror Err {
+    /disk/add slot=tmpfs type=tmpfs tmpfs-max-size=([ /system/resource/get total-memory ] / 3);
+    :do {
+      :retry {
+        /file/get tmpfs;
+        :return true;
+      } delay=222ms max=10;
+      } on-error={ }
+    } do={
+      :log warning ("Creating disk of type tmpfs failed: " . $Err);
+      :return false;
+    }
+    :return true;
+}
   :if ($tmpfs = true) do={
   :put "Tmpfs variable is true. Checking for tmpfs/scripts directory...";
   :if ([/file find name="tmpfs/scripts"] != "") do={
     :log debug ($0 . "Directory tmpfs/scripts exsist.");
     :return $true;
   } else={
-  :local MkTmpfs do={
-   :local TmpFs [ /disk/find where slot=tmpfs type=tmpfs ];
-   :if ([ :len $TmpFs ] = 1) do={
-     :if ([ /disk/get $TmpFs disabled ] = true) do={
-       :log info ("The tmpfs is disabled, enabling.");
-       /disk/enable $TmpFs;
-      }
-      :return true;
-    }
-    :log info ("Creating disk of type tmpfs.");
-    /file/remove "tmpfs";
-#    $RmDir "tmpfs";
-    :onerror Err {
-      /disk/add slot=tmpfs type=tmpfs tmpfs-max-size=([ /system/resource/get total-memory ] / 3);
-      :do {
-        :retry {
-          /file/get tmpfs;
-          :return true;
-        } delay=222ms max=10;
-      } on-error={ }
-    } do={
-      :log warning ("Creating disk of type tmpfs failed: " . $Err);
+    :if ([ $MkTmpfs ] = false) do={
       :return false;
     }
-    :return true;
-  }
 #    :log error ($0 . "Directory tmpfs/scripts does not exsist. Remove global variable tmpfs!");
 #    :global tmpfs (a);
-    return false;
+#    return false;
 }
   :put "Renaming AM-GlobalConfig, if exists...";
   :local ConfOldName ("AM-GlobalConfig-" . [ /system/clock/get date ] . [ /system/clock/get time ] . ".rsc");