Skip to content

Commit

Permalink
Initial package commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pauby committed Sep 12, 2017
1 parent 3c90361 commit ce8f391
Show file tree
Hide file tree
Showing 7 changed files with 391 additions and 0 deletions.
5 changes: 5 additions & 0 deletions automatic/ad-awarefreeantivirus/README.md
@@ -0,0 +1,5 @@
# ![Adaware Free Antivirus Logo](https://cdn.rawgit.com/pauby/ChocoPackages/3c903619/icons/ad-awarefreeantivirus.png "Adaware Free Antivirus Logo") [Adaware Free Antivirus Logo](https://chocolatey.org/packages/ad-aware)

Adaware Free Antivirus combines the legendary anti-spyware engine with a super fast, free antivirus.

It now features download protection (blocks malicious files before being written to disk), sandboxing (keeps unknown apps running in a virtual environment) and advanced detection.
84 changes: 84 additions & 0 deletions automatic/ad-awarefreeantivirus/ad-awarefreeantivirus.nuspec
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Read this before creating packages: https://chocolatey.org/docs/create-packages -->
<!-- It is especially important to read the above link to understand additional requirements when publishing packages to the community feed aka dot org (https://chocolatey.org/packages). -->

<!-- Test your packages in a test environment: https://github.com/chocolatey/chocolatey-test-environment -->

<!--
This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Reference. Chocolatey uses a special version of NuGet.Core that allows us to do more than was initially possible. As such there are certain things to be aware of:
* the package xmlns schema url may cause issues with nuget.exe
* Any of the following elements can ONLY be used by choco tools - projectSourceUrl, docsUrl, mailingListUrl, bugTrackerUrl, packageSourceUrl, provides, conflicts, replaces
* nuget.exe can still install packages with those elements but they are ignored. Any authoring tools or commands will error on those elements
-->

<!-- You can embed software files directly into packages, as long as you are not bound by distribution rights. -->
<!-- * If you are an organization making private packages, you probably have no issues here -->
<!-- * If you are releasing to the community feed, you need to consider distribution rights. -->
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<!-- == PACKAGE SPECIFIC SECTION == -->
<!-- This section is about this package, although id and version have ties back to the software -->
<!-- id is lowercase and if you want a good separator for words, use '-', not '.'. Dots are only acceptable as suffixes for certain types of packages, e.g. .install, .portable, .extension, .template -->
<!-- If the software is cross-platform, attempt to use the same id as the debian/rpm package(s) if possible. -->
<id>ad-awarefreeantivirus</id>
<!-- version should MATCH as closely as possible with the underlying software -->
<!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages -->
<!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. -->
<version>11.12.945.9202</version>
<packageSourceUrl>https://github.com/pauby/ChocoPackages/tree/master/automatic/ad-awarefreeantivirus</packageSourceUrl>
<!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you. -->
<owners>pauby</owners>
<!-- ============================== -->

<!-- == SOFTWARE SPECIFIC SECTION == -->
<!-- This section is about the software itself -->
<title>Adaware Free Antivirus (Install)</title>
<authors>Lavasoft</authors>
<!-- projectUrl is required for the community feed -->
<projectUrl>https://www.adaware.com/antivirus</projectUrl>
<iconUrl>https://cdn.rawgit.com/pauby/ChocoPackages/3c903619/icons/ad-awarefreeantivirus.png</iconUrl>
<copyright>2017 Lavasoft</copyright>
<!-- If there is a license Url available, it is required for the community feed -->
<!-- <licenseUrl>Software License Location __REMOVE_OR_FILL_OUT__</licenseUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>-->
<!--<projectSourceUrl>Software Source Location - is the software FOSS somewhere? Link to it with this</projectSourceUrl>-->
<docsUrl>https://www.adaware.com/faq</docsUrl>
<!--<mailingListUrl></mailingListUrl>-->
<!--<bugTrackerUrl></bugTrackerUrl>-->
<tags>admin notSilent notUninstallable antivirus firewall internet-security anti-spyware anti-malware real-time-protection</tags>
<summary>Adaware Free Antivirus combines the legendary Anti-spyware engine with a super fast, free Antivirus.</summary>
<description>Adaware Free Antivirus combines the legendary anti-spyware engine with a super fast, free antivirus.

It now features download protection (blocks malicious files before being written to disk), sandboxing (keeps unknown apps running in a virtual environment) and advanced detection.
</description>
<!-- <releaseNotes>__REPLACE_OR_REMOVE__MarkDown_Okay</releaseNotes> -->
<!-- =============================== -->

<!-- Specifying dependencies and version ranges? https://docs.nuget.org/create/versioning#specifying-version-ranges-in-.nuspec-files -->
<dependencies>
<dependency id="autohotkey" />
<!-- <dependency id="" version="__MINIMUM_VERSION__" />
<dependency id="" version="[__EXACT_VERSION__]" />
<dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_INCLUSIVE]" />
<dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_EXCLUSIVE)" />
<dependency id="" />
<dependency id="chocolatey-core.extension" version="1.1.0" /> -->
</dependencies>
<!-- chocolatey-core.extension - https://chocolatey.org/packages/chocolatey-core.extension
- You want to use Get-UninstallRegistryKey on less than 0.9.10 (in chocolateyUninstall.ps1)
- You want to use Get-PackageParameters and on less than 0.11.0
- You want to take advantage of other functions in the core community maintainer's team extension package
-->

<!--<provides>NOT YET IMPLEMENTED</provides>-->
<!--<conflicts>NOT YET IMPLEMENTED</conflicts>-->
<!--<replaces>NOT YET IMPLEMENTED</replaces>-->
</metadata>
<files>
<!-- this section controls what actually gets packaged into the Chocolatey package -->
<file src="tools\**" target="tools" />
<!--Building from Linux? You may need this instead: <file src="tools/**" target="tools" />-->
</files>
</package>
@@ -0,0 +1,59 @@
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#NoTrayIcon
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, 1
SetControlDelay -1
CoordMode, Mouse, Window

winTitle = Adaware Antivirus Updater

WinWait, %winTitle%,, 180
if !(Errorlevel) {
Loop 5
{
WinActivate, %winTitle%
PixelGetColor, colour, 390, 270, RGB
if (colour = "0xFCB34F")
{
break
}
Sleep 1000
}

ifWinExist, %winTitle%
{
Click 390 270
}

Loop, 300 {
WinActivate, %winTitle%
PixelGetColor, colour, 380, 220, RGB
if (colour = "0x36BE34") {
break
}
Sleep, 1000
}

ifWinExist %winTitle%
{
WinActivate %winTitle%
Click 300 540
Sleep 2000
}
else
{
ExitApp
}

ifWinExist, %WinTitle%
{
WinActivate %winTitle%
Click 330 390
}
else
{
ExitApp
}
}
@@ -0,0 +1,121 @@
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#NoTrayIcon
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, 1
SetControlDelay -1

winTitle = Adaware Antivirus Updater
WinWait, %winTitle%,, 60
if !(Errorlevel)
{
Loop, 5
{
WinActivate, %winTitle%
PixelGetColor, colour, 475, 540, RGB
if (colour = "0xFCB34F")
{
break
}
Sleep 1000
}

ifWinExist, %winTitle%
{
WinActivate, %winTitle%
Click 475 540
}
else
{
ExitApp
}

; Window 'Keep some level of protection'
Loop, 5
{
WinActivate, %winTitle%
PixelGetColor, colour, 570, 550, RGB ; this is the NEXT button
if (colour = "0xFCB34F")
{
break
}
Sleep 1000
}

ifWinExist, %winTitle%
{
WinActivate, %winTitle%
Click 570 550 ; the NEXT button
}
else
{
ExitApp
}

; Window 'Uninstall Adaware Antivirus'
Loop, 5
{
WinActivate, %winTitle%
PixelGetColor, colour, 450, 390, RGB ; this is the NO button which is orange (and selected) by default
if (colour = "0xFCB34F")
{
break
}
Sleep 1000
}

ifWinExist, %winTitle%
{
WinActivate, %winTitle%
Click 330 390 ; this is the YES button
}
else
{
ExitApp
}

; Window 'Uninstallation Complete'
Loop, 300
{
WinActivate, %winTitle%
PixelGetColor, colour, 385, 220, RGB ; this is the green tick to show uninstallation complete
if (colour = "0x36BE34")
{
break
}
Sleep 1000
}

ifWinExist, %winTitle%
{
WinActivate, %winTitle%
Click 300 540 ; this is the CLOSE button (ie. not to reboot)
}
else
{
ExitApp
}

; Window 'Warning!'
Loop, 5
{
WinActivate, %winTitle%
PixelGetColor, colour, 460, 400, RGB ; this is the REBOOT NOW button which is orange and selected by default
if (colour = "0xFCB34F")
{
break
}
Sleep 1000
}

ifWinExist, %winTitle%
{
WinActivate, %winTitle%
Click 330 390 ; this is the CLOSE button (ie. not to reboot)
}
else
{
ExitApp
}
}
35 changes: 35 additions & 0 deletions automatic/ad-awarefreeantivirus/tools/chocolateyInstall.ps1
@@ -0,0 +1,35 @@
$ErrorActionPreference = 'Stop';

$packageName = 'ad-awarefreeantivirus'
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$url = 'http://download100.lavasoft.com/adaware/updates/Adaware_Installer_free.exe'

$ahkFile = 'ad-awarefreeantivirus_install.ahk'
$ahkPath = $(Join-Path -Path $toolsDir -ChildPath $ahkFile)

$packageArgs = @{
packageName = $packageName
unzipLocation = $toolsDir
fileType = 'EXE'
url = $url

softwareName = 'adaware antivirus*'

checksum = 'dc3e21115ef6d474175159bd3433bc526b2f56cc7677ecff2f46472c46b4e0c6'
checksumType = 'sha256'

validExitCodes = @(0)
}

$ahkRun = "$Env:Temp\$(Get-Random).ahk"
Write-Debug "AHK file to run: $ahkRun"
Copy-Item $ahkPath $ahkRun -Force
$ahkProc = Start-Process -FilePath 'AutoHotKey' `
-ArgumentList $ahkRun `
-PassThru

$ahkId = $ahkProc.Id
Write-Debug "$ahkExe start time:`t$($ahkProc.StartTime.ToShortTimeString())"
Write-Debug "Process ID:`t$ahkId"

Install-ChocolateyPackage @packageArgs
55 changes: 55 additions & 0 deletions automatic/ad-awarefreeantivirus/tools/chocolateyUninstall.ps1
@@ -0,0 +1,55 @@
$ErrorActionPreference = 'Stop'; # stop on all errors

$toolsDir = $(Split-Path -parent $MyInvocation.MyCommand.Definition)
$ahkFile = 'ad-awarefreeantivirus_uninstall.ahk'
$ahkPath = $(Join-Path -Path $toolsDir -ChildPath $ahkFile)

$packageArgs = @{
packageName = $env:ChocolateyPackageName
softwareName = 'adaware antivirus*'
fileType = 'EXE'
silentArgs = ''
validExitCodes = @(0)
}

$uninstalled = $false

[array]$key = Get-UninstallRegistryKey -SoftwareName $packageArgs['softwareName']

$ahkRun = "$Env:Temp\$(Get-Random).ahk"
Write-Debug "AHK file to run: $ahkrun"
Copy-Item $ahkPath $ahkRun -Force
$ahkProc = Start-Process -FilePath 'AutoHotKey' `
-ArgumentList $ahkRun `
-PassThru

$ahkId = $ahkProc.Id
Write-Debug "$ahkExe start time:`t$($ahkProc.StartTime.ToShortTimeString())"
Write-Debug "Process ID:`t$ahkId"

if ($key.Count -eq 1) {
$key | ForEach {
if ($_.UninstallString -match '"(.*)"\s(.*)') {
$packageArgs['file'] = $matches[1]
$packageArgs['silentArgs'] = $matches[2]
}

if ($packageArgs['fileType'] -eq 'MSI') {
$packageArgs['silentArgs'] = "$($_.PSChildName) $($packageArgs['silentArgs'])"
$packageArgs['file'] = ''
}

Uninstall-ChocolateyPackage @packageArgs
}
}
elseif ($key.Count -eq 0) {
Write-Warning "$packageName has already been uninstalled by other means."
}
elseif ($key.Count -gt 1) {
Write-Warning "$($key.Count) matches found!"
Write-Warning "To prevent accidental data loss, no programs will be uninstalled."
Write-Warning "Please alert package maintainer the following keys were matched:"
$key | % {Write-Warning "- $($_.DisplayName)"}
}

Remove-Item "$ahkRun" -Force

0 comments on commit ce8f391

Please sign in to comment.