aboutsummaryrefslogtreecommitdiffstats
path: root/backup-partition.rsc
diff options
context:
space:
mode:
Diffstat (limited to 'backup-partition.rsc')
-rw-r--r--backup-partition.rsc17
1 files changed, 17 insertions, 0 deletions
diff --git a/backup-partition.rsc b/backup-partition.rsc
index fc186c0..9eeb1ae 100644
--- a/backup-partition.rsc
+++ b/backup-partition.rsc
@@ -18,6 +18,7 @@
:global PackagesUpdateBackupFailure;
:global LogPrint;
+ :global ScriptFromTerminal;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
@@ -41,6 +42,22 @@
:local FallbackTo [ /partitions/get $ActiveRunning fallback-to ];
+ :if ([ /partitions/get $ActiveRunning version ] != [ /partitions/get $FallbackTo version]) do={
+ :if ([ $ScriptFromTerminal $ScriptName ] = true) do={
+ :put ("The partitions have different RouterOS versions. Copy over to '" . $FallbackTo . "'? [y/N]");
+ :if (([ /terminal/inkey timeout=60 ] % 32) = 25) do={
+ :do {
+ /partitions/copy-to $FallbackTo;
+ $LogPrint info $ScriptName ("Copied RouterOS to partition '" . $FallbackTo . "'.");
+ } on-error={
+ $LogPrint error $ScriptName ("Failed copying RouterOS to partition '" . $FallbackTo . "'!");
+ :set PackagesUpdateBackupFailure true;
+ :error false;
+ }
+ }
+ }
+ }
+
:do {
/system/scheduler/add start-time=startup name="running-from-backup-partition" \
on-event=(":log warning (\"Running from partition '\" . " . \