Esempio n. 1
0
        static bool DockerBuild(string[] args)
        {
            string firstArg = args.Length > 0 ? args[0] : "";

            Parser.Default.ParseArguments <DockerfileOptions>(args).WithParsed(options => {
                UserConfig.generateConfigs("wsld/wsld_dockerfile:image", "", options.Distroname, 0);
                UserConfig.dockerfile_path = options.Dockerfile;

                Console.WriteLine("Building image...");


                if (DockerInterop.BuildDockerfile(options.remote))
                {
                    Console.WriteLine("Image created correctly... installing...");
                }
                else
                {
                    Console.WriteLine("Image generation failed...");
                }
                DockerInterop.DownloadImageUsingDocker();
                Wsl.InstallImage();
            });

            return(true);
        }
Esempio n. 2
0
 public static void InstallWsldImage()
 {
     Console.WriteLine("WSLD Image will be installed.");
     Console.WriteLine("This image is needed to perform all the operations of this tool");
     Console.WriteLine("Touching the contents of the image is not recommended.");
     UserConfig.generateConfigs("rucadi/wsld:wsld", "", "wsld", 0);
     DownloadImage();
     File.Move(UserConfig.w_tmp_rootfs_path, UserConfig.w_rootfs_path);
     Wsl.InstallImage();
 }
Esempio n. 3
0
        private static void DefaultOptionsMain(DefaultOptions options)
        {
            UserConfig.setImageUserPasswordConfig(options.User, options.Password, options.CreateUser);
            UserConfig.generateConfigs(options.Dockerimage, options.InstallDir, options.Distroname, options.Version);
            DockerInterop.DownloadImageUsingDocker();
            Wsl.InstallImage();


            if (UserConfig.createUser)
            {
                Console.WriteLine("If needed, install sudo with the root user loading the distro with: ");
                var bgc = Console.BackgroundColor;
                Console.BackgroundColor = ConsoleColor.DarkGreen;
                Console.WriteLine("wsl -d " + options.Distroname + " -u root");
                Console.BackgroundColor = bgc;
            }
        }
Esempio n. 4
0
        private static void ParsedMain(CmdOptions options)
        {
            string img = options.Dockerimage;
            var    rdt = Get_Repo_Dist_Tag(img);

            string repo       = rdt[0];
            string distroname = rdt[1];
            string tag        = rdt[2];

            if (options.InstallDir != null)
            {
                UserConfig.install_dir = options.InstallDir;
            }


            string install_tar_path = Docker.DownloadAndGenerateImage(repo, distroname, tag, options.Distroname);

            Wsl.InstallImage(install_tar_path, Path.Combine(UserConfig.install_dir, options.Distroname), options.Distroname, options.Version);
        }
Esempio n. 5
0
 private static void DefaultOptionsMain(DefaultOptions options)
 {
     UserConfig.generateConfigs(options.Dockerimage, options.InstallDir, options.Distroname, options.Version);
     DockerInterop.DownloadImageUsingDocker();
     Wsl.InstallImage();
 }