Skip to content

Commit

Permalink
Fix libreoffice-oldstable, match with the install script of `libreoff…
Browse files Browse the repository at this point in the history
…ice`
  • Loading branch information
TomOne committed May 16, 2015
1 parent a28e1f0 commit 40100f0
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 219 deletions.
242 changes: 121 additions & 121 deletions automatic/libreoffice-oldstable/libreoffice-oldstable.ketarin.xml
Original file line number Diff line number Diff line change
@@ -1,121 +1,121 @@
<?xml version='1.0' encoding='utf-8'?>
<Jobs>
<ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="84a8b74c-79d7-4ab9-b51d-ab4fd5adc240">
<SourceTemplate><![CDATA[<Jobs>
<ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="0fb30714-8ed0-4611-8f1b-cb8fec9dae91">
<WebsiteUrl />
<UserAgent>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19</UserAgent>
<UserNotes />
<LastFileSize>384846</LastFileSize>
<LastFileDate>2012-05-23T02:09:37.7748325</LastFileDate>
<IgnoreFileInformation>false</IgnoreFileInformation>
<DownloadBeta>Default</DownloadBeta>
<DownloadDate xsi:nil="true" />
<CheckForUpdatesOnly>false</CheckForUpdatesOnly>
<VariableChangeIndicator />
<CanBeShared>true</CanBeShared>
<ShareApplication>false</ShareApplication>
<ExclusiveDownload>false</ExclusiveDownload>
<HttpReferer />
<SetupInstructions />
<Variables>
<item>
<key>
<string>version</string>
</key>
<value>
<UrlVariable>
<RegexRightToLeft>false</RegexRightToLeft>
<VariableType>StartEnd</VariableType>
<Regex />
<Url><placeholder name="Url with version information" value="https://www.libreoffice.org/download" /></Url>
<StartText>&lt;TABLE cellspacing ="1" cellpadding ="6" border = "0"&gt;
&lt;TR&gt;
&lt;TH class="Title" align="center" width=90&gt;7-Zip </StartText>
<EndText>&lt;BR&gt;</EndText>
<TextualContent />
<Name>version</Name>
</UrlVariable>
</value>
</item>
<item>
<key>
<string>url64</string>
</key>
<value>
<UrlVariable>
<RegexRightToLeft>false</RegexRightToLeft>
<VariableType>Textual</VariableType>
<Regex />
<TextualContent>""</TextualContent>
<Name>url64</Name>
</UrlVariable>
</value>
</item>
</Variables>
<ExecuteCommand />
<ExecutePreCommand />
<ExecuteCommandType>Batch</ExecuteCommandType>
<ExecutePreCommandType>Batch</ExecutePreCommandType>
<Category />
<SourceType>FixedUrl</SourceType>
<DeletePreviousFile>true</DeletePreviousFile>
<Enabled>true</Enabled>
<FileHippoId />
<LastUpdated>2012-05-23T02:09:37.7748325</LastUpdated>
<TargetPath>C:\Chocolatey\_work\</TargetPath>
<FixedDownloadUrl><placeholder name="Download Url - Optional" value="http://download.documentfoundation.org/libreoffice/stable/{version}/win/x86/LibreOffice_{version}_Win_x86.msi" /></FixedDownloadUrl>
<Name><placeholder name="Name" value="libreoffice" /></Name>
</ApplicationJob>
</Jobs>]]></SourceTemplate>
<WebsiteUrl />
<UserAgent>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19</UserAgent>
<UserNotes />
<LastFileSize>220463104</LastFileSize>
<LastFileDate>2014-08-02T16:04:18.7483702</LastFileDate>
<IgnoreFileInformation>false</IgnoreFileInformation>
<DownloadBeta>Default</DownloadBeta>
<DownloadDate xsi:nil="true" />
<CheckForUpdatesOnly>false</CheckForUpdatesOnly>
<VariableChangeIndicator />
<CanBeShared>true</CanBeShared>
<ShareApplication>false</ShareApplication>
<ExclusiveDownload>false</ExclusiveDownload>
<HttpReferer />
<SetupInstructions />
<Variables>
<item>
<key>
<string>version</string>
</key>
<value>
<UrlVariable>
<RegexRightToLeft>false</RegexRightToLeft>
<VariableType>StartEnd</VariableType>
<Regex />
<Url>https://www.libreoffice.org/download/libreoffice-stable/</Url>
<StartText>http://download.documentfoundation.org/libreoffice/stable/</StartText>
<EndText>/win/x86/LibreOffice_</EndText>
<TextualContent />
<Name>version</Name>
</UrlVariable>
</value>
</item>
</Variables>
<ExecuteCommand />
<ExecutePreCommand>{startuppath}..\bin\chocopkgup.bat /p {appname} /v {version} /u "{preupdate-url}" /u64 "{url64}" /pp "{file}"
rem /disablepush</ExecutePreCommand>
<ExecuteCommandType>Batch</ExecuteCommandType>
<ExecutePreCommandType>Batch</ExecutePreCommandType>
<Category />
<SourceType>FixedUrl</SourceType>
<PreviousLocation>C:\Chocolatey\_work\LibreOffice_4.1.6_Win_x86_oldstable.msi</PreviousLocation>
<DeletePreviousFile>true</DeletePreviousFile>
<Enabled>true</Enabled>
<FileHippoId />
<LastUpdated>2014-08-02T16:04:18.7483702</LastUpdated>
<TargetPath>C:\Chocolatey\_work\</TargetPath>
<FixedDownloadUrl>http://download.documentfoundation.org/libreoffice/stable/{version}/win/x86/LibreOffice_{version}_Win_x86.msi</FixedDownloadUrl>
<Name>libreoffice-oldstable</Name>
</ApplicationJob>
</Jobs>
<?xml version='1.0' encoding='utf-8'?>
<Jobs>
<ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="84a8b74c-79d7-4ab9-b51d-ab4fd5adc240">
<SourceTemplate><![CDATA[<Jobs>
<ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="0fb30714-8ed0-4611-8f1b-cb8fec9dae91">
<WebsiteUrl />
<UserAgent>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19</UserAgent>
<UserNotes />
<LastFileSize>384846</LastFileSize>
<LastFileDate>2012-05-23T02:09:37.7748325</LastFileDate>
<IgnoreFileInformation>false</IgnoreFileInformation>
<DownloadBeta>Default</DownloadBeta>
<DownloadDate xsi:nil="true" />
<CheckForUpdatesOnly>false</CheckForUpdatesOnly>
<VariableChangeIndicator />
<CanBeShared>true</CanBeShared>
<ShareApplication>false</ShareApplication>
<ExclusiveDownload>false</ExclusiveDownload>
<HttpReferer />
<SetupInstructions />
<Variables>
<item>
<key>
<string>version</string>
</key>
<value>
<UrlVariable>
<RegexRightToLeft>false</RegexRightToLeft>
<VariableType>StartEnd</VariableType>
<Regex />
<Url><placeholder name="Url with version information" value="https://www.libreoffice.org/download" /></Url>
<StartText>&lt;TABLE cellspacing ="1" cellpadding ="6" border = "0"&gt;
&lt;TR&gt;
&lt;TH class="Title" align="center" width=90&gt;7-Zip </StartText>
<EndText>&lt;BR&gt;</EndText>
<TextualContent />
<Name>version</Name>
</UrlVariable>
</value>
</item>
<item>
<key>
<string>url64</string>
</key>
<value>
<UrlVariable>
<RegexRightToLeft>false</RegexRightToLeft>
<VariableType>Textual</VariableType>
<Regex />
<TextualContent>""</TextualContent>
<Name>url64</Name>
</UrlVariable>
</value>
</item>
</Variables>
<ExecuteCommand />
<ExecutePreCommand />
<ExecuteCommandType>Batch</ExecuteCommandType>
<ExecutePreCommandType>Batch</ExecutePreCommandType>
<Category />
<SourceType>FixedUrl</SourceType>
<DeletePreviousFile>true</DeletePreviousFile>
<Enabled>true</Enabled>
<FileHippoId />
<LastUpdated>2012-05-23T02:09:37.7748325</LastUpdated>
<TargetPath>C:\Chocolatey\_work\</TargetPath>
<FixedDownloadUrl><placeholder name="Download Url - Optional" value="http://download.documentfoundation.org/libreoffice/stable/{version}/win/x86/LibreOffice_{version}_Win_x86.msi" /></FixedDownloadUrl>
<Name><placeholder name="Name" value="libreoffice" /></Name>
</ApplicationJob>
</Jobs>]]></SourceTemplate>
<WebsiteUrl />
<UserAgent>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19</UserAgent>
<UserNotes />
<LastFileSize>220463104</LastFileSize>
<LastFileDate>2014-08-02T16:04:18.7483702</LastFileDate>
<IgnoreFileInformation>false</IgnoreFileInformation>
<DownloadBeta>Default</DownloadBeta>
<DownloadDate xsi:nil="true" />
<CheckForUpdatesOnly>false</CheckForUpdatesOnly>
<VariableChangeIndicator />
<CanBeShared>true</CanBeShared>
<ShareApplication>false</ShareApplication>
<ExclusiveDownload>false</ExclusiveDownload>
<HttpReferer />
<SetupInstructions />
<Variables>
<item>
<key>
<string>version</string>
</key>
<value>
<UrlVariable>
<RegexRightToLeft>false</RegexRightToLeft>
<VariableType>StartEnd</VariableType>
<Regex />
<Url>https://www.libreoffice.org/download/libreoffice-still/</Url>
<StartText>http://download.documentfoundation.org/libreoffice/stable/</StartText>
<EndText>/win/x86/LibreOffice_</EndText>
<TextualContent />
<Name>version</Name>
</UrlVariable>
</value>
</item>
</Variables>
<ExecuteCommand />
<ExecutePreCommand>{startuppath}..\bin\chocopkgup.bat /p {appname} /v {version} /u "{preupdate-url}" /u64 "{url64}" /pp "{file}"
rem /disablepush</ExecutePreCommand>
<ExecuteCommandType>Batch</ExecuteCommandType>
<ExecutePreCommandType>Batch</ExecutePreCommandType>
<Category />
<SourceType>FixedUrl</SourceType>
<PreviousLocation>C:\Chocolatey\_work\LibreOffice_4.1.6_Win_x86_oldstable.msi</PreviousLocation>
<DeletePreviousFile>true</DeletePreviousFile>
<Enabled>true</Enabled>
<FileHippoId />
<LastUpdated>2014-08-02T16:04:18.7483702</LastUpdated>
<TargetPath>C:\Chocolatey\_work\</TargetPath>
<FixedDownloadUrl>http://download.documentfoundation.org/libreoffice/stable/{version}/win/x86/LibreOffice_{version}_Win_x86.msi</FixedDownloadUrl>
<Name>libreoffice-oldstable</Name>
</ApplicationJob>
</Jobs>
93 changes: 45 additions & 48 deletions automatic/libreoffice-oldstable/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
@@ -1,48 +1,45 @@
$packageName = '{{PackageName}}'
$version = '{{PackageVersion}}'

try {

$versionsHtmlFile = "$env:TEMP\libreoffice-versions.html"
$versionsHtmlUrl = 'http://download.documentfoundation.org/libreoffice/stable/'

Get-ChocolateyWebFile 'libreoffice-versions-html' $versionsHtmlFile $versionsHtmlUrl

$matchArray = (Get-Content $versionsHtmlFile) -match 'href="([\d\.]+)\/"'

Remove-Item $versionsHtmlFile

$downloadableVersions = @()

for ($i = 0; $i -lt $matchArray.Length; $i += 1) {
$matchArray[$i] -match '[\d\.]+'
$downloadableVersions += $Matches[0]
}

if (-not($downloadableVersions -match $version)) {

Write-Output 'The version of LibreOffice specified in the package is no longer available to download. This package will download the latest available version instead.'

if ([System.Version]$downloadableVersions[0] -gt [System.Version]$downloadableVersions[1]) {
$version = $downloadableVersions[0]
} else {
$version = $downloadableVersions[1]
}
}

$downUrl = "http://download.documentfoundation.org/libreoffice/stable/${version}/win/x86/LibreOffice_${version}_Win_x86.msi"


# Check if LibreOffice in the same version is already installed
$alreadyInstalled = Get-WmiObject -Class Win32_Product | Where-Object {($_.Name -match '^LibreOffice [\d\.]+$') -and ($_.Version -match "^$version")}

if ($alreadyInstalled) {
Write-Host "LibreOffice $version is already installed on the computer. Skipping download."
} else {
Install-ChocolateyPackage $packageName 'msi' '/passive /norestart' $downUrl -validExitCodes @(0)
}

} catch {
Write-ChocolateyFailure $packageName $($_.Exception.Message)
throw
}
# Important: The contents of this file – the `libreoffice` and
# `libreoffice-oldstable` install scripts – **must** be identical.

$packageName = '{{PackageName}}'
$version = '{{PackageVersion}}'
$validExitCodes = @(0,3010)

$versionsHtmlFile = "$env:TEMP\libreoffice-versions.html"
$versionsHtmlUrl = 'http://download.documentfoundation.org/libreoffice/stable/'

Get-ChocolateyWebFile 'libreoffice-versions-html' $versionsHtmlFile $versionsHtmlUrl

$matchArray = (Get-Content $versionsHtmlFile) -match 'href="([\d\.]+)\/"'

Remove-Item $versionsHtmlFile

$downloadableVersions = @()

for ($i = 0; $i -lt $matchArray.Length; $i += 1) {
$matchArray[$i] -match '[\d\.]+'
$downloadableVersions += $Matches[0]
}

if (-not($downloadableVersions -match $version)) {

Write-Output 'The version of LibreOffice specified in the package is no longer available to download. This package will download the latest available version instead.'

if ([System.Version]$downloadableVersions[0] -gt [System.Version]$downloadableVersions[1]) {
$version = $downloadableVersions[0]
} else {
$version = $downloadableVersions[1]
}
}

$downUrl = "http://download.documentfoundation.org/libreoffice/stable/${version}/win/x86/LibreOffice_${version}_Win_x86.msi"


# Check if LibreOffice in the same version is already installed
$alreadyInstalled = Get-WmiObject -Class Win32_Product | Where-Object {($_.Name -match '^LibreOffice [\d\.]+$') -and ($_.Version -match "^$version")}

if ($alreadyInstalled) {
Write-Host "LibreOffice $version is already installed on the computer. Skipping download."
} else {
Install-ChocolateyPackage $packageName 'msi' '/passive /norestart' $downUrl -validExitCodes $validExitCodes
}
Loading

0 comments on commit 40100f0

Please sign in to comment.