deploy_from_windows.ps1 626 B

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