source: ogAgent-Git/macos/build-pkg.sh

qndtest
Last change on this file was 219fba0, checked in by Ramón M. Gómez <ramongomez@…>, 6 years ago

#840: Creación de nuevos OGAgent para versión 1.1.1 en desarrollo.

  • Property mode set to 100755
File size: 2.9 KB
Line 
1#!/bin/bash
2# Create macOS installation packages.
3# Based on bomutils tutorail: http://bomutils.dyndns.org/tutorial.html
4
5cd $(dirname $0)
6[ -r ../src/VERSION ] && VERSION="$(cat ../src/VERSION)" || VERSION="1.1.0"
7AUTHOR="OpenGnsys Project"
8
9# Create empty directories.
10rm -fr build
11mkdir -p build && cd build
12mkdir -p flat/base.pkg flat/Resources/en.lproj
13mkdir -p root/Applications
14
15# Copy application and script files.
16cp -a ../../src root/Applications/OGAgent.app
17cp -a ../scripts .
18
19# Create plist file.
20cat << EOT > root/Applications/OGAgent.app/OGAgent.plist
21<?xml version="1.0" encoding="UTF-8"?>
22<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
23<plist version="1.0">
24<dict>
25        <key>BuildAliasOf</key>
26        <string>OGAgent</string>
27        <key>BuildVersion</key>
28        <value>$VERSION</value>
29        <author>$AUTHOR</author>
30</dict>
31</plist>
32EOT
33
34# Add files in the base package.
35( cd root && find . | cpio -o --format odc --owner 0:80 | gzip -c ) > flat/base.pkg/Payload
36
37# Create PackageInfo file.
38cat << EOT > flat/base.pkg/PackageInfo
39<pkg-info format-version="2" identifier="es.opengnsys.ogagent.base.pkg" version="$VERSION" install-location="/" auth="root">
40<payload installKBytes="$(du -k -s root)" numberOfFiles="$(find root | wc -l)"/>
41  <scripts>
42    <postinstall file="./postinstall"/>
43  </scripts>
44<bundle-version>
45    <bundle id="es.opengnsys.ogagent" CFBundleIdentifier="es.opengnsys.ogagent" path="./Applications/OGAgent.app" CFBundleVersion="$VERSION"/>
46</bundle-version>
47</pkg-info>
48EOT
49
50# Compress the scripts folder.
51( cd scripts && find . | cpio -o --format odc --owner 0:80 | gzip -c ) > flat/base.pkg/Scripts
52
53# Create BOM file.
54mkbom -u 0 -g 80 root flat/base.pkg/Bom
55
56# Create Distribution file.
57cat << EOT > flat/Distribution
58<?xml version="1.0" encoding="utf-8"?>
59<installer-script minSpecVersion="1.000000" authoringTool="com.apple.PackageMaker" authoringToolVersion="3.0.3" authoringToolBuild="174">
60    <title>OGAgent $VERSION</title>
61    <options customize="never" allow-external-scripts="no"/>
62    <domains enable_anywhere="true"/>
63    <installation-check script="pm_install_check();"/>
64    <script>function pm_install_check() {
65  if(!(system.compareVersions(system.version.ProductVersion,'10.5') >= 0)) {
66    my.result.title = 'Failure';
67    my.result.message = 'You need at least Mac OS X 10.5 to install OGAgent.';
68    my.result.type = 'Fatal';
69    return false;
70  }
71  return true;
72}
73</script>
74    <choices-outline>
75        <line choice="choice1"/>
76    </choices-outline>
77    <choice id="choice1" title="base">
78        <pkg-ref id="es.opengnsys.ogagent.base.pkg"/>
79    </choice>
80    <pkg-ref id="es.opengnsys.ogagent.base.pkg" installKBytes="$(du -k -s root)" version="$VERSION" auth="Root">#base.pkg</pkg-ref>
81</installer-script>
82EOT
83
84# Create new Xar application archive.
85rm -f ../../../OGAgentInstaller-$VERSION.pkg
86( cd flat && xar --compression none -cf "../../../OGAgentInstaller-$VERSION.pkg" * )
87
Note: See TracBrowser for help on using the repository browser.