mirror of
https://github.com/Fluent-networks/tailscale-mikrotik.git
synced 2025-06-23 09:18:48 +02:00
Merge pull request #33 from RomRider/patch-1
update script: fix missing mounts after restart and some other improvements
This commit is contained in:
commit
6fec3e136b
1 changed files with 29 additions and 18 deletions
47
upgrade.rsc
47
upgrade.rsc
|
@ -1,49 +1,60 @@
|
||||||
# Container identifier
|
# Container identifier
|
||||||
:global hostname "mikrotik-west-1";
|
:local hostname "mikrotik-west-1";
|
||||||
|
|
||||||
/container
|
/container
|
||||||
:global id [find where hostname=$hostname];
|
:local id [find where hostname=$hostname];
|
||||||
:global rootdir [get $id root-dir];
|
:local rootdir [get $id root-dir];
|
||||||
:global dns [get $id dns];
|
:local dns [get $id dns];
|
||||||
:global logging [get $id logging];
|
:local logging [get $id logging];
|
||||||
:global status [get $id status];
|
:local status [get $id status];
|
||||||
|
:local mounts [get $id mounts];
|
||||||
|
:local envlist [get $id envlist];
|
||||||
|
:local interface [get $id interface];
|
||||||
|
:local startonboot [get $id start-on-boot];
|
||||||
|
:global LogPrefix "Tailscale";
|
||||||
|
|
||||||
|
:local logI do={
|
||||||
|
:global LogPrefix;
|
||||||
|
:put ($LogPrefix . ": " . $1);
|
||||||
|
:log info ($LogPrefix . ": " . $1);
|
||||||
|
}
|
||||||
|
|
||||||
# Stop the container
|
# Stop the container
|
||||||
|
$logI "Stopping the container...";
|
||||||
stop $id
|
stop $id
|
||||||
:put "Stopping the container...";
|
|
||||||
:while ($status != "stopped") do={
|
:while ($status != "stopped") do={
|
||||||
:put "Waiting for the container to stop...";
|
$logI "Waiting for the container to stop...";
|
||||||
:delay 5;
|
:delay 5;
|
||||||
:set status [get $id status];
|
:set status [get $id status];
|
||||||
}
|
}
|
||||||
:put "Stopped.";
|
$logI "Stopped.";
|
||||||
|
|
||||||
# Remove the container
|
# Remove the container
|
||||||
remove $id
|
remove $id
|
||||||
:put "Removing the container...";
|
$logI "Removing the container...";
|
||||||
:while ($status = "stopped") do={
|
:while ($status = "stopped") do={
|
||||||
:put "Waiting for the container to be removed...";
|
$logI "Waiting for the container to be removed...";
|
||||||
:delay 5;
|
:delay 5;
|
||||||
:set status [get $id status];
|
:set status [get $id status];
|
||||||
}
|
}
|
||||||
:put "Removed.";
|
$logI "Removed.";
|
||||||
|
|
||||||
# Add the container
|
# Add the container
|
||||||
:delay 5;
|
:delay 5;
|
||||||
:put "Adding the container...";
|
$logI "Adding the container...";
|
||||||
add remote-image=fluent-networks/tailscale-mikrotik:latest \
|
add remote-image=fluent-networks/tailscale-mikrotik:latest \
|
||||||
interface=veth1 envlist=tailscale root-dir=$rootdir \
|
interface=$interface envlist=$envlist root-dir=$rootdir mounts=$mounts\
|
||||||
start-on-boot=yes hostname=$hostname dns=$dns logging=$logging
|
start-on-boot=$startonboot hostname=$hostname dns=$dns logging=$logging
|
||||||
:do {
|
:do {
|
||||||
:set status [get [find where hostname=$hostname] status];
|
:set status [get [find where hostname=$hostname] status];
|
||||||
:if ($status != "stopped") do={
|
:if ($status != "stopped") do={
|
||||||
:put "Waiting for the container to be added...";
|
$logI "Waiting for the container to be added...";
|
||||||
:delay 5;
|
:delay 5;
|
||||||
}
|
}
|
||||||
} while ($status != "stopped")
|
} while ($status != "stopped")
|
||||||
:put "Added."
|
$logI "Added."
|
||||||
|
|
||||||
# Start the container
|
# Start the container
|
||||||
:put "Starting the container.";
|
$logI "Starting the container.";
|
||||||
:set id [find where hostname=$hostname];
|
:set id [find where hostname=$hostname];
|
||||||
start $id
|
start $id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue