@@ -15,10 +15,11 @@ and verifies the uploaded package’s SHA3_512 hash.
1515
1616Steps:
17171. Calculate the SHA3_512 of the local file before uploading (initialHash).
18- 2. Create package metadata in Jamf Pro (Package name, etc.).
19- 3. Upload the actual file to Jamf Pro.
20- 4. Poll Jamf Pro until the uploaded package’s SHA3_512 hash is present or until max retries are reached.
21- 5. Compare Jamf Pro’s hash with the initially calculated hash to ensure data integrity.
18+ 2. Calculate the MD5 hash of the file for metadata.
19+ 3. Create package metadata in Jamf Pro (Package name, etc.).
20+ 4. Upload the actual file to Jamf Pro.
21+ 5. Poll Jamf Pro until the uploaded package’s SHA3_512 hash is present or until max retries are reached.
22+ 6. Compare Jamf Pro’s hash with the initially calculated hash to ensure data integrity.
2223
2324Arguments:
2425- filePath: The path to the local package file to be uploaded.
@@ -34,13 +35,20 @@ Usage:
3435- Call DoPackageUpload with the path of your package and that resource data.
3536*/
3637func (c * Client ) DoPackageUpload (filePath string , packageData * ResourcePackage ) (* ResponsePackageCreatedAndUpdated , error ) {
38+ pkgName := filepath .Base (filePath )
39+
3740 initialHash , err := CalculateSHA3_512 (filePath )
3841 if err != nil {
3942 return nil , fmt .Errorf ("failed to calculate initial SHA3_512: %v" , err )
4043 }
4144
42- pkgName := filepath .Base (filePath )
45+ md5Hash , err := CalculateMD5 (filePath )
46+ if err != nil {
47+ return nil , fmt .Errorf ("failed to calculate MD5: %v" , err )
48+ }
49+
4350 packageData .FileName = pkgName
51+ packageData .MD5 = md5Hash
4452 metadataResponse , err := c .CreatePackage (* packageData )
4553 if err != nil {
4654 return nil , fmt .Errorf ("failed to create package metadata in Jamf Pro: %v" , err )
0 commit comments