Skip to content

Commit

Permalink
chrome example recipe with new processor
Browse files Browse the repository at this point in the history
  • Loading branch information
jgstew committed Dec 13, 2023
1 parent b1fcb06 commit ffbe190
Show file tree
Hide file tree
Showing 4 changed files with 194 additions and 0 deletions.
1 change: 1 addition & 0 deletions .templates/.partials/TitlePrefix.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{^install_only}}{{^patch}}Install/{{/patch}}Update{{/install_only}}{{#install_only}}Install{{/install_only}}:
62 changes: 62 additions & 0 deletions Google/Chrome-Win-Install_Update.bes.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
<{{TypeTaskOrFixlet}}{{^TypeTaskOrFixlet}}Task{{/TypeTaskOrFixlet}}>
<Title>{{>TitlePrefix}} {{DisplayName}} v{{version}} - Windows{{#64BitOnly}} (x64){{/64BitOnly}}</Title>
<Description><![CDATA[
{{>DescriptionBasic}}
{{>DescriptionIcon}}
]]></Description>
<Relevance>windows of operating system</Relevance>
{{#64BitOnly}}
<Relevance><![CDATA[x64 of operating system]]></Relevance>
{{/64BitOnly}}
{{#patch}}{{#DisplayName}}
<Relevance><![CDATA[{{#install_only}}not {{/install_only}}exists keys whose(value "DisplayName" of it as string starts with "{{DisplayName}}") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)]]></Relevance>
{{/DisplayName}}{{/patch}}
{{^install_only}}
<Relevance><![CDATA[not exists (it as string as version) whose(it >= "{{version}}") of values "DisplayVersion" of keys whose(value "DisplayName" of it as string starts with "{{DisplayName}}") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)]]></Relevance>
{{/install_only}}
<Category>{{>Category}}</Category>
<DownloadSize>{{DownloadSize}}{{^DownloadSize}}0{{/DownloadSize}}</DownloadSize>
<Source>{{VendorFolder}}</Source>
<SourceID>BigFix</SourceID>
<SourceReleaseDate>{{SourceReleaseDate}}</SourceReleaseDate>
<SourceSeverity></SourceSeverity>
<CVENames></CVENames>
<SANSID></SANSID>
<MIMEField>
<Name>action-ui-metadata</Name>
<Value>{{>action-ui-metadata}}</Value>
</MIMEField>
<MIMEField>
<Name>x-fixlet-modification-time</Name>
<Value>{{x-fixlet-modification-time}}</Value>
</MIMEField>
<Domain>BESC</Domain>
<DefaultAction ID="Action1">
<Description>
<PreLink><![CDATA[Click ]]></PreLink>
<Link>here</Link>
<PostLink><![CDATA[ to deploy {{DisplayName}} v{{version}}.]]></PostLink>
</Description>
<ActionScript MIMEType="application/x-Fixlet-Windows-Shell"><![CDATA[
// Download:
begin prefetch block
{{{prefetch}}}
end prefetch block
// Install:
override wait
hidden=true
completion=job
timeout_seconds=3600
disposition=terminate
wait __Download\{{{file_name}}} /silent /install --system-level
// https://chromium.googlesource.com/chromium/src/+/master/chrome/installer/mini_installer/
// End]]></ActionScript>
<SuccessCriteria Option="OriginalRelevance"></SuccessCriteria>
</DefaultAction>
</{{TypeTaskOrFixlet}}{{^TypeTaskOrFixlet}}Task{{/TypeTaskOrFixlet}}>
</BES>
103 changes: 103 additions & 0 deletions Google/Chrome-Win.bigfix.recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
Description: Generates a BigFix Task for the latest Chrome-Win
Identifier: com.github.jgstew.bigfix.Chrome-Win
Input:
# Name: Short Name of the Software, No spaces, Example: "DBBrowserforSQLite"
NAME: "Chrome-Win"
# DisplayName: The start of the DisplayName key in the Windows Registry, Example: "DB Browser for SQLite"
DisplayName: "Google Chrome"
VendorFolder: Google
64BitOnly: True
template_file_path: "./%VendorFolder%/%NAME%-Install_Update.bes.mustache"
# MinimumVersion of AutoPkg - Should always be 2.3 (or higher once a new version is released)
MinimumVersion: "2.3"
ParentRecipe: com.github.jgstew.download.Chrome-Win
Process:
# `SharedUtilityMethods` must come first
- Processor: com.github.jgstew.SharedProcessors/SharedUtilityMethods
# `BigFixPrefetchItem` takes the hashes from `URLDownloaderPython`
# Then it assembles them into a BigFix Prefetch Statement or Block
- Processor: com.github.jgstew.SharedProcessors/BigFixPrefetchItem
Arguments:
file_name: chrome_installer.exe
file_sha1: ""
file_sha256: "%chrome_package_sha256%"
file_size: "%chrome_package_size%"
prefetch_type: block
# prefetch_url: "%url%"

# remove empty sha1= from prefetch:
- Processor: com.github.jgstew.SharedProcessors/TextSubstitutionRegEx
Arguments:
input_string: "%bigfix_prefetch_item%"
re_pattern: " sha1= "
re_substitution: " "
result_output_var_name: bigfix_prefetch_item

# `BigFixSetupTemplateDictionary` creates a dictionary to fill out a bigix content template
# If `SourceReleaseDate` is not provided, it will be set to today
- Processor: com.github.jgstew.SharedProcessors/BigFixSetupTemplateDictionary

- Processor: com.github.jgstew.SharedProcessors/TemplateDictionaryAppendInput

- Processor: com.github.jgstew.SharedProcessors/TemplateDictionaryAppend
Arguments:
append_key: "DownloadSize"
append_value: "%chrome_package_size%"

- Processor: com.github.jgstew.SharedProcessors/URLDownloaderPython
Arguments:
filename: "%NAME%-icon.png"
url: https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Google_Chrome_icon_%28September_2014%29.svg/64px-Google_Chrome_icon_%28September_2014%29.svg.png
COMPUTE_HASHES: false

- Processor: com.github.jgstew.SharedProcessors/FileGetBase64

- Processor: com.github.jgstew.SharedProcessors/TemplateDictionaryAppend
Arguments:
append_key: "icon_base64"
append_value: "%file_base64%"

# Generate Install/Update content:

# `ContentFromTemplate` generates bigfix content from a mustache template file
# The file is filled out with variables from the Template Dictionary
# If variables are missing from the Template Dictionary, then that area will be blank
- Processor: com.github.jgstew.SharedProcessors/ContentFromTemplate
Arguments:
template_file_path: "%template_file_path%"
content_file_pathname: "%RECIPE_CACHE_DIR%/%NAME%.bes"

# `BESImport` imports the generated BES content into a BigFix Server
# Which server and credentials are used is dictated by `~/.besapi.conf`
- Processor: com.github.jgstew.SharedProcessors/BESImport

# `BigFixActioner` creates an action from the imported BigFix Content
# The action is an offer that requires user interaction to run in self service application
# The action targets all computers whose name contains `autopkg`
- Processor: com.github.jgstew.SharedProcessors/BigFixActioner

# Generate Update only content:
- Processor: com.github.jgstew.SharedProcessors/TemplateDictionaryAppend
Arguments:
append_key: "patch"
append_value: True

- Processor: com.github.jgstew.SharedProcessors/ContentFromTemplate
Arguments:
# template_file_path: "%template_file_path%"
content_file_pathname: "%RECIPE_CACHE_DIR%/%NAME%-Update.bes"

- Processor: com.github.jgstew.SharedProcessors/BESImport

# Generate Install Only Content:
- Processor: com.github.jgstew.SharedProcessors/TemplateDictionaryAppend
Arguments:
append_key: "install_only"
append_value: true

- Processor: com.github.jgstew.SharedProcessors/ContentFromTemplate
Arguments:
# template_file_path: "%template_file_path%"
content_file_pathname: "%RECIPE_CACHE_DIR%/%NAME%-InstallOnly.bes"
- Processor: com.github.jgstew.SharedProcessors/BESImport
28 changes: 28 additions & 0 deletions Google/Chrome-Win.download.recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
Description: Downloads the latest version of Chrome for Windows
# based upon https://github.com/autopkg/ahousseini-recipes/blob/master/Chrome/Chrome.download.recipe
Identifier: com.github.jgstew.download.Chrome-Win
Input:
NAME: Chrome
MinimumVersion: "2.3"
Process:
# `SharedUtilityMethods` must come first
- Processor: com.github.jgstew.SharedProcessors/SharedUtilityMethods

# https://github.com/jgstew/jgstew-recipes/blob/main/SharedProcessors/GoogleChromeUpdateInfoProvider.py
- Processor: com.github.jgstew.SharedProcessors/GoogleChromeUpdateInfoProvider

- Processor: EndOfCheckPhase
# Arguments:
# # need to add the package name onto the URL:
# url: "%url%%chrome_package_name%"

- Processor: com.github.jgstew.SharedProcessors/AssertInputContainsString
Arguments:
input_string: "%chrome_package_name%"
assert_string: "chrome_installer."

- Processor: com.github.jgstew.SharedProcessors/TextSearcher
Arguments:
input_string: "%chrome_package_name%"
re_pattern: '(?P<version>\d+(\.\d+)+)'

0 comments on commit ffbe190

Please sign in to comment.