1dustindavis / gorilla

Munki-like Application Management for Windows
Apache License 2.0
188 stars 21 forks source link

Feature Request: option to store scripts as discrete files on web server instead of embedding #106

Open discentem opened 3 years ago

discentem commented 3 years ago

Right now Gorilla requires users to embed check, pre-install, and post-install scripts in Catalogs. I'd love to see an option to store these scripts on the web server as normal .ps1 files and point to them with relative paths from the Catalog. I'm happy to write a pull request, I just have some questions.

1) Would you accept such a feature? 2) Should I cache the scripts on the client and reuse your already-built IfNeeded machinery? 3) I am thinking I am going to need to add new keys to Item and InstallCheck. Any preference or opinions on the names of the new keys? I was thinking something like PreScriptPath, PostScriptPath, and ScriptPath.

Example:

type Item struct {
    Dependencies []string      `yaml:"dependencies"`
    DisplayName  string        `yaml:"display_name"`
    Check        InstallCheck  `yaml:"check"`
    Installer    InstallerItem `yaml:"installer"`
    Uninstaller  InstallerItem `yaml:"uninstaller"`
    Version      string        `yaml:"version"`
    BlockingApps []string      `yaml:"blocking_apps"`
    PreScript    string        `yaml:"preinstall_script"`
    PreScriptPath string `yaml:"preinstall_script_path"` // <--- new key
    PostScript   string        `yaml:"postinstall_script"`
    PostScriptPath string `yaml:"postinstall_script_path"` // <--- new key
}
....

type InstallCheck struct {
    File     []FileCheck `yaml:"file"`
    Script   string      `yaml:"script"` 
    ScriptPath string `yaml:"scriptPath"` // <--- new key
    Registry RegCheck    `yaml:"registry"`
}
....

Thanks! Brandon

grahamgilbert commented 3 years ago

You will probably want to checksum the scripts too.

1dustindavis commented 3 years ago
  1. Yes, this would be great! We already keep the scripts in a separate directory to make code review easier, so this would remove a step in our workflow 👍
  2. Yes, I think caching is needed. Using the existing ifNeeded function is ideal since that gets you checksum verification and unit tests for "free".
  3. I think the names you are proposing makes sense. As Graham posted out, you will also need to add keys for the hash too.