]> git.saurik.com Git - apple/security.git/blob - Security/sec/SOSCircle/CloudKeychainProxy/scripts/install_on_devices
Security-57031.1.35.tar.gz
[apple/security.git] / Security / 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 mysrcdir=`pwd`
11 port_offset=20000
12
13 symdir="/var/mobile/secsyms"
14
15 for location in $locations
16 do
17 echo 'Installing to location '"$location"
18
19 tcprelay --portoffset $port_offset --locationid $location ssh >/dev/null 2>&1 &
20
21 (( sshport = $port_offset + 22 ))
22
23 echo "Copying roots to device (via port $sshport)"
24 scp -P $sshport $sshopts $roots $syms $srcs root@localhost:/var/mobile/
25
26 echo "SSH to device and do commands"
27 ssh $sshopts -p $sshport root@localhost << END
28 /bin/hostname
29 /sbin/mount -uw /
30 mkdir -p /var/mobile/syms
31 mkdir -p /var/mobile/srcs
32 rm -rf /var/mobile/syms/*
33 rm -rf /var/mobile/srcs/*
34 /usr/local/bin/darwinup install "/var/mobile/`basename $roots`" | grep -v '^ /'
35 /usr/local/bin/darwinup uninstall superseded > /dev/null 2>&1 || true
36 touch /System/Library/Caches/com.apple.xpcd/xpcd_cache.dylib
37 /usr/local/bin/mobile_install rebuild internal
38 /bin/launchctl stop com.apple.securityd
39 /bin/launchctl stop com.apple.security.cloudkeychainproxy3
40 /bin/launchctl stop com.apple.security.CircleJoinRequest
41 tar -xzvf "/var/mobile/`basename $syms`" -C /var/mobile/syms >/dev/null
42 tar -xzvf "/var/mobile/`basename $srcs`" -C /var/mobile/srcs >/dev/null
43 END
44
45 kill -HUP %%
46 done
47
48 echo "in lldb: settings set target.source-map ""$mysrcdir"" /var/mobile/srcs/"
49 echo "in lldb: add-dsym /var/mobile/syms/securityd.dSYM"
50