← All repositories

reportage

A life-logging app for iPhone

git clone https://code.inqk.net/reportage.git


commit 1c4ebb7e1b7c2881acee1cacfe34a50b61941a90
parent 3f0e9abafa1328b45d529cf6c969986fc3cfb596
Author: Michael Camilleri <[email protected]>
Date:   Tue, 17 Nov 2026 03:32:45 +0900

Require a device name when deploying to a device

Diffstat

MScripts/deploy-device.sh | 18++++++++++--------

1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/Scripts/deploy-device.sh b/Scripts/deploy-device.sh

@@ -2,10 +2,10 @@
 # Builds Reportage in Debug and installs it on a paired iPhone, over the local
 # network if the iPhone is on the same Wi-Fi (or over USB if it is plugged in).
 #
-# Usage: bash Scripts/deploy-device.sh [--skip-build] [--no-launch] [device]
+# Usage: bash Scripts/deploy-device.sh [--skip-build] [--no-launch] <device>
 #
 # The device is a name, UDID or identifier as `xcrun devicectl list devices`
-# shows it; without one, the first available paired iPhone is used. The
+# shows it, and is required so a build never lands on the wrong iPhone. The
 # iPhone must have been paired with Xcode, with Developer Mode on.
 #
 # Signing uses a temporary keychain holding .asc/dev.p12, not the login
@@ -26,6 +26,12 @@ for argument in "$@"; do
   esac
 done
 
+if [[ -z "$DEVICE" ]]; then
+  echo "Usage: bash Scripts/deploy-device.sh [--skip-build] [--no-launch] <device>" >&2
+  echo "Name the device as 'xcrun devicectl list devices' shows it." >&2
+  exit 1
+fi
+
 BUNDLE_ID="net.inqk.reportage"
 DERIVED_DATA="$(pwd)/.cache/device"
 APP="${DERIVED_DATA}/Build/Products/Debug-iphoneos/Reportage.app"
@@ -45,14 +51,10 @@ devices = json.load(open(sys.argv[1]))["result"]["devices"]
 wanted = sys.argv[2]
 for device in devices:
     hardware = device["hardwareProperties"]
-    connection = device["connectionProperties"]
     name = device["deviceProperties"]["name"]
     if hardware.get("reality") != "physical":
         continue
-    if wanted:
-        if wanted not in (name, hardware.get("udid"), device["identifier"]):
-            continue
-    elif hardware.get("deviceType") != "iPhone" or connection.get("pairingState") != "paired":
+    if wanted not in (name, hardware.get("udid"), device["identifier"]):
         continue
     print(hardware["udid"], name)
     break
@@ -60,7 +62,7 @@ EOF
 )
 
 if [[ -z "${UDID:-}" ]]; then
-  echo "No paired iPhone found${DEVICE:+ matching '${DEVICE}'}; see 'xcrun devicectl list devices'." >&2
+  echo "No device matching '${DEVICE}'; see 'xcrun devicectl list devices'." >&2
   exit 1
 fi