diff --git a/.env.example b/.env.example index a045bcc..127fb09 100644 --- a/.env.example +++ b/.env.example @@ -10,3 +10,6 @@ AWS_USE_PATH_STYLE_ENDPOINT= PRODUCTION_REALMLIST= PTR_REALMLIST= LOCAL_REALMLIST= + +SSH_USER=root +SSH_HOST=strictlypragmatic.ru \ No newline at end of file diff --git a/src/Data/ruRU/patch-ruRU-Z/DBFilesClient/Spell.dbc b/src/Data/ruRU/patch-ruRU-Z/DBFilesClient/Spell.dbc new file mode 100644 index 0000000..96ada6c Binary files /dev/null and b/src/Data/ruRU/patch-ruRU-Z/DBFilesClient/Spell.dbc differ diff --git a/sync-dbc.ps1 b/sync-dbc.ps1 new file mode 100644 index 0000000..b2cb865 --- /dev/null +++ b/sync-dbc.ps1 @@ -0,0 +1,64 @@ +# Sync DBC files from src with files on a server + +# Parse .env +if (Test-Path ".env") { + Get-Content ".env" | ForEach-Object { + if ($_ -match '^[^#\s]+=.+') { + $name, $value = $_ -split '=', 2 + $name = $name.Trim() + $value = $value.Trim().Trim('"').Trim("'") + [System.Environment]::SetEnvironmentVariable($name, $value) + } + } +} else { + Write-Error ".env not found!" + exit 1 +} + +$user = $env:SSH_USER +$sshHost = $env:SSH_HOST +$port = $env:SSH_PORT + +if (-not $user -or -not $sshHost) { + Write-Error "SSH_USER or SSH_HOST env variables are not defined" + exit 1 +} + +if (-not $port) { + $port = "22" +} + +$input = @( + ".\src\Data\ruRU\patch-ruRU-5\DBFilesClient\Achievement.dbc", + ".\src\Data\ruRU\patch-ruRU-Z\DBFilesClient\Spell.dbc", + ".\src\Data\ruRU\patch-ruRU-Z\DBFilesClient\BarberShopStyle.dbc", + ".\src\Data\ruRU\patch-ruRU-Z\DBFilesClient\CreatureDisplayInfoExtra.dbc", + ".\src\Data\ruRU\patch-ruRU-Z\DBFilesClient\SpellVisualKitModelAttach.dbc" +) + +$output = "/home/mangos/moonwell-server/env/dist/data/dbc" + +foreach ($file in $input) { + if (Test-Path $file) { + $fileName = Split-Path $file -Leaf + $outputPath = "$output/$fileName" + + Write-Host "Copying $fileName to $output..." + + scp -P $port $file "${user}@${sshHost}:${output}" + + if ($LASTEXITCODE -eq 0) { + Write-Host "Running chmod..." + + ssh -p $port "${user}@${sshHost}" "chown mangos:mangos '$outputPath' && chmod 775 '$outputPath'" + } + + } else { + Write-Warning "Input file not found: $file" + } +} + +Write-Host "Restarting server..." +ssh -p $port "${user}@${sshHost}" "cd /home/mangos/moonwell-server && docker compose restart ac-worldserver" + +Write-Host "Done." \ No newline at end of file