aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/migration/migrate-windows.ps1
blob: a7e67b94a07084b142ee09e62a177760fcd80bea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Write-Host "********************************************"
Write-Host "      Ferdium User Data Migration Tool      "
Write-Host "         WARNING: Windows OS Only!          "
Write-Host "********************************************"
Write-Host ""
Write-Host ""
Write-Host "This tool migrates your user data from Ferdi to Ferdium."
Write-Host ""
Write-Host ""
$confirmation = Read-host "Do you want to proceed? (Y/N)"

Switch($confirmation)
{
    default {exit 1}
    "No" {exit 1}
    "N" {exit 1}
    "Yes" {Write-Host "Starting..."}
    "Y" {Write-Host "Starting..."}
}


$FERDI_PATH=$env:APPDATA + "/Ferdi"
$FERDIUM_PATH=$env:APPDATA + "/Ferdium"

try {
    Rename-Item -Force -Path $FERDI_PATH -NewName Ferdium -ErrorAction 'Stop'
} catch {
    Write-Host ""
    Write-Host "ERROR!"
    Write-Host "No user data was found. Exiting..."
    exit 1
}

if (-not (Test-Path -Path $FERDIUM_PATH/server.sqlite)) {
    Write-Host ""
    Write-Host "********************************************"
    Write-Host ""
    Write-Host "WARNING: Your data was partially migrated!"
    Write-Host ""
    Write-Host "It was detected that your account is using Ferdi servers to sync your data."
    Write-Host "Please, check this guide on how to export and import your data manually:"
    Write-Host "https://github.com/ferdium/ferdi/blob/main/MIGRATION.md"
    Write-Host ""
    Write-Host "********************************************"

} else {
    Write-Host ""
    Write-Host ""
    Write-Host "********************************************"
    Write-Host "                 Success!                   "
    Write-Host "********************************************"
}