Skip to content

Commit

Permalink
Tools.IsDocker()
Browse files Browse the repository at this point in the history
  • Loading branch information
superfloh247 committed May 22, 2024
1 parent e76d3ec commit 58641bb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
10 changes: 5 additions & 5 deletions TLUpdate/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ static void Main(string[] _)

Console.WriteLine("End update");

if (Tools.IsMono())
if (Tools.IsDocker())
{
Console.WriteLine("Rebooting ...");
Tools.ExecMono("reboot", "");
Console.WriteLine("Restarting ...");
Environment.Exit(0);
}
else
{
Console.WriteLine("Restarting ...");
Environment.Exit(0);
Console.WriteLine("Rebooting ...");
Tools.ExecMono("reboot", "");
}
}
catch (Exception ex)
Expand Down
18 changes: 18 additions & 0 deletions TLUpdate/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,24 @@ public static string GetMonoRuntimeVersion()
}
return "NULL";
}

public static bool IsDocker()
{
try
{
string filename = "/tmp/teslalogger-DOCKER";
if (File.Exists(filename))
{
return true;
}
}
catch (Exception ex)
{
Console.WriteLine("Exception " + ex.Message);
}

return false;
}
}
}

0 comments on commit 58641bb

Please sign in to comment.