]> git.saurik.com Git - apple/security.git/blob - sec/SOSCircle/CloudKeychainProxy/scripts/install_on_devices
Security-55471.tar.gz
[apple/security.git] / sec / SOSCircle / CloudKeychainProxy / scripts / install_on_devices
1 #!/bin/zsh
2
3 roots="/tmp/security.roots.tgz"
4 syms="/tmp/security.syms.tgz"
5 srcs="/tmp/security.src.tgz"
6 sshopts=(-o CheckHostIP=no -o StrictHostKeyChecking=no -o NoHostAuthenticationForLocalhost=yes -o UserKnownHostsFile=/dev/null)
7
8 locations=(`mobdev list | awk '/UDID/ { gsub(/^(.*location ID = )+|(,.*)+$/, ""); print}'`)
9
10 port_offset=20000
11
12 symdir="/var/mobile/secsyms"
13
14 for location in $locations
15 do
16 echo 'Installing to location '"$location"
17
18 tcprelay --portoffset $port_offset --locationid $location ssh >/dev/null 2>&1 &
19
20 (( sshport = $port_offset + 22 ))
21
22 echo "Copying roots to device (via port $sshport)"
23 scp -P $sshport $sshopts $roots $syms $srcs root@localhost:/var/mobile/
24
25 echo "SSH to device and do commands"
26 ssh $sshopts -p $sshport root@localhost << END
27 /bin/hostname
28 /sbin/mount -uw /
29 /usr/local/bin/darwinup install "/var/mobile/`basename $roots`" | grep -v '^ /'
30 /usr/local/bin/darwinup uninstall superseded > /dev/null 2>&1 || true
31 touch /System/Library/Caches/com.apple.xpcd/xpcd_cache.dylib
32 /usr/local/bin/mobile_install rebuild internal
33 /bin/launchctl stop com.apple.securityd
34 /bin/launchctl stop com.apple.security.cloudkeychainproxy3
35 /bin/launchctl stop com.apple.security.CircleJoinRequest
36 END
37
38 kill -HUP %%
39 done