Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update.ps1 Backup not created correctly during update on Windows #1587

Open
yndtrud opened this issue Sep 6, 2023 · 0 comments
Open

update.ps1 Backup not created correctly during update on Windows #1587

yndtrud opened this issue Sep 6, 2023 · 0 comments

Comments

@yndtrud
Copy link

yndtrud commented Sep 6, 2023

As far as I understand the logic of the process:

  1. create folder in user temp backup-3.4.5 (current version)
  2. copy folders conf, runtime, userdata to backup-3.4.5 ( backup-3.4.5\conf, backup-3.4.5\runtime, backup-3.4.5\userdata)
  3. copy files from openhab root folder to backup-3.4.5\home folder

You can launch any 3.2.x+ or 4.x.x update script and you get:
On step 2: backup-3.4.5 with content of conf folder + runtime and userdata subfolder

  • runtime
  • userdata
  • automation
  • html
  • icons
  • items
  • persistence
  • rules
  • scripts
  • services
  • sitemaps
  • sounds
  • things
  • transform
    On step 3: in folder backup-3.4.5 there will be a home file with the contents of the start.sh file!

` # Crete the temporary backup locations to the current distribution
$TempBackupDir = "$TempDir\backup-$CurrentVersion"
$TempBackupDirHome = $TempBackupDir + "\home"
$TempBackupDirRuntime = $TempBackupDir + "\runtime"
$TempBackupDirUserData = $TempBackupDir + "\userdata"
$TempBackupDirConf = $TempBackupDir + "\conf"

# Backup the current distribution to those locations
Write-Host ""
Write-Host -ForegroundColor Cyan "Making a backup of your distribution to $TempBackupDir"
try {
    Write-Host -ForegroundColor Cyan "Creating backup directories in $TempBackupDir"
    DeleteIfExists $TempBackupDir $True

    Write-Host -ForegroundColor Cyan "Copying directory conf, userdata and runtime to $TempBackupDirConf"
    Copy-Item -Path $OHConf, $OHUserData, $OHRuntime -Destination $TempBackupDir -Recurse -Force -ErrorAction Stop

    Write-Host -ForegroundColor Cyan "Copying files from $OHDirectory to $TempBackupDirHome"
    Get-ChildItem $OHDirectory -File -ErrorAction Stop | Copy-Item -Destination $TempBackupDirHome -Force -ErrorAction Stop

} catch {
    exit PrintAndReturn "Could not backup existing distribution to $TempBackupDir" $_
}

`

As a result, update.ps1 cannot return the state from the backup if the update installation fails (cannot find folders in backup 3.4.5).

And since update.ps1 on Windows cannot correctly call updatetools.jar, from version 3.4.5 to version 4.0.0, 4.0.1, 4.0.2 I update manually. The script is completely broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant