shared notes here
TRANSCRIPT
![Page 1: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/1.jpg)
AutoPkg for Windows Software
James StewartSystems Administrator @ UCB
https://twitter.com/jgstew
Matt HansenSystems Administrator @ PSUhttps://twitter.com/hansen_m
Session Feedback: http://j.mp/psumac2015-140Shared Notes Here
![Page 2: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/2.jpg)
Overview
● BigFix / IBM Endpoint Manager● How to run AutoPkg on Windows?● What is AutoPkg?● What is needed?
● Windows Related Processors○ WinInstallerExtractor○ HachoirMetaDataProvider○ MSIVersionProvider○ Questions?
● More Details, Demos, etc...
![Page 3: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/3.jpg)
BigFix
IBM Endpoint ManagerWorks on Windows, Mac, and Linux
● Deploy Software● Update Software● Configuration Management
![Page 4: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/4.jpg)
AutoPkg Stats - Penn State
15 Windows Recipes (Since November 2014)70 Windows Deployment Tasks
~1000 Mac Deployment Tasks
![Page 5: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/5.jpg)
How to run AutoPkg on Windows?
AutoPkg DOES NOT run on Windows!
AutoPkg is written in Python.
AutoPkg has some OS X specific code.
AutoPkg could be cross platform in the future.
https://github.com/autopkg/autopkg/pull/169
![Page 6: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/6.jpg)
What is AutoPkg?
The goal of AutoPkg is to automate the process of readying new software for deployment.
AutoPkg automatically:● detects new software releases● downloads the new software● prepares software for deployment (if needed)
○ get metadata○ transform○ repackage
● puts software into your deployment solution
![Page 7: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/7.jpg)
What is needed?
Primarily:● a Deployment System with an API
○ Munki, Casper, Absolute, SCCM, BigFix, … ● a Download URL for the software
○ technically, things other than URLs could be used
Secondarily:● The Product Name (supplied)● The Product Version (the hard part)● Any required command line parameters
![Page 8: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/8.jpg)
Finding Windows Product Versions on OS X
If the version can be determined from the download URL, then no further work is needed.
http://download.royalapplications.com/RoyalTS/RoyalTSInstaller_3.00.01.60226.msi
Challenges:● OS X cannot natively read MSI file properties● OS X cannot natively read EXE file properties● OS X cannot extract most Windows archives
![Page 9: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/9.jpg)
WinInstallerExtractor.py
Unpack the installer using 7zip and read the version number from the resulting files.
7z e -oExeExtract iTunes.exe
![Page 10: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/10.jpg)
WinInstallerExtractor.py
Input Variables:● exe_path - Path to exe or msi, defaults to %
pathname%"● preserve_paths - eXtract archive with full
paths, defaults to 'True'● extract_dir - Output path for the extracted
archive
- Running with -vv displays full 7z output
![Page 11: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/11.jpg)
Get Version info from EXE files
Issue: OS X cannot read metadata from EXEsSolution: hachoir-metadata python library
python file_meta_data.py BoxSyncSetup.exe
Metadata: - Title: Box Sync- Author: Box Inc.- Version: 4.0.6442.0- Creation date: 2012-12-24 21:43:11- Copyright: Copyright (c) Box Inc.. All rights reserved.- Comment: CPU: Intel 80386 - Comment: Subsystem: Windows GUI - Format version: Portable Executable: Windows application - MIME type: application/x-dosexec
- Endianness: Little endian
![Page 12: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/12.jpg)
HachoirMetaDataProvider.py
AutoPkg Processor that makes use of the Hachoir library to get version info from EXEs.
ufilepath = hachoir_core.cmd_line.unicodeFilename(str(filepath))parser = hachoir_parser.createParser(ufilepath, filepath)metadata = hachoir_metadata.extractMetadata(parser)
![Page 13: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/13.jpg)
HachoirMetaDataProvider.py
Input Variables:● file_path - Path to the file, defaults to %
pathname%"● metadata_key - key to return the value of,
defaults to ‘Version’● metadata_index - Value index, if multiple
values exist, defaults to 0● output_var_name - Output variable,
defaults to %metadata_key% or 'version'
![Page 14: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/14.jpg)
MSIVersionProvider.py
MSIs are Microsoft's proprietary package format
Most Windows Software installs using MSIs
Reading MSI’s on OS X turns out to be especially difficult
Took a lot of research to find a cross platform solution:● Python Library? Windows Only● Cross platform programs? 404 : Not Found● WINE? Can only install MSIs, but not export values.
○ There might be a way to read MSI values using WINE code, but not that could be easily determined
![Page 15: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/15.jpg)
MSIVersionProvider.py
What is the solution? (a combination)● Find a windows program that:
○ has a command line interface○ will export the ProductVersion from the MSI○ runs on OS X under WINE
msi2xml - first attempt● worked, but complicated● could be useful if other msi details are needed
![Page 16: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/16.jpg)
MSIVersionProvider.py
lessmsi - the chosen option
wine lessmsi.exe v msi2xml-2.2.1.957.msi
![Page 17: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/17.jpg)
MSIVersionProvider.py
Input Variables:● msi_path - Path to the .msi, defaults to %
pathname%
Output Variables:● version - Version of %msi_path%
![Page 18: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/18.jpg)
Any questions so far?
Session Feedback: http://j.mp/psumac2015-140
![Page 19: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/19.jpg)
Why use AutoPkg anyway?
Community of shared recipes● Windows Download recipes are similar to existing Mac
Download recipes for the same product
Community of shared processors
Why recreate AutoPkg when it already exists?
![Page 20: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/20.jpg)
Why not use Chocolatey?
![Page 21: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/21.jpg)
Making AutoPkg work on Windows
AutoPkg will now run with warnings
The only functionality that works is git search
It will take some effort to do this.
Please help if you can.
https://github.com/autopkg/autopkg/pull/169
![Page 22: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/22.jpg)
Demos
![Page 23: Shared Notes Here](https://reader031.vdocuments.us/reader031/viewer/2022022418/589da1c21a28abb34a8bcf62/html5/thumbnails/23.jpg)
Questions?
Session Feedback:http://j.mp/psumac2015-140