| 123456789101112131415161718 |
- param(
- [string]$Host = "10.0.100.24",
- [string]$User = "pch",
- [string]$ProjectPath = ".\mic_system"
- )
- $ErrorActionPreference = "Stop"
- if (-not (Test-Path "$HOME\.ssh\id_ed25519")) {
- ssh-keygen -t ed25519 -N "" -f "$HOME\.ssh\id_ed25519"
- }
- type "$HOME\.ssh\id_ed25519.pub" | ssh "$User@$Host" "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
- scp -r "$ProjectPath" "$User@$Host:/home/$User/"
- ssh "$User@$Host" "chmod +x /home/$User/mic_system/scripts/setup_rpi.sh && /home/$User/mic_system/scripts/setup_rpi.sh"
- Write-Host "Deployment complete."
|