public static ComponentTask InstallWithChoco( Architectures architecture, string displayName, string pkgName, string searchMask, bool force) { Func <bool> isChocoInstalledAction = () => ChocoUtil.IsChocoInstalled(); Func <bool> isInternetConnected = () => Network.TestInternetConnection(); List <Func <bool> > prereqFuncs = new List <Func <bool> >() { isInternetConnected, isChocoInstalledAction }; Action installProgramAction = () => ChocoUtil.ChocoUpgrade(pkgName, displayName, false, searchMask, ChocoUtil.DefaultArgs); Func <bool> isProgramInstalledAction = () => ProgramInstaller.IsSoftwareInstalled(architecture, searchMask); return(new ComponentTask(new SetupTask(prereqFuncs, installProgramAction, isProgramInstalledAction, force), null)); }
private ComponentTask ChocolateyInstallation() { Func <bool> prequisiteFunc = () => Network.TestInternetConnection(); Action action = () => { string command = @"@powershell -NoProfile -ExecutionPolicy Bypass -Command ""iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"; SystemUtil.ExecuteCMDCommand(command); }; Func <bool> actionValidation = () => ChocoUtil.IsChocoInstalled(); return(new ComponentTask(new SetupTask(prequisiteFunc, action, actionValidation, false), null)); }
private ComponentTask JavaX86Installation() { Func <bool> isChocoInstalled = () => ChocoUtil.IsChocoInstalled(); /* Update to use non-default argument list to specifically get x86 version */ Action installJavaX86 = () => ComponentTaskPresets.InstallWithChoco(Architectures.X86, "Java 8 (32-bit)", "jre8", "Java 8 Update *$", false); Func <bool> isX86Java8Installed = () => JavaInstallUtil.IsJavaInstalled(Architectures.X86, 8); return(new ComponentTask( new SetupTask( isChocoInstalled, installJavaX86, isX86Java8Installed, false), null)); }