This page will contain information about Chocolatey. It is currently a work in progress!
|
|
Setup COWS Locally
Windows 10
(to be tested with older versions)
Open cmd as administrator
Run
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://build.oakland.edu/installChocolatey.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
When prompted for your credentials use "ADMNET\username" and your password.
Windows 7-8.1
Open cmd as administrator
Run
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin choco source add -n=COWS -s="'https://build.oakland.edu/httpAuth/app/nuget/v1/FeedService.svc/' choco source disable -n chocolatey
Consuming Packages
Requirements
- Access to COWS feed.
- Ability to execute Powershell commands on target systems.
List Available Packages
choco list
If there are many packages, it is better to search.
choco search office
Adding -pre to your command will allow for pre-release or testing versions of packages to appear.
Adding --all-versions will display each version of each package.
When prompted for your credentials use "ADMNET\username" and your password.
Install Software
choco install visio2016pro -y
You may install multiple packages at once by using a space separate list.
choco install office2016proplus visio2016pro -y
Adding --version and a version number (e.g., --version 0.10.35) will force a specific version to install.
Adding -pre to your command will allow for pre-release or testing packages to install.
When prompted for your credentials use "ADMNET\username" and your password.
List Installed Packages
choco list --local-only
Uninstall Packages
choco uninstall office2016proplus -y
Updating Packages
choco upgrade chocolatey -y
Certain packages will require different updating procedures. (Certain packages maintain themselves, others will require uninstalls and reinstalls).
Developing Packages
Requirements
System
- Windows 7+ / Windows Server 2003+
PowerShell v2+ (Included in Windows 7+ / Windows Server 2008 R2+)
.NET Framework 4+ (Chocolatey will attempt to install it if needed. Included in Windows 8+ / Windows Server 2012+)
Other
- The software to package (installer or executables)
- Access to an appropriate network share to store the software
- Access to the appropriate COWS Git repository for that software
Packaging Steps
These steps are just an outline of the process and do not encompass detailed guidelines. Guidelines may be found below the steps.
- Store your software in the appropriate network share, be sure to maintain organization for each version of the software (1.0, 1.22.2, etc. having their own directory).
- Clone the repository that corresponds to the namespace for the package you are creating, and then either create a branch for your package or checkout the dev branch.
- From the packages directory, run "choco new [namespace].[packagename]" (e.g., "choco new casoft.endpoint12"). This is create some sample files, which can be read if you wish. None are usually necessary except for the .nuspec and the chocolateyInstall scripts.
- At minimum, you must fill out the .nuspec as completely as possible, and then create the scripts applicable to your package (see the Guidelines below).
- You may test your package by running "choco install -fdv [nuspec]" (e.g., "choco install -fdv casoft.endpoint12.nuspec"). It is recommended to do this on a virtual machine or something similar, so that you can confirm correct behavior of your package. Alternatively, you may "choco pack [nuspec]" and use "choco pack [nupkg]" on the machine you want to test on after copying the nupkg to that machine.
- When you have confirmed that your package is working correctly, be sure that you have cleaned up any unnecessary files (unused scripts, markdown files, the generated nupkg file), stage the files for the package and commit them to the appropriate branch of your repository.
- When the package is ready for release, create a merge request to the master branch of your repository for the commits for your package. The build server will detect changes and queue your package for building and release to the nuget feed.
Cloning packages from Chocolatey.org
Most free software is already available on chocolatey.org. We can import this into our environment and host it locally
If first time clone cows repo
git clone https://code.oakland.edu/tsswindows/cows-ca.git
CD into the cows repo and Create a new git feature branch (replace Software name with name of software)
git -b feature_softwareName
Create a new directory in cows-ca\packages\
Go to the chocolatey.org site and find your package. Click download from the packages page
Use 7zip to extract the download into you newly created directory
Edit the ChocolateyInstall.ps1 located in the tools folder.
Change Install-ChocolateyPackage to Install-ChocolateyInstallPackage
Remove everything from the $packageArgs except: packageName, fileType, file, and silentArgs
On CASoft create a new directory under Cows for you software, then one more folder for the version.
NOT yet documented, Download the installer, edit the nuspec
Guidelines