1#!/bin/zsh 2 3echo 'Copying ssh keys to devices' 4 5sshopts=(-o CheckHostIP=no -o StrictHostKeyChecking=no -o NoHostAuthenticationForLocalhost=yes -o UserKnownHostsFile=/dev/null) 6 7locations=(`mobdev list | awk '/UDID/ { gsub(/^(.*location ID = )+|(,.*)+$/, ""); print}'`) 8 9port_offset=20000 10 11mkdir -p /var/tmp/roothome/.ssh/ 12cat ~/.ssh/id_*.pub > /var/tmp/roothome/.ssh/authorized_keys 13 14for location in $locations 15do 16 echo 'Copying to location '"$location" 17 18 tcprelay --portoffset $port_offset --locationid $location ssh --quiet & 19 20 (( sshport = $port_offset + 22 )) 21 22 echo "Copying file to device (via port $sshport)" 23 scp -r -P $sshport $sshopts /var/tmp/roothome/.ssh root@localhost:/var/root/ 24 25 kill -HUP %% 26done 27