source: admin/Sources/Clients/ogagent/macos/build-pkg.sh @ 103bc82

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since 103bc82 was 9d42c8e, checked in by ramon <ramongomez@…>, 8 years ago

#718: Crear paquete de instalación de OGAgent para macOS.

git-svn-id: https://opengnsys.es/svn/branches/version1.1@5210 a21b9725-9963-47de-94b9-378ad31fedc9

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