Run a virtual iPhone on an Apple Silicon Mac.
Swift
Address setup hardening review issues
xiahouzhen82cc1a4d83d0
diff --git a/scripts/ramdisk_build.py b/scripts/ramdisk_build.pyindex 04ede45d..02c551f4 100755--- a/scripts/ramdisk_build.py+++ b/scripts/ramdisk_build.py@@ -158,7 +158,10 @@ def run(cmd, **kwargs):def run_sudo(cmd, **kwargs):- """Run a command directly first, then retry through sudo if required."""+ """Run hdiutil directly first, then retry through sudo if required."""+ if not cmd or os.path.basename(cmd[0]) != "hdiutil":+ return run(cmd, **kwargs)+try:return run(cmd, **kwargs)except subprocess.CalledProcessError:@@ -172,12 +175,13 @@ def run_sudo(cmd, **kwargs):return run(["sudo", *cmd], **kwargs)-def detach_mountpoint(mountpoint):- """Best-effort detach for hdiutil mountpoints used during ramdisk builds."""- subprocess.run(- ["hdiutil", "detach", "-force", mountpoint],- capture_output=True,- )+def detach_mountpoint(mountpoint, required=False):+ """Detach hdiutil mountpoints used during ramdisk builds."""+ try:+ run_sudo(["hdiutil", "detach", "-force", mountpoint], capture_output=True)+ except subprocess.CalledProcessError:+ if required:+ raisedef ensure_path_within_vm(path, vm_dir, label):@@ -542,7 +546,7 @@ def build_ramdisk(restore_dir, im4m_path, vm_dir, input_dir, output_dir, temp_diramdisk_custom,])- detach_mountpoint(mountpoint)+ detach_mountpoint(mountpoint, required=True)# Mount expanded, inject SSHprint(" Mounting expanded ramdisk...")diff --git a/scripts/vphone_jb_setup.sh b/scripts/vphone_jb_setup.shindex 5d2d82a5..1b9e9f89 100755--- a/scripts/vphone_jb_setup.sh+++ b/scripts/vphone_jb_setup.sh@@ -97,7 +97,7 @@ chown -R 501:501 /var/jb/var/mobile/Librarychmod 0755 /var/jb/var/mobile/Librarychown -R 501:501 /var/jb/var/mobile/Library/Preferenceschmod 0755 /var/jb/var/mobile/Library/Preferences-chown -R 0:0 /var/jb/Library+chown 0:0 /var/jb/Library /var/jb/Library/MobileSubstrate /var/jb/Library/MobileSubstrate/DynamicLibrarieschmod 0755 /var/jb/Library /var/jb/Library/MobileSubstrate /var/jb/Library/MobileSubstrate/DynamicLibrarieslog " Ownership set"@@ -206,8 +206,10 @@ log " apt upgrade done"# ═══════════ 7/7 INSTALL TROLLSTORE LITE ═════════════════════log "[7/8] Installing TrollStore Lite..."+TROLLSTORE_READY=0if dpkg -s com.opa334.trollstorelite >/dev/null 2>&1; thenlog " TrollStore Lite already installed"+ TROLLSTORE_READY=1elseapt-get -o APT::Get::AllowUnauthenticated=true \install -y -qq com.opa334.trollstorelite 2>&1@@ -217,6 +219,7 @@ elseelseif dpkg -s com.opa334.trollstorelite >/dev/null 2>&1; thenlog " TrollStore Lite installed"+ TROLLSTORE_READY=1elselog " WARNING: TrollStore Lite install completed without registering package"fi@@ -241,5 +244,9 @@ for profile in /var/root/.bashrc /var/root/.bash_profile; dodone# ═══════════ DONE ════════════════════════════════════════════-: > "$DONE_MARKER"-log "=== vphone_jb_setup.sh complete ==="+if [ "$TROLLSTORE_READY" = "1" ]; then+ : > "$DONE_MARKER"+ log "=== vphone_jb_setup.sh complete ==="+else+ log "=== vphone_jb_setup.sh core steps complete; TrollStore Lite still pending, marker not written ==="+fi