Skip to content
Permalink
Browse files

Updater fixes

  • Loading branch information
noahc3 committed Jan 28, 2020
1 parent a51e930 commit 54da0c0c447a30307476741c5ceb00fac0b5e228
Showing with 22 additions and 1 deletion.
  1. +1 −1 SDSetupBackend/Program.cs
  2. +1 −0 SDSetupUpdater/Program.cs
  3. +20 −0 SDSetupUpdater/U.cs
@@ -90,7 +90,7 @@ public class Program {
process.Start();
}
}
}, null, TimeSpan.Zero, TimeSpan.FromMinutes(10));
}, null, TimeSpan.Zero, TimeSpan.FromMinutes(720));

if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) {
Console.WriteLine("[WARN] Updater has been disabled as non-Linux platforms are not supported!");
@@ -111,6 +111,7 @@ class Program {
U.DirectoryCopy(f.FullName, Path.Join(f.Parent.Parent.FullName, f.Name), true);
}
Directory.Delete(scriptMasterFolder, true);
("chmod -R 775 " + kosmosScriptPath).ExecuteAsBash();
Log("Done!");
Log("");

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Diagnostics;

namespace SDSetupUpdater {
public static class U {
@@ -36,5 +37,24 @@ public static class U {
}
}
}

public static string ExecuteAsBash(this string cmd) {
var escapedArgs = cmd.Replace("\"", "\\\"");

var process = new Process() {
StartInfo = new ProcessStartInfo {
FileName = "/bin/bash",
Arguments = $"-c \"{escapedArgs}\"",
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = true,
}
};
process.Start();
string result = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return result;
}
}
}

0 comments on commit 54da0c0

Please sign in to comment.
You can’t perform that action at this time.