lindegroup / autopkgr

AutoPkgr is a free Mac app that makes it easy to install and configure AutoPkg.
http://www.lindegroup.com/autopkgr
Apache License 2.0
536 stars 51 forks source link

Edit Self Service Override to feature app on Front Page of Self Service App #478

Closed leoos closed 8 years ago

leoos commented 8 years ago

Hi,

Thats a long winded title.

The attached pic explains what I want to do better.

I want to add a line to a Self Service override I have created for Autopkgr. I would like the "Feature the policy on the main page" option ticked.

I tried editing the CATEGORY and POLICY_CATEGORY keys in the override.xml file without success. Is it possible to enable this from the override.xml?

Is this the correct place to ask this type of question?

Regards

Leo

screen shot 2016-01-29 at 14 44 32

homebysix commented 8 years ago

Hi @leoos,

This might be a better issue for Auto Update Magic or JSSImporter, but no worries, I can answer it here.

The way I'd do this is two-fold. The first part involves overriding the Flash Player jss recipe and naming it Adobe Flash Player-selfservicefeatured.recipe. Make whatever modifications you'd like to make, and also change the POLICY_TEMPLATE key from PolicyTemplate.xml to PolicyTemplate-selfservicefeatured.xml. Store it in ~/Library/AutoPkg/RecipeOverrides. The end result might look like this:

<?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>Identifier</key>
    <string>com.example.jss.AdobeFlashPlayer-selfservicefeatured</string>
    <key>Input</key>
    <dict>
        <!-- Your other customizations here. -->
        <key>POLICY_TEMPLATE</key>
        <string>PolicyTemplate-selfservicefeatured.xml</string>
    </dict>
    <key>ParentRecipe</key>
    <string>com.github.jss-recipes.jss.AdobeFlashPlayer</string>
</dict>
</plist>

Next, copy the default PolicyTemplate.xml file from ~/Library/AutoPkg/RecipeRepos/com.github.autopkg.jss-recipes/PolicyTemplate.xml into ~/Library/AutoPkg/RecipeOverrides, and change its name to PolicyTemplate-selfservicefeatured.xml to match the recipe override you created above. In that file, add a single line to the self_service section: <feature_on_main_page>true</feature_on_main_page>

Like so:

<policy>
    <general>
        <name>Install Latest %PROD_NAME%</name>
        <enabled>true</enabled>
        <frequency>Ongoing</frequency>
        <category>
            <name>%POLICY_CATEGORY%</name>
        </category>
    </general>
    <scope>
        <!--Scope added by JSSImporter-->
    </scope>
    <package_configuration>
        <!--Package added by JSSImporter-->
    </package_configuration>
    <scripts>
        <!--Scripts added by JSSImporter-->
    </scripts>
    <self_service>
        <use_for_self_service>true</use_for_self_service>
        <install_button_text>Install %VERSION%</install_button_text>
        <self_service_description>%SELF_SERVICE_DESCRIPTION%</self_service_description>
        <feature_on_main_page>true</feature_on_main_page>
    </self_service>
    <maintenance>
        <recon>true</recon>
    </maintenance>
</policy>

That should do it, I think.

Any time you want to make these sorts of customizations to the policy template xml, the Casper API is worth visiting. That's how I put the above together.