Skip to content

Commit

Permalink
Generalized remote build script.
Browse files Browse the repository at this point in the history
  • Loading branch information
aarant committed Mar 24, 2021
1 parent 6df5a71 commit 5d18500
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions remote_build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/bin/bash

# Rsync repo to build machine; build and scp the ROM back
# Push to SSH machine; build and scp build products back

set +v
set -e
git_branch=$(git branch --show-current)
git push build --force # ssh://merrbot:/home/ubuntu/pokeemerald
ssh merrbot "cd pokeemerald && git reset --hard && git checkout $git_branch && make"
scp merrbot:pokeemerald/pokeemerald.gba romhack.gba
# See https://unix.stackexchange.com/a/13472
remote_host=$(git remote get-url build | sed -nr -e "s/ssh:\/\/(\w+@?\w*):.*/\1/p") # Extract remote host
remote_path=$(git remote get-url build | sed -nr -e "s/ssh:\/\/\w+@?\w*://p") # Extract remote path
set -x
git push build --force
# `nproc` must be escaped so that it executes on the remote machine
ssh $remote_host "cd $remote_path && git reset --hard && git checkout $git_branch && \
echo \"Using \`nproc\` job(s)\" && make -j\`nproc\`"
scp "$remote_host:$remote_path/pokeemerald.gba" romhack.gba

0 comments on commit 5d18500

Please sign in to comment.