1#!/bin/zsh
2
3if [ $# -lt 1 ]; then
4  echo 1>&2 "$0: must supply ssh port numbers of devices to update, e.g. 10873, 12873, etc."
5  echo 1>&2 "$0 10873 12873 15873"
6  exit 2
7fi
8
9for port in "$@"
10do
11        echo "Copying roots to port: $item"
12        RSYNC_PASSWORD=alpine rsync -av /tmp/securitysoscircle.roots.tgz rsync://root@localhost:$port/root/var/mobile/
13        RSYNC_PASSWORD=alpine rsync -av ~/bin/sosinstallroot rsync://root@localhost:$port/root/usr/local/bin/sosinstallroot
14done
15
16udids=( 79003b34516ba80b620e3d947e7da96e033bed48 96476595e5d0ef7496e8ff852aedf4725647960b )
17 
18for U in $udids
19do
20	echo "updating device $U"
21        PurpleExec --target $U /usr/local/bin/mobile_install rebuild internal
22        PurpleExec --target $U chmod +x /usr/local/bin/sosinstallroot
23	PurpleExec --target $U script /var/log/myscript.log /usr/local/bin/sosinstallroot
24done
25
26