Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified Geneious download recipe to support latest version (2019) #96

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion Geneious/Geneious.download.recipe
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ See http://desktop-links.geneious.com/assets/installers/geneious/GeneiousVersion
<dict>
<key>NAME</key>
<string>Geneious</string>
<key>APPNAME</key>
<string>Geneious</string>
<key>MAJOR_VERSION</key>
<string>10</string>
<key>RELEASE</key>
Expand All @@ -35,6 +37,19 @@ See http://desktop-links.geneious.com/assets/installers/geneious/GeneiousVersion
<string>%MAJOR_VERSION% %RELEASE% %RELEASE%.*(Geneious.*mac.*dmg)</string>
</dict>
</dict>
<dict>
<key>Processor</key>
<string>RegexReplace</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this needs to be formatted like so:
<string>com.github.n8felton.shared/RegexReplace</string>

<key>Arguments</key>
<dict>
<key>replace_pattern</key>
<string>-</string>
<key>source_string</key>
<string>%match%</string>
<key>replace_string</key>
<string>_</string>
</dict>
</dict>
<dict>
<key>Processor</key>
<string>URLDownloader</string>
Expand All @@ -54,7 +69,7 @@ See http://desktop-links.geneious.com/assets/installers/geneious/GeneiousVersion
<key>Arguments</key>
<dict>
<key>input_path</key>
<string>%pathname%/Geneious.app</string>
<string>%pathname%/%APPNAME%.app</string>
<key>requirement</key>
<string>identifier "com.biomatters.Geneious" and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = "3BTDDQD3L6"</string>
</dict>
Expand Down
2 changes: 2 additions & 0 deletions Geneious/Geneious.munki.recipe
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ NOTE: R6,7,8 requires Java 6. See https://support.geneious.com/entries/22070732-
<string>apps/Geneious</string>
<key>NAME</key>
<string>Geneious</string>
<key>APPNAME</key>
<string>Geneious</string>
<key>MUNKI_CATEGORY</key>
<string>Math &amp; Science</string>
<key>pkginfo</key>
Expand Down
60 changes: 60 additions & 0 deletions Geneious/RegexReplace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env python

from autopkglib import Processor, ProcessorError
import re

__all__ = ["RegexReplace"]


class RegexReplace(Processor):
'''Replaces all occurrences of a given pattern in the passed string.'''

input_variables = {
'replace_pattern': {
'description': 'Regular expression (Python) to match against string.',
'required': True,
},
'source_string': {
'description': 'String to use for matching.',
'required': True,
},
'replace_string': {
'description': 'String to use for replacing matches.',
'required': True,
},
'replace_count': {
'description': ('Count how many occurrences should be replaced,'
'starting from the left most match in "source_string"'),
'required': False,
'default': 0
},
'result_output_var_name': {
'description': ('The name of the output variable that is returned '
'by the replace. If not specified then a default of '
'"replaced_string" will be used.'),
'required': False,
'default': 'replaced_string',
},
}
output_variables = {
'result_output_var_name': {
'description': (
'The string with all occurrences of re_pattern replaced with'
'replace_string. Note the actual name of variable depends on the input '
'variable "result_output_var_name" or is assigned a default of '
'"replaced_string."')
}
}

def main(self):
output_var_name = self.env['result_output_var_name']
self.output_variables = {}
self.env[output_var_name] = re.sub(self.env['replace_pattern'], self.env['replace_string'],
self.env['source_string'],
self.env['replace_count'])
self.output_variables[output_var_name] = {'description': 'String with replacements.'}


if __name__ == '__main__':
PROCESSOR = RegexReplace()
PROCESSOR.execute_shell()