flare-vm icon indicating copy to clipboard operation
flare-vm copied to clipboard

Add run flag to package config entries

Open stevemk14ebr opened this issue 10 months ago • 1 comments

Details

Some packages (such as PDBReSym - https://github.com/mandiant/VM-Packages/pull/986#issuecomment-2051987881) have installer.ps1 files that not only install the tool, but run it. This is not ideal, there is a difference between installation of a tool and executing it. For this package in particular, we always want it to be installed, but do NOT always want it to be run because it can bloat the VM. I suggest we extend the installer.ps1 scripts to accept a run argument to indicate if the package should be run after installation. The config.xml files can have the flag present like this <package name="PDBReSym.vm" run=false/>. This way packages can be included in the default configuration always, but only run in FULL configurations sometimes.

stevemk14ebr avatar Apr 12 '24 15:04 stevemk14ebr

This seems fairly possible to do if we used this: https://docs.chocolatey.org/en-us/create/functions/get-packageparameters Note the part: choco install <pkg_id> --params "'/LICENSE:value;". We would use something like run instead, then inside of packages we could test for this to determine if it should be run or not.

Example 2:
# see https://docs.chocolatey.org/en-us/guides/create/parse-packageparameters-argument
# command line call: `choco install <pkg_id> --params "'/LICENSE:value'"`
$pp = Get-PackageParameters
# Read-Host, PromptForChoice, etc are not blocking calls with Chocolatey.
# Chocolatey has a custom PowerShell host that will time these calls
# after 30 seconds, allowing headless operation to continue but offer
# prompts to users to ask questions during installation.
if (!$pp['LICENSE']) { $pp['LICENSE'] = Read-Host 'License key?' }
# set a default if not passed
if (!$pp['LICENSE']) { $pp['LICENSE'] = '1234' }

That being said, I think https://github.com/mandiant/VM-Packages/issues/991 might be the way to go for now, but this may be something to consider down the road.

emtuls avatar Apr 12 '24 15:04 emtuls

https://github.com/mandiant/VM-Packages/issues/991 fixed this issue. I think splitting packages is a better approach as it uses the current structure. At the moment the packages do not receive arguments from the installer to run and It that would imply complicating the installer and the packages code.

Ana06 avatar May 13 '24 10:05 Ana06