Skip to content

Commit

Permalink
Xcode Modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
smithjw committed Nov 24, 2021
1 parent 0452099 commit 1a6cbdf
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 52 deletions.
55 changes: 55 additions & 0 deletions Policy-install-latest-xcode.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<policy>
<general>
<name>%POLICY_NAME%</name>
<enabled>true</enabled>
<frequency>Ongoing</frequency>
<category>
<name>%POLICY_CATEGORY%</name>
</category>
</general>
<scope>
<computer_groups>
<computer_group>
<name>%GROUP_NAME%</name>
</computer_group>
</computer_groups>
</scope>
<package_configuration>
<packages>
<size>1</size>
<package>
<name>%pkg_name%</name>
<action>Install</action>
</package>
</packages>
</package_configuration>
<scripts>
<size>1</size>
<script>
<name>%SCRIPT_NAME%</name>
<priority>%SCRIPT_PRIORITY%</priority>
<parameter4>%version%</parameter4>
<parameter5/>
<parameter6/>
<parameter7/>
<parameter8/>
<parameter9/>
<parameter10/>
<parameter11/>
</script>
</scripts>
<self_service>
<use_for_self_service>true</use_for_self_service>
<install_button_text>%INSTALL_BUTTON_TEXT% - %version%</install_button_text>
<reinstall_button_text>%REINSTALL_BUTTON_TEXT% - %version%</reinstall_button_text>
<self_service_display_name>%SELF_SERVICE_DISPLAY_NAME%</self_service_display_name>
<self_service_description>%SELF_SERVICE_DESCRIPTION%</self_service_description>
</self_service>
<maintenance>
<recon>true</recon>
</maintenance>
<files_processes>
<run_command>%POLICY_RUN_COMMAND%</run_command>
</files_processes>
</policy>
43 changes: 22 additions & 21 deletions Xcode/Xcode.download.recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,31 @@ Input:
HOME: '~'
XIP_PATH: '/Users/*/Downloads'
XIP_NAME: 'Xcode_*.xip'
SEARCH_PREDICATE: '"%found_filename%" == "File Not Found"'

Process:
- Processor: FileFinderMod
Arguments:
pattern: '%XIP_PATH%/%XIP_NAME%'
- Processor: FileFinderMod
Arguments:
pattern: '%XIP_PATH%/%XIP_NAME%'

- Processor: StopProcessingIf
Arguments:
predicate: '"%found_filename%" == "File Not Found"'
- Processor: StopProcessingIf
Arguments:
predicate: '%SEARCH_PREDICATE%'

# This is a very hacky hack to get the Version
- Processor: com.github.homebysix.VersionSplitter/VersionSplitter
Arguments:
version: '%found_filename%'
split_on: _
index: 1
# This is a very hacky hack to get the Version
- Processor: com.github.homebysix.VersionSplitter/VersionSplitter
Arguments:
version: '%found_filename%'
split_on: _
index: 1

- Processor: com.github.homebysix.VersionSplitter/VersionSplitter
Arguments:
version: '%version%'
split_on: .xip
index: 0
- Processor: com.github.homebysix.VersionSplitter/VersionSplitter
Arguments:
version: '%version%'
split_on: .xip
index: 0

- Processor: FileMover
Arguments:
source: '%found_filename%'
target: '%RECIPE_CACHE_DIR%/%NAME%-%version%.xip'
- Processor: FileMover
Arguments:
source: '%found_filename%'
target: '%RECIPE_CACHE_DIR%/%NAME%-%version%.xip'
9 changes: 2 additions & 7 deletions Xcode/Xcode.extract.recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Process:
- Processor: XcodeXIPUnpacker
Arguments:
PKG: '%RECIPE_CACHE_DIR%/%NAME%-%version%.xip'
output_path: '%RECIPE_CACHE_DIR%/%NAME%'
output_path: '%RECIPE_CACHE_DIR%/%NAME%/Applications'

- Processor: FileFinder
Arguments:
pattern: '%RECIPE_CACHE_DIR%/%NAME%/*.app'
pattern: '%RECIPE_CACHE_DIR%/%NAME%/Applications/*.app'

- Processor: CodeSignatureVerifier
Arguments:
Expand All @@ -28,8 +28,3 @@ Process:
CFBundleShortVersionString: version
CFBundleVersion: bundle_version
ProductBuildVersion: build_version

- Processor: XcodeVersioner
Arguments:
app_path: '%found_filename%'
version: '%version%'
13 changes: 12 additions & 1 deletion Xcode/Xcode.jamf.recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ Input:
GROUP_TEMPLATE: SmartGroup-update-smart-regex.xml
TESTING_GROUP_NAME: Testing
POLICY_CATEGORY: Testing
POLICY_TEMPLATE: Policy-install-latest.xml
POLICY_TEMPLATE: Policy-install-latest-xcode.xml
POLICY_NAME: 'Install Latest %NAME%'
POLICY_RUN_COMMAND: 'chown -R "$(stat -f%Su /dev/console):staff" "/Applications/%NAME%.app" && echo "Corrected permissions for %NAME%."'
SCRIPT_NAME: 'autopkg_xcode_postinstall.sh'
SCRIPT_PRIORITY: 'After'
SCRIPT_PARAMETER4_TITLE: 'Xcode Version'
SELF_SERVICE_CATEGORY: '%CATEGORY%'
SELF_SERVICE_DISPLAY_NAME: 'Install Latest %NAME%'
SELF_SERVICE_DESCRIPTION: 'Xcode includes everything developers need to create great applications for Mac, iPhone, iPad, Apple TV, and Apple Watch.'
SELF_SERVICE_ICON: '%NAME%.png'
Expand All @@ -30,6 +34,13 @@ Process:
Arguments:
pkg_category: '%CATEGORY%'

- Processor: com.github.grahampugh.jamf-upload.processors/JamfScriptUploader
Arguments:
script_category: '%SELF_SERVICE_CATEGORY%'
script_path: '%SCRIPT_NAME%'
script_priority: '%SCRIPT_PRIORITY%'
script_parameter4: '%SCRIPT_PARAMETER4_TITLE%'

- Processor: StopProcessingIf
Arguments:
predicate: '%UPDATE_PREDICATE%'
Expand Down
34 changes: 17 additions & 17 deletions Xcode/Xcode.jss.recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ Input:
OS_REQUIREMENTS: '11.3'
POLICY_CATEGORY: Testing
POLICY_TEMPLATE: PolicyTemplate.xml
SCRIPT_NAME: 'autopkg_xcode_postinstall.sh'
SCRIPT_TEMPLATE: 'XcodeScriptTemplate.xml'
SELF_SERVICE_DESCRIPTION: Xcode includes everything developers need to create great applications for Mac, iPhone, iPad, Apple TV, and Apple Watch.
SELF_SERVICE_ICON: '%NAME%.png'
pkg_path: '%RECIPE_CACHE_DIR%/%NAME%-%major_version%.%minor_version%.dmg'


Process:
- Processor: JSSImporter
Arguments:
category: '%CATEGORY%'
groups:
- name: '%GROUP_NAME%'
smart: true
template_path: '%GROUP_TEMPLATE%'
policy_category: '%POLICY_CATEGORY%'
policy_template: '%POLICY_TEMPLATE%'
prod_name: '%NAME%'
scripts:
- name: XcodePostinstall.sh
template_path: XcodeScriptTemplate.xml
self_service_description: '%SELF_SERVICE_DESCRIPTION%'
self_service_icon: '%SELF_SERVICE_ICON%'
- Processor: JSSImporter
Arguments:
category: '%CATEGORY%'
groups:
- name: '%GROUP_NAME%'
smart: true
template_path: '%GROUP_TEMPLATE%'
policy_category: '%POLICY_CATEGORY%'
policy_template: '%POLICY_TEMPLATE%'
prod_name: '%NAME%'
scripts:
- name: '%SCRIPT_NAME%'
template_path: '%SCRIPT_TEMPLATE%'
self_service_description: '%SELF_SERVICE_DESCRIPTION%'
self_service_icon: '%SELF_SERVICE_ICON%'
8 changes: 6 additions & 2 deletions Xcode/Xcode.pkg.recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ Process:
- Processor: FileMover
Arguments:
source: '%found_filename%'
target: '%RECIPE_CACHE_DIR%/%NAME%/Applications/%NAME%-%major_version%.%minor_version%.app'
target: '%RECIPE_CACHE_DIR%/%NAME%/Applications/%NAME%-%version%.app'

- Processor: DmgCreator
Arguments:
dmg_path: '%RECIPE_CACHE_DIR%/%NAME%-%major_version%.%minor_version%.dmg'
dmg_path: '%RECIPE_CACHE_DIR%/%NAME%-%version%.dmg'
dmg_root: '%RECIPE_CACHE_DIR%/%NAME%'

- Processor: PathDeleter
Arguments:
path_list:
- '%RECIPE_CACHE_DIR%/%NAME%'

- Processor: EndOfCheckPhase
Arguments:
pkg_path: '%dmg_path%'
2 changes: 1 addition & 1 deletion Xcode/XcodeVersioner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/local/autopkg/python
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
Expand Down
2 changes: 1 addition & 1 deletion Xcode/XcodeXIPUnpacker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/local/autopkg/python
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
/usr/sbin/DevToolsSecurity -enable

# Accept the license
/Applications/%fixed_filename%/Contents/Developer/usr/bin/xcodebuild -license accept
/Applications/Xcode-"$4".app/Contents/Developer/usr/bin/xcodebuild -license accept

# Install embedded packages
for PKG in $(/bin/ls /Applications/%fixed_filename%/Contents/Resources/Packages/*.pkg); do
for PKG in $(/bin/ls /Applications/Xcode-"$4".app/Contents/Resources/Packages/*.pkg); do
/usr/sbin/installer -pkg "$PKG" -target /
done

0 comments on commit 1a6cbdf

Please sign in to comment.