-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from suvash/use-pkgbuild-for-installation
Use pkgbuild + productbuild for creating installer packages
- Loading branch information
Showing
23 changed files
with
301 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
*.zip | ||
*.mpkg | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
.DEFAULT_GOAL=help | ||
SHELL:=/usr/bin/env bash | ||
|
||
APP_ORG:=com.thapaliya | ||
APP_ID:=nepali-romanized | ||
APP_PKG:=install | ||
|
||
APP_PKG_ID:=$(APP_ORG).$(APP_ID).$(APP_PKG) | ||
$(info -- APP_PKG_ID is set to $(APP_PKG_ID)) | ||
|
||
# Remember to bump the version in Info.plist as well | ||
APP_VERSION:=4.0 | ||
$(info -- APP_VERSION is set to $(APP_VERSION)) | ||
|
||
BUILD_DIR:=build | ||
BUILD_TIMESTAMP:=$(shell TZ=Asia/Katmandu date) | ||
|
||
$(info -- ) | ||
|
||
.PHONY: help clean buil build-install-package build-productd | ||
|
||
help: ## Display this help | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) | ||
|
||
clean: ## Clean build directory | ||
$(info -- Cleaning build directory) | ||
rm -rf $(BUILD_DIR) | ||
|
||
build: clean build-install-package build-product ## Build the final product | ||
|
||
build-install-package: | ||
$(info -- Preparing installation package directory) | ||
mkdir -p $(BUILD_DIR)/installpkgroot/Library/Keyboard\ Layouts/ | ||
cp -aR lib/$(APP_ID).bundle $(BUILD_DIR)/installpkgroot/Library/Keyboard\ Layouts/ | ||
$(info -- Building installation package) | ||
mkdir -p $(BUILD_DIR)/package/ | ||
pkgbuild --identifier $(APP_PKG_ID) \ | ||
--version $(APP_VERSION) \ | ||
--root $(BUILD_DIR)/installpkgroot \ | ||
--scripts pkgdeps/scripts \ | ||
$(BUILD_DIR)/package/$(APP_PKG_ID).pkg | ||
|
||
build-product: | ||
$(info -- Preparing installation product directory) | ||
mkdir -p $(BUILD_DIR)/product/ | ||
cp -Rv productdeps $(BUILD_DIR)/_productdeps | ||
sed -i '' -e 's/__APP_VERSION__/$(APP_VERSION)/g' $(BUILD_DIR)/_productdeps/distribution.xml | ||
sed -i '' -e 's/__BUILD_TIMESTAMP__/$(BUILD_TIMESTAMP)/g' $(BUILD_DIR)/_productdeps/distribution.xml | ||
sed -i '' -e 's/__APP_PKG_ID__/$(APP_PKG_ID)/g' $(BUILD_DIR)/_productdeps/distribution.xml | ||
$(info -- Building installation product) | ||
productbuild --distribution $(BUILD_DIR)/_productdeps/distribution.xml \ | ||
--resources $(BUILD_DIR)/_productdeps/Resources \ | ||
--package-path $(BUILD_DIR)/package \ | ||
$(BUILD_DIR)/product/$(APP_ID)-$(APP_VERSION).pkg | ||
|
||
icon: ## Build the icns from the input PNG file | ||
$(info -- Building icns file from original png) | ||
mkdir -p /tmp/np-icon-tmpdir.iconset | ||
cp assets/original/ne.png /tmp/np-icon-tmpdir.iconset/icon.png | ||
sips -z 16 16 /tmp/np-icon-tmpdir.iconset/icon.png --out /tmp/np-icon-tmpdir.iconset/icon_16x16.png | ||
sips -z 32 32 /tmp/np-icon-tmpdir.iconset/icon.png --out /tmp/np-icon-tmpdir.iconset/[email protected] | ||
sips -z 32 32 /tmp/np-icon-tmpdir.iconset/icon.png --out /tmp/np-icon-tmpdir.iconset/icon_32x32.png | ||
sips -z 64 64 /tmp/np-icon-tmpdir.iconset/icon.png --out /tmp/np-icon-tmpdir.iconset/[email protected] | ||
sips -z 64 64 /tmp/np-icon-tmpdir.iconset/icon.png --out /tmp/np-icon-tmpdir.iconset/icon_64x64.png | ||
sips -z 128 128 /tmp/np-icon-tmpdir.iconset/icon.png --out /tmp/np-icon-tmpdir.iconset/[email protected] | ||
sips -z 128 128 /tmp/np-icon-tmpdir.iconset/icon.png --out /tmp/np-icon-tmpdir.iconset/icon_128x128.png | ||
sips -z 256 256 /tmp/np-icon-tmpdir.iconset/icon.png --out /tmp/np-icon-tmpdir.iconset/[email protected] | ||
sips -z 256 256 /tmp/np-icon-tmpdir.iconset/icon.png --out /tmp/np-icon-tmpdir.iconset/icon_256x256.png | ||
sips -z 512 512 /tmp/np-icon-tmpdir.iconset/icon.png --out /tmp/np-icon-tmpdir.iconset/[email protected] | ||
sips -z 512 512 /tmp/np-icon-tmpdir.iconset/icon.png --out /tmp/np-icon-tmpdir.iconset/icon_512x512.png | ||
sips -z 1024 1024 /tmp/np-icon-tmpdir.iconset/icon.png --out /tmp/np-icon-tmpdir.iconset/[email protected] | ||
sips -z 1024 1024 /tmp/np-icon-tmpdir.iconset/icon.png --out /tmp/np-icon-tmpdir.iconset/icon_1024x1024.png | ||
rm /tmp/np-icon-tmpdir.iconset/icon.png | ||
iconutil -c icns /tmp/np-icon-tmpdir.iconset | ||
mv /tmp/np-icon-tmpdir.icns assets/ne.icns | ||
rm -rf /tmp/np-icon-tmpdir.iconset |
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?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>CFBundleIdentifier</key> | ||
<string>com.thapaliya.ukelele.keyboardlayout.nepali-romanized</string> | ||
<key>CFBundleName</key> | ||
<string>nepali-romanized</string> | ||
<key>CFBundleVersion</key> | ||
<string>4.0</string> | ||
<key>KLInfo_Nepali (Romanized) - Pro</key> | ||
<dict> | ||
<key>TICapsLockLanguageSwitchCapable</key> | ||
<false/> | ||
<key>TISInputSourceID</key> | ||
<string>com.thapaliya.ukelele.keyboardlayout.nepali-romanized.nepali(romanized)-pro</string> | ||
<key>TISIntendedLanguage</key> | ||
<string>ne</string> | ||
</dict> | ||
</dict> | ||
</plist> |
Binary file added
BIN
+90 KB
lib/nepali-romanized.bundle/Contents/Resources/Nepali (Romanized) - Pro.icns
Binary file not shown.
15 changes: 7 additions & 8 deletions
15
packager/Nepali Romanized Pro.keylayout → ...ources/Nepali (Romanized) - Pro.keylayout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+116 Bytes
lib/nepali-romanized.bundle/Contents/Resources/en.lproj/InfoPlist.strings
Binary file not shown.
Binary file added
BIN
+118 Bytes
lib/nepali-romanized.bundle/Contents/Resources/ne.lproj/InfoPlist.strings
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?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>BuildVersion</key> | ||
<string></string> | ||
<key>ProjectName</key> | ||
<string>nepali-romanized</string> | ||
<key>SourceVersion</key> | ||
<string></string> | ||
</dict> | ||
</plist> |
Binary file not shown.
1 change: 0 additions & 1 deletion
1
packager/Nepali-Romanized-Pro-Packager.pmdoc/01nepali-contents.xml
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packager/Nepali-Romanized-Pro-Packager.pmdoc/02nepali-contents.xml
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
log_post() { | ||
TIMESTAMP=`date -u +"%Y-%m-%dT%H:%M:%SZ"` | ||
echo "[$TIMESTAMP] - $1" >> /tmp/nepali-romanized-postinstall.log | ||
} | ||
|
||
log_post "Starting postinstall" | ||
|
||
log_post "Finished postinstall" | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh | ||
|
||
log_pre() { | ||
TIMESTAMP=`date -u +"%Y-%m-%dT%H:%M:%SZ"` | ||
echo "[$TIMESTAMP] - $1" >> /tmp/nepali-romanized-preinstall.log | ||
} | ||
|
||
log_pre "Starting preinstall" | ||
|
||
if [ -f "/Library/Keyboard Layouts/Nepali Romanized Pro.keylayout" ] | ||
then | ||
log_pre "Keyboard layout Nepali Romanized Pro.keylayout is already installed." | ||
log_pre "Purging Nepali Romanized Pro.keylayout" | ||
|
||
rm "/Library/Keyboard Layouts/Nepali Romanized Pro.icns" "/Library/Keyboard Layouts/Nepali Romanized Pro.keylayout" | ||
else | ||
log_pre "Nepali Romanized Pro.keylayout has not yet been installed." | ||
fi | ||
|
||
if [ -d "/Library/Keyboard Layouts/nepali-romanized.bundle/" ] | ||
then | ||
log_pre "Keyboard layout bundle nepali-romanized.bundle is already installed." | ||
log_pre "Purging nepali-romanized.bundle." | ||
|
||
rm -rf "/Library/Keyboard Layouts/nepali-romanized.bundle/" | ||
else | ||
log_pre "nepali-romanized.bundle has not yet been installed." | ||
fi | ||
|
||
log_pre "Finished preinstall" | ||
|
||
exit 0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0" encoding="utf-8" standalone="no"?> | ||
<installer-script minSpecVersion="1.000000"> | ||
<localization> | ||
<strings language="en"> | ||
<![CDATA[ | ||
"NR_TITLE" = "Nepali Romanized Pro"; | ||
"NR_OLD_DETECT" = "An older version detected"; | ||
"NR_OLD_DETECT_MSG" = "An older version of the keyboard layout already exists. This installer will purge it and install new bundle."; | ||
"NR_PREV_DETECT" = "Previous installation detected"; | ||
"NR_PREV_DETECT_MSG" = "A previous installation of the keyboard layout bundle already exists. This installer will overwrite it."; | ||
]]> | ||
</strings> | ||
</localization> | ||
<allowed-os-versions> | ||
<os-version min="10.10"/> | ||
</allowed-os-versions> | ||
<title>NR_TITLE</title> | ||
<background mime-type="image/png" file="background.png" alignment="bottomleft" scaling="none"/> | ||
<background-darkAqua mime-type="image/png" file="background.png" alignment="bottomleft" scaling="none"/> | ||
<options customize="never" allow-external-scripts="no" rootVolumeOnly="true"/> | ||
|
||
<welcome language="en" mime-type="text/html"><![CDATA[<html><body><br /> | ||
<p style="margin: 0px; font: 14px 'Helvetica'">This installer will guide you through the process of installing the 'Nepali Romanized Pro' keyboard layout in your operating system.<br /><br />You will need to log out, then log back in to use the layouts.<br /><br />Version : __APP_VERSION__<br />Built on : __BUILD_TIMESTAMP__</p></body></html>]]></welcome> | ||
<conclusion language="en" mime-type="text/html"><![CDATA[<html><body><br /> | ||
<p style="margin: 0px; font: 14px 'Helvetica'">'Nepali Romanized Pro' keyboard layout is now installed.<br /><br />Please log out first, then log back in again.<br />Afterwards, visit the Keyboard Layouts panel in your System Preferences to see the newly installed layout.</p></body></html>]]></conclusion> | ||
<installation-check script="pre_install_check();"/> | ||
<script> | ||
<![CDATA[ | ||
function pre_install_check() { | ||
if(system.files.fileExistsAtPath('/Library/Keyboard Layouts/Nepali Romanized Pro.keylayout')) { | ||
my.result.title = system.localizedString('NR_OLD_DETECT'); | ||
my.result.message = system.localizedString('NR_OLD_DETECT_MSG'); | ||
my.result.type = 'Warning'; | ||
return false; | ||
} | ||
if(system.files.fileExistsAtPath('/Library/Keyboard Layouts/nepali-romanized.bundle')) { | ||
my.result.title = system.localizedString('NR_PREV_DETECT'); | ||
my.result.message = system.localizedString('NR_PREV_DETECT_MSG'); | ||
my.result.type = 'Warning'; | ||
return false; | ||
} | ||
return true; | ||
} | ||
]]> | ||
</script> | ||
|
||
<choices-outline> | ||
<line choice="install"/> | ||
</choices-outline> | ||
<choice id="install" title="Nepali Romanized Pro"> | ||
<pkg-ref id="__APP_PKG_ID__"/> | ||
</choice> | ||
<pkg-ref id="__APP_PKG_ID__" auth="Root">__APP_PKG_ID__.pkg</pkg-ref> | ||
<!-- onConclusion="RequireLogout" --> | ||
</installer-script> |
This file was deleted.
Oops, something went wrong.