};
: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");