Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Overide of default distro #5

Merged
merged 2 commits into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ containerized:
rm -rf bin/ obj/
${CONTAINER_RUNTIME} build -t dotnet-build -f images/Dockerfile.fedora .
${CONTAINER_RUNTIME} run --name runingenie-build dotnet-build sh -c "dotnet restore && dotnet publish -c Release -r win-x64"
${CONTAINER_RUNTIME} cp runingenie-build:/app/bin ./bin
${CONTAINER_RUNTIME} cp runingenie-build:/app/bin .
${CONTAINER_RUNTIME} rm runingenie-build
#${CONTAINER_RUNTIME} rmi dotnet-build # this forces a rebuild of the toolchain each time
26 changes: 16 additions & 10 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ private static string Shell
}
}

private static string Distro
{
get
{
string distro = Configuration["distro"];
return (distro != null) ? distro : String.Empty;
}
}

private static void PrintHelp ()
{
ConsoleColor oldColor = Console.ForegroundColor;
Expand Down Expand Up @@ -130,15 +139,13 @@ private static int Main (string[] args)

try
{
string shell = Program.Shell;
// Set chosen distro and shell
string distro = (Program.Distro == String.Empty) ? String.Empty : "-d {Program.Distro}";
string arguments = $"{distro} genie -c {Program.Shell}";

Process ps;
if(args.Length == 0) {
// No arguments given
ps = Process.Start (fileName: "wsl",
arguments: $"-e genie -c {shell}");
} else {
// Check through arguments, one by one.
if(args.Length > 0) {
// Check through additional arguments, one by one.
var param = new List<string> ();

foreach (var arg in args)
Expand All @@ -147,11 +154,10 @@ private static int Main (string[] args)
param.Add (item: Program.IsWindowsPath (arg: arg) ? Program.TranslatePath (path: arg) : arg);

// Execute in WSL.
ps = Process.Start (fileName: "wsl",
arguments: $"-e genie -c {shell} -c \"{string.Join (separator: ' ', values: param)}\"");
arguments = $"{arguments} -c \"{string.Join (separator: ' ', values: param)}\"";
}


ps = Process.Start (fileName: "wsl", arguments: arguments);
ps.WaitForExit ();

return ps.ExitCode;
Expand Down