Skip to main content

Remove Contents of a distribution package

Yesterday I got a request to create a VPN AnyConnect package where client asked to remove some of the contents from the file and repackage it with the preconfigured server settings.

This is what it looked like:

Clients demand was to remove 'Web Security', 'Diagnostic and Reporting Tool' & 'Posture' leaving only VPN in the package. So there are again, two options, take a snapshot using FileWave or Casper and create the package, which any kid can do or try the more advance way of doing it.

There is an advance way of doing this - Flatten the package make the changes and Unflatten it again.

Steps:

1. Run the command to open the package using pkgutil

2. Make the changes, delete the unwanted stuffs (the selected ones in this example)

4. Just leave the VPN items:

5. Check if there is anything else the is requested by the client or something under cleanup activity. In this specific example you need to modify the Distibution file.

Have a glance at this file and you will make out what modification is needed:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<installer-gui-script minSpecVersion="1">
    <title>AnyConnect Secure Mobility Client</title>
    <background file="pkg_background.png" scaling="proportional" alignment="bottomleft"/>
    <license file="License.rtf"/>
    <options customize="always" rootVolumeOnly="true" hostArchitectures="i386"/>
    <choices-outline>
        <line choice="choice_vpn"/>
        <line choice="choice_websecurity"/>
        <line choice="choice_dart"/>
        <line choice="choice_posture"/>
    </choices-outline>
    <choice id="choice_vpn" start_enabled="choice_vpn_enabled()" enabled="choice_vpn_enabled()" start_selected="choice_vpn_selected(true)" selected="choice_vpn_selected(false)" title="VPN" description="Installs the module that enables VPN capabilities.">
        <pkg-ref id="com.cisco.pkg.anyconnect.vpn"/>
    </choice>
    <choice id="choice_websecurity" title="Web Security" description="Installs the WebSecurity module that enables cloud scanning of web content to protect against malware and enforce acceptable use policies via the ScanSafe cloud proxies.">
        <pkg-ref id="com.cisco.pkg.anyconnect.websecurity"/>
    </choice>
    <choice id="choice_dart" title="Diagnostics and Reporting Tool" description="Installs the diagnostics module that collects AnyConnect Secure Mobility Client troubleshooting information.">
        <pkg-ref id="com.cisco.pkg.anyconnect.dart"/>
    </choice>
    <choice id="choice_posture" title="Posture" description="Installs the module that provides the AnyConnect Secure Mobility Client with the ability to identify the operating system, antivirus, antispyware, and firewall software installed on the host prior to creating a remote access connection to the secure gateway.">
        <pkg-ref id="com.cisco.pkg.anyconnect.posture"/>
    </choice>
    <pkg-ref id="com.cisco.pkg.anyconnect.vpn" version="3.1.05187" installKBytes="12252">#vpn_module.pkg</pkg-ref>
    <pkg-ref id="com.cisco.pkg.anyconnect.dart" version="3.1.05187" installKBytes="1457">#dart_module.pkg</pkg-ref>
    <pkg-ref id="com.cisco.pkg.anyconnect.websecurity" version="3.1.05187" installKBytes="3104">#websecurity_module.pkg</pkg-ref>
    <pkg-ref id="com.cisco.pkg.anyconnect.posture" version="3.1.05187" installKBytes="6211">#posture_module.pkg</pkg-ref>
    <installation-check script="InstallationCheck()"/>
    <volume-check script="VolumeCheck()"/>
    <script>
    function InstallationCheck()
    {
        if(!(system.compareVersions(system.version.ProductVersion, '10.6') >= 0))
        {
            my.result.title = 'Cisco AnyConnect Secure Mobility Client';
            my.result.message = 'This software requires Mac OS X version 10.6 or later.';
            my.result.type = 'Fatal';
            return false;
        }

        return true;
    }
    
    function VolumeCheck()
    {
        // version of VPN being installed has to be higher than the version already installed

        var vpnReceipt = my.target.receiptForIdentifier("com.cisco.pkg.anyconnect.vpn");
        var vpnPackage = choices.choice_vpn.packages[0];

        // if the receipt is not there assume no VPN installed or pre-3.1.1 version so it is OK to install
        if (vpnReceipt)
        {
            // there is a 3.1.1+ version of VPN already installed
            // check to see if version in this package is newer
            var comparison = system.compareVersions(vpnReceipt.version, vpnPackage.version);

            if (comparison > 0)
            {
                // installed version is newer
                my.result.message = 'Newer version ' + vpnReceipt.version + ' of the Cisco AnyConnect Secure Mobility Client is already installed.';
                my.result.type = 'Fatal';
                return false;
           }
        }

        return true;
    }

    function choice_vpn_enabled()
    {
        return (!choices.choice_websecurity.selected &amp;&amp; !choices.choice_posture.selected);      
    }

    function choice_vpn_selected(isStart)
    {
        var tSelected;

        tSelected=((choices.choice_websecurity.selected || choices.choice_posture.selected) || (!choices.choice_websecurity.selected &amp;&amp; !choices.choice_posture.selected));

        if (choice_vpn_enabled()==false || isStart==true)
        {
            return tSelected;
        }

        return (tSelected &amp;&amp; my.choice.selected);
    }
    </script>
    <pkg-ref id="com.cisco.pkg.anyconnect.vpn">
        <bundle-version>
            <bundle CFBundleShortVersionString="3.1" CFBundleVersion="1" id="com.cisco.Cisco-AnyConnect-Secure-Mobility-Client" path="Applications/Cisco/Cisco AnyConnect Secure Mobility Client.app"/>
            <bundle CFBundleVersion="3.1.05187" id="com.yourcompany.vpndownloader" path="opt/cisco/anyconnect/bin/vpndownloader.app"/>
            <bundle CFBundleVersion="3.1.05187" id="com.cisco.uninstaller" path="Applications/Cisco/Uninstall AnyConnect.app"/>
        </bundle-version>
    </pkg-ref>
    <pkg-ref id="com.cisco.pkg.anyconnect.websecurity">
        <bundle-version/>
    </pkg-ref>
    <pkg-ref id="com.cisco.pkg.anyconnect.dart">
        <bundle-version>
            <bundle CFBundleShortVersionString="3.1.05187" id="com.cisco.Cisco-AnyConnect-DART" path="Applications/Cisco/Cisco AnyConnect DART.app"/>
        </bundle-version>
    </pkg-ref>
    <pkg-ref id="com.cisco.pkg.anyconnect.posture">
        <bundle-version/>
    </pkg-ref>
</installer-gui-script>

6. Flatten the package again using pkgutil with desired contents

This .pkg file is ready for deployment using any tool of your choice.

Note: I understand that the complete pkgutil commands are missing in the post but I believe it is better you search and try it yourself. wink Here is the man pages for pkgutil. At this stage, more you study, the more you learn.

Comments

Popular posts from this blog

Apple displays refurbished iPads starting@499

Apple has decided that now its time to sell refurbished iPads. They have announced a discount of $50 on their online store. Though all the products are not available on Apple online store but they are continuously improving in the availability of numbers of products. According to Apple Insider : Currently, just refurbished Wi-Fi-only iPad models are available, though all capacities can be purchased, with a shipping time of between one and three days. The 16GB model sells for $449, the 32GB offering is $549, and the highest capacity 64GB device is $649. The iPads are available with one year limited warranty from Apple and of course you can get the AppleCare Protection Plan with the product. However, 3G-capable refurbished iPads are not yet available for purchase via Apple's online store. All three models are listed as out of stock, and will also sell for $50, starting at $579 for the 16GB model .

How to default length of iCal Event

In this post we will discuss the steps to change the default length of iCal Events This is going to be a quick tip for any users who regularly use iCal. When you create a new event, either in the day, week or month viewer you will realize that the length of the event is one hour long, for most people this is fine. However if you regularly have meetings which are half an hour long, or book rooms for two ours at a time, it may be beneficial and more efficient to adjust the default meeting time. This means you don’t have to fiddle around with the length slot if you regularly use the same event length. This trick, as many tricks on this site do, uses Terminal. Open it up from Applications > Utilities. Then type or copy and paste, the following and hit enter. defaults write com.apple.iCal 'Default duration in minutes for new event' 15 This will change the default event length to 15 minutes. To see the results re-open iCal if you already have it open. The number at the en

iPad grabs unbelievable 0.03% traffic in the very first week

Great news for Apple lovers According to the report received from NetMarketshare, it indicates that iPad is soon going to make a solid place among all the countries within all user segments. The report says iPad grabbed 0.03 percent of total web traffic which is fairly high. If you take a glance at the competition you will find iPad’s performance is incredible. iPhone: 0.51% BlackBerry: 0.04% Android: 0.07% Windows mobiles: 0.07% The figure is really impressive, seems Steve’s idea might become a revolution in the web world in coming time. Good luck Steve!   Buzz