GithubHelp home page GithubHelp logo

foil's Introduction

CI

Foil

Foil is a PowerShell Crescendo wrapper for Chocolatey

Install Foil

Install-Module Foil -Force

Sample usages

Search for a package

Find-ChocoPackage -Name nodejs

Find-ChocoPackage -Name firefox -Exact

Install a package

Find-ChocoPackage nodejs -Exact -Verbose | Install-ChocoPackage

Install-ChocoPackage -Name 7zip -Verbose

Get list of installed packages

Get-ChocoPackage nodejs -LocalOnly -Verbose

Uninstall a package

Get-ChocoPackage keepass-plugin-winhello -LocalOnly -Verbose | Uninstall-ChocoPackage -Verbose -RemoveDependencies

Manage package sources

Register-ChocoSource privateRepo -Location 'https://somewhere/out/there/api/v2/'
Get-ChocoPackage nodejs -Verbose -Source privateRepo -Exact | Install-ChocoPackage
Unregister-ChocoSource privateRepo

Foil integrates with Choco.exe to manage and store source information

Pass in package parameters

The Install-ChocoPackage cmdlet allows passing package parameters.

Install-ChocoPackage sysinternals -AcceptLicense -ParamsGlobal -Params '/InstallDir:c:\windows\temp\sysinternals /QuickLaunchShortcut:false' -Verbose

Known Issues

Compatibility

Foil works with PowerShell for both FullCLR/'Desktop' (ex 5.1) and CoreCLR (ex: 7.0.1), though Chocolatey itself still requires FullCLR.

The -LocalOnly switch for Get-ChocoPackage becomes deprecated when used with Chocolatey v2.0.0, due to it becoming redundant with a change to choco list (see chocolatey/choco#158).

The use of Get-ChocoPackage for package search operations (and it's -Source parameter) is deprecated, as Get-ChocoPackage only looks at installed packages beginning with Chocolatey v2.0.0 and higher. Users must upgrade to Foil v0.3.0 or higher and migrate package search operations to Find-ChocoPackage prior to the release of Chocolatey v2.0.0 to ensure continued compatibility.

Legal and Licensing

Foil is licensed under the MIT license.

foil's People

Contributors

ethanbergstrom avatar chrisfoulstone avatar halderex avatar

Stargazers

RyzeNGrind avatar Matt Cargile avatar Jake avatar Patrick Wahlmueller avatar Paul Broadwith avatar  avatar Cyril Madigan avatar  avatar  avatar Rayat Rahman avatar Andre Attamimi avatar brock chapin avatar fatherofinvention avatar Jimmy Briggs avatar JumptoHistory avatar geogboe avatar ethzero avatar James Ruskin avatar  avatar Edgar Chinchilla avatar

Watchers

Paul Broadwith avatar  avatar

foil's Issues

$output -match 'fail' regex too generic

Hi,

I'm having problems with Foil and ChocolateyGet.

$failures = ($output -match 'fail')

This seems too generic of a regex.

E.g. Installing 'office365business' via DSC and ChocolateyGet, I got:

             [[PackageManagement]office365business] Installing the following

packages:
Office365Business
By installing you accept licenses for the packages.

Office365Business v13901.20336 [Approved]
office365business package files install completed. Performing other installation steps.
No custom configuration specified. Generating one...
No Product ID specified, using default: O365BusinessRetail
No excluded apps specified, installing all
No Language ID specified, using default: MatchOS
No updates value specified, using default: TRUE
No updates value specified, using default: TRUE
C:\windows\TEMP\chocolatey\Office365Business
Add
Updates
Display
Logging
RemoveMSI
Downloading Office365DeploymentTool
from
'https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_13901-20336.ex
e'

Download of officedeploymenttool_13901-20336.exe (3.35 MB) completed.
Hashes match.
Installing Office365DeploymentTool...
Office365DeploymentTool has been installed.
Installing Office365BusinessInstaller...
Office365BusinessInstaller has been installed.
Installing Office365Business...
Office365Business has been installed.
Cannot remove item C:\windows\TEMP\chocolatey\Office365Business: The process cannot access the file
'C:\windows\TEMP\chocolatey\Office365Business' because it is being used by another process.
Only an exit code of non-zero will fail the package by default. Set
-- **failonstderr** if you want error messages to also fail a script. See
choco -h for details.
office365business may be able to be automatically uninstalled.
The install of office365business was successful.
Software installed to 'C:\Program Files\Microsoft Office'

Chocolatey installed 1/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Similarly, installing "sysinernals" to a custom location with ChocolateyGet results in a warning that has the word "fail" because it tries to referesh the environment variables.

Empty string parameters are not passed correctly to choco.exe

When a user provides an empty string as the value of a parameter, such as --parameters or --install-arguments (which is perfectly legal by choco.exe rules), the empty string is not quoted in the command line passed to choco.exe, so it effectively "disappears", breaking the command line (because the next nonblank token will be interpreted as the value of that parameter and all following parameters will be parsed incorrectly).

Example:

Install-ChocoPackage -Name cpu-z -Parameters ''

This should be a valid invocation and would work correctly from cmd.exe (choco install cpu-z --parameters ""). However, with Foil, the command line passed to choco.exe will be either
choco install cpu-z --parameters
or
choco install --parameters cpu-z
(the ordering is not deterministic, because the parameters do not have OriginalPosition defined in Foil and are put in a hashtable, so there are no guarantees and the ordering may change between, for example, .NET versions, including monthly patches)

Both possible command lines sent by Foil are obviously broken.

The root problem seems to be in Crescendo (I've submitted PowerShell/Crescendo#100) and is a consequence of unfortunate PowerShell behavior with regard to passing parameters to native executables, which Crescendo does not take into account.

Considering that the upstream issue may take time to fix (it may be seen as controversial/by design), perhaps it would be best to make Foil immune to it. Given that choco supports also the "equals" syntax (--package-parameters="foo bar"), changing the parameter definitions in Foil to use that syntax might fix the problem without depending on Crescendo changes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.