Hi all,
below a power shell script I use on M$ to keep my system on the latest snaps; maybe of use to others as well:
###
# CodeOmega 2017 - P. Gfeller
###
# Target OS: Windows 10, PowerShell 5.0 (Set-ExecutionPolicy Unrestricted)
# Version : 1.0.1.0
###
# Credits and additional information:
# -> openHAB - Documentation: http://docs.openhab.org/installation/windows.html
###
# History
# - 1.0.1.0: Backup step & header added.
###
Write-Host "PowerShell Version: " $PSVersionTable.PSVersion
# Configuration
$archiveFileName = "openhab-2.1.0-SNAPSHOT.zip"
$lastSuccessfulBuild = "https://openhab.ci.cloudbees.com/job/openHAB-Distribution/lastSuccessfulBuild/artifact/distributions/openhab/target/" + $archiveFileName
$downloadLocation = "./Download/"
$backupLocation = "./../../../openHAB2-Backup/"
$openHABLocation = "./../../"
$designerLocation = "./../Designer/"
$designerArchiveName = "eclipsesmarthome-incubation-0.9.0-SNAPSHOT-designer-win64.zip"
$lastDesignerBuild = "http://eclipse.org/downloads/download.php?file=/smarthome/nightly-snapshots/" + $designerArchiveName
$fullDownloadFilePath = $downloadLocation + $archiveFileName
$fullDownloadFilePathDesigner = $downloadLocation + $designerArchiveName
# Create directory structure ...
New-Item -ItemType Directory -Force -Path $downloadLocation, $openHABLocation, $designerLocation, $backupLocation
# Create backup of current setup ...
Compress-Archive $openHABLocation -DestinationPath ($backupLocation + (get-date -Format yyyyMMdd) + '.zip')
# Download .zip archive with current builds of openHAB & Eclipse SmartHome-Designer ...
Invoke-WebRequest $lastSuccessfulBuild -OutFile $fullDownloadFilePath
Invoke-WebRequest $lastDesignerBuild -OutFile $fullDownloadFilePathDesigner
# backup configuration ...
Copy-Item ($openHABLocation + "conf/services/addons.cfg") ($openHABLocation + "conf/services/addons.cfg.bak")
# delete old files ...
Remove-Item -Force -Recurse -Path ($openHABLocation + "addons"),
($openHABLocation + "runtime"),
($openHABLocation + "userdata/etc"),
($openHABLocation + "userdata/tmp"),
($openHABLocation + "userdata/cache")
# extract archives ...
Expand-Archive -Force -LiteralPath $fullDownloadFilePath -DestinationPath $openHABLocation
Expand-Archive -Force -LiteralPath $fullDownloadFilePathDesigner -DestinationPath $designerLocation
# delete unix specific files ...
Remove-Item -Force -Recurse -Path ($openHABLocation + "start.sh"),
($openHABLocation + "start_debug.sh")
# restore configuration ...
Copy-Item ($openHABLocation + "conf/services/addons.cfg.bak") ($openHABLocation + "conf/services/addons.cfg")
Read-Host -Prompt "Press Enter to exit"
with kind regards,
Patrik