Skip to content

Commit

Permalink
Updated build process + UI tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jordywitteman committed Jul 14, 2023
1 parent f9fceec commit e36f11d
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 14 deletions.
32 changes: 24 additions & 8 deletions pkgbuild/build_pkg.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ scripts="scripts"
# Path to Component plist
component_plist="Support-component.plist"

# Requirements plist
requirements_plist="requirements.plist"

# Distribution xml
distribution_xml="distribution.xml"

# Install location
install_location="/Applications"

Expand All @@ -66,31 +72,41 @@ username=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /logi
# NFS Home Directory of user
nfs_home_directory=$(dscl . read /Users/${username} NFSHomeDirectory | awk '{print $2}')

# Create directory
mkdir -p "${nfs_home_directory}/Downloads/${app_name}_${version}"

# Build and export pkg to Downloads folder
pkgbuild --component-plist "${component_plist}" \
--root "${payload}" \
--scripts "${scripts}" \
--install-location "${install_location}" \
--identifier "${bundle_identifier}" \
--version "${version}" \
"${nfs_home_directory}/Downloads/${app_name} ${version}_unsigned.pkg"
"${nfs_home_directory}/Downloads/${app_name}_${version}/Support_component.pkg"

# Create basic Distribution file
# productbuild --synthesize \
# --package "${nfs_home_directory}/Downloads/${app_name}_${version}/Support_component.pkg" \
# --product "${requirements_plist}" \
# "${nfs_home_directory}/Downloads/${app_name}_${version}/distribution.xml"

# Create distribution package to support InstallApplication MDM command
productbuild --package "${nfs_home_directory}/Downloads/${app_name} ${version}_unsigned.pkg" \
"${nfs_home_directory}/Downloads/${app_name} ${version}_dist.pkg"
productbuild --distribution "${distribution_xml}" \
--package-path "${nfs_home_directory}/Downloads/${app_name}_${version}/" \
"${nfs_home_directory}/Downloads/${app_name}_${version}/${app_name} ${version}_dist.pkg"

# Sign package
productsign --sign "${signing_identity}" \
"${nfs_home_directory}/Downloads/${app_name} ${version}_dist.pkg" \
"${nfs_home_directory}/Downloads/${app_name} ${version}.pkg"
"${nfs_home_directory}/Downloads/${app_name}_${version}/${app_name} ${version}_dist.pkg" \
"${nfs_home_directory}/Downloads/${app_name}_${version}/${app_name} ${version}.pkg"

# Submit pkg to notarytool
xcrun notarytool submit "${nfs_home_directory}/Downloads/${app_name} ${version}.pkg" \
xcrun notarytool submit "${nfs_home_directory}/Downloads/${app_name}_${version}/${app_name} ${version}.pkg" \
--keychain-profile "${keychain_profile}" \
--wait

# Staple the notarization ticket to the pkg
xcrun stapler staple "${nfs_home_directory}/Downloads/${app_name} ${version}.pkg"
xcrun stapler staple "${nfs_home_directory}/Downloads/${app_name}_${version}/${app_name} ${version}.pkg"

# Check the notarization ticket validity
spctl --assess -vv --type install "${nfs_home_directory}/Downloads/${app_name} ${version}.pkg"
spctl --assess -vv --type install "${nfs_home_directory}/Downloads/${app_name}_${version}/${app_name} ${version}.pkg"
21 changes: 21 additions & 0 deletions pkgbuild/distribution.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<installer-gui-script minSpecVersion="2">
<title>Support App</title>
<pkg-ref id="nl.root3.support"/>
<options customize="never" require-scripts="false" hostArchitectures="x86_64,arm64"/>
<volume-check>
<allowed-os-versions>
<os-version min="11"/>
</allowed-os-versions>
</volume-check>
<choices-outline>
<line choice="default">
<line choice="nl.root3.support"/>
</line>
</choices-outline>
<choice id="default"/>
<choice id="nl.root3.support" visible="false">
<pkg-ref id="nl.root3.support"/>
</choice>
<pkg-ref id="nl.root3.support" version="%SUPPORT_VERSION%" onConclusion="none">Support_component.pkg</pkg-ref>
</installer-gui-script>
10 changes: 10 additions & 0 deletions pkgbuild/requirements.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>os</key>
<array>
<string>11</string>
</array>
</dict>
</plist>
2 changes: 0 additions & 2 deletions src/Support.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,6 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CODE_SIGN_ENTITLEMENTS = Support/Support.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1656517987;
Expand Down Expand Up @@ -586,7 +585,6 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CODE_SIGN_ENTITLEMENTS = Support/Support.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1656517987;
Expand Down
1 change: 1 addition & 0 deletions src/Support/Views/HeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct HeaderView: View {
Text(.init(preferences.title.replaceLocalVariables(computerInfo: computerinfo, userInfo: userinfo)))
.font(.system(size: 20, design: .rounded))
.fontWeight(.medium)
.fixedSize()

Spacer()

Expand Down
9 changes: 5 additions & 4 deletions src/Support/Views/UpdateView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,17 @@ struct UpdateView: View {
Divider()
.padding(2)

HStack {
HStack(alignment: .top) {

Image(systemName: "info.circle")
Image(systemName: "info.circle.fill")
.font(.headline)
.imageScale(.large)
.foregroundColor(color)

// Supports for markdown through a variable:
// https://blog.eidinger.info/3-surprises-when-using-markdown-in-swiftui
Text(.init(preferences.updateText.replaceLocalVariables(computerInfo: computerinfo, userInfo: userinfo)))
.font(.system(.headline, design: .rounded))
.fontWeight(.medium)
.font(.system(.body, design: .rounded))

Spacer()
}
Expand Down

0 comments on commit e36f11d

Please sign in to comment.