diff --git a/Policy-install-latest-xcode.xml b/Policy-install-latest-xcode.xml new file mode 100644 index 0000000..25ed91e --- /dev/null +++ b/Policy-install-latest-xcode.xml @@ -0,0 +1,55 @@ + + + + %POLICY_NAME% + true + Ongoing + + %POLICY_CATEGORY% + + + + + + %GROUP_NAME% + + + + + + 1 + + %pkg_name% + Install + + + + + 1 + + + + true + %INSTALL_BUTTON_TEXT% - %version% + %REINSTALL_BUTTON_TEXT% - %version% + %SELF_SERVICE_DISPLAY_NAME% + %SELF_SERVICE_DESCRIPTION% + + + true + + + %POLICY_RUN_COMMAND% + + diff --git a/Xcode/Xcode.download.recipe.yaml b/Xcode/Xcode.download.recipe.yaml index dc0c098..0b636c2 100644 --- a/Xcode/Xcode.download.recipe.yaml +++ b/Xcode/Xcode.download.recipe.yaml @@ -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' diff --git a/Xcode/Xcode.extract.recipe.yaml b/Xcode/Xcode.extract.recipe.yaml index 6fb0cd4..eb54db3 100644 --- a/Xcode/Xcode.extract.recipe.yaml +++ b/Xcode/Xcode.extract.recipe.yaml @@ -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: @@ -28,8 +28,3 @@ Process: CFBundleShortVersionString: version CFBundleVersion: bundle_version ProductBuildVersion: build_version - - - Processor: XcodeVersioner - Arguments: - app_path: '%found_filename%' - version: '%version%' diff --git a/Xcode/Xcode.jamf.recipe.yaml b/Xcode/Xcode.jamf.recipe.yaml index 6d3ba50..9ae2bad 100644 --- a/Xcode/Xcode.jamf.recipe.yaml +++ b/Xcode/Xcode.jamf.recipe.yaml @@ -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' @@ -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%' diff --git a/Xcode/Xcode.jss.recipe.yaml b/Xcode/Xcode.jss.recipe.yaml index ad37c41..10f1efb 100644 --- a/Xcode/Xcode.jss.recipe.yaml +++ b/Xcode/Xcode.jss.recipe.yaml @@ -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%' diff --git a/Xcode/Xcode.pkg.recipe.yaml b/Xcode/Xcode.pkg.recipe.yaml index bab8deb..b6121e6 100644 --- a/Xcode/Xcode.pkg.recipe.yaml +++ b/Xcode/Xcode.pkg.recipe.yaml @@ -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%' diff --git a/Xcode/XcodeVersioner.py b/Xcode/XcodeVersioner.py index 92e799f..f8a232d 100644 --- a/Xcode/XcodeVersioner.py +++ b/Xcode/XcodeVersioner.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/local/autopkg/python # # Copyright (c) Facebook, Inc. and its affiliates. # diff --git a/Xcode/XcodeXIPUnpacker.py b/Xcode/XcodeXIPUnpacker.py index e3815c4..bad7d81 100644 --- a/Xcode/XcodeXIPUnpacker.py +++ b/Xcode/XcodeXIPUnpacker.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/local/autopkg/python # # Copyright (c) Facebook, Inc. and its affiliates. # diff --git a/Xcode/XcodePostinstall.sh b/Xcode/autopkg_xcode_postinstall.sh similarity index 61% rename from Xcode/XcodePostinstall.sh rename to Xcode/autopkg_xcode_postinstall.sh index aa51872..89031fc 100644 --- a/Xcode/XcodePostinstall.sh +++ b/Xcode/autopkg_xcode_postinstall.sh @@ -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 \ No newline at end of file