From 6b6050d1c1728b9ea438b119bf8a87a787479830 Mon Sep 17 00:00:00 2001 From: lda Date: Fri, 9 Oct 2026 23:22:20 +0700 Subject: [PATCH] copy more files + remove force --- remote/copy.ps1 | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) mode change 100644 => 100755 remote/copy.ps1 diff --git a/remote/copy.ps1 b/remote/copy.ps1 old mode 100644 new mode 100755 index 764d43f..a24fe8b --- a/remote/copy.ps1 +++ b/remote/copy.ps1 @@ -14,7 +14,22 @@ pscp.exe -l root -scp -pw $PASSWD -r 192.168.100.1:/etc/ldlda_help $PSScriptRoot pscp.exe -l root -scp -pw $PASSWD 192.168.100.1:/etc/rc.local $PSScriptRoot pscp.exe -l root -scp -pw $PASSWD -r 192.168.100.1:/etc/wakey-agent $PSScriptRoot -Remove-Item -Recurse (Join-Path $PSScriptRoot "root") +$uciDir = Join-Path $PSScriptRoot 'uci-config' +New-Item -ItemType Directory -Force -Path $uciDir | Out-Null +# This ignored backup contains credentials; do not add it to version control. +pscp.exe -l root -scp -pw $PASSWD 192.168.100.1:/etc/config/wakey (Join-Path $uciDir 'wakey') + +$rootBackup = Join-Path $PSScriptRoot 'root' +if (Test-Path -LiteralPath $rootBackup) { + # Router backups include hidden/read-only files. Fail once if deletion is + # genuinely blocked rather than merging a fresh copy into a partial backup. + try { + Remove-Item -LiteralPath $rootBackup -Recurse -Force -ErrorAction Stop + } + catch { + throw "Cannot remove previous router backup '$rootBackup': $($_.Exception.Message)" + } +} pscp.exe -l root -scp -pw $PASSWD -r 192.168.100.1:/root $PSScriptRoot