Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Add SSH shell profile setup to JB first-boot script

Lakr1888131fc8bc
diff --git a/scripts/vphone_jb_setup.sh b/scripts/vphone_jb_setup.sh
index 5b6ccb9a..5c101f5f 100755
--- a/scripts/vphone_jb_setup.sh
+++ b/scripts/vphone_jb_setup.sh
@@ -61,7 +61,7 @@ JB_TARGET="/private/preboot/$BOOT_HASH/jb-vphone/procursus"
# Procursus launchctl crashes (missing _launch_active_user_switch symbol).
# iosbinpack64's launchctl talks to launchd fine and always exits 0,
# which is enough for dpkg postinst/prerm script compatibility.
-log "[0/7] Linking iosbinpack64 launchctl into procursus..."
+log "[0/8] Linking iosbinpack64 launchctl into procursus..."
IOSBINPACK_LAUNCHCTL=""
for p in /iosbinpack64/bin/launchctl /iosbinpack64/usr/bin/launchctl; do
[ -f "$p" ] && IOSBINPACK_LAUNCHCTL="$p" && break
@@ -81,7 +81,7 @@ else
fi
# ═══════════ 1/7 SYMLINK /var/jb ═════════════════════════════
-log "[1/7] Creating /private/var/jb symlink..."
+log "[1/8] Creating /private/var/jb symlink..."
CURRENT_LINK=$(readlink /private/var/jb 2>/dev/null || true)
if [ "$CURRENT_LINK" = "$JB_TARGET" ]; then
log " Symlink already correct"
@@ -91,7 +91,7 @@ else
fi
# ═══════════ 2/7 FIX OWNERSHIP / PERMISSIONS ═════════════════
-log "[2/7] Fixing mobile Library ownership..."
+log "[2/8] Fixing mobile Library ownership..."
mkdir -p /var/jb/var/mobile/Library/Preferences
chown -R 501:501 /var/jb/var/mobile/Library
chmod 0755 /var/jb/var/mobile/Library
@@ -100,7 +100,7 @@ chmod 0755 /var/jb/var/mobile/Library/Preferences
log " Ownership set"
# ═══════════ 3/7 RUN prep_bootstrap.sh ═══════════════════════
-log "[3/7] Running prep_bootstrap.sh..."
+log "[3/8] Running prep_bootstrap.sh..."
if [ -f /var/jb/prep_bootstrap.sh ]; then
NO_PASSWORD_PROMPT=1 /var/jb/prep_bootstrap.sh || log " prep_bootstrap.sh exited with $?"
log " prep_bootstrap.sh completed"
@@ -120,7 +120,7 @@ export PATH="${P#:}"
log " PATH=$PATH"
# ═══════════ 4/7 CREATE MARKER FILES ═════════════════════════
-log "[4/7] Creating marker files..."
+log "[4/8] Creating marker files..."
for marker in .procursus_strapped .installed_dopamine; do
if [ -f "/var/jb/$marker" ]; then
log " $marker already exists"
@@ -133,7 +133,7 @@ for marker in .procursus_strapped .installed_dopamine; do
done
# ═══════════ 5/7 INSTALL SILEO ═══════════════════════════════
-log "[5/7] Installing Sileo..."
+log "[5/8] Installing Sileo..."
SILEO_DEB_PATH="/private/preboot/$BOOT_HASH/org.coolstar.sileo_2.5.1_iphoneos-arm64.deb"
if dpkg -s org.coolstar.sileo >/dev/null 2>&1; then
@@ -151,7 +151,7 @@ uicache -a 2>/dev/null || true
log " uicache refreshed"
# ═══════════ 6/7 APT SETUP ══════════════════════════════════
-log "[6/7] Running apt setup..."
+log "[6/8] Running apt setup..."
# Determine apt sources directory
HAVOC_LIST="/var/jb/etc/apt/sources.list.d/havoc.list"
@@ -181,7 +181,7 @@ apt-get -o APT::Get::AllowUnauthenticated=true \
log " apt upgrade done"
# ═══════════ 7/7 INSTALL TROLLSTORE LITE ═════════════════════
-log "[7/7] Installing TrollStore Lite..."
+log "[7/8] Installing TrollStore Lite..."
if dpkg -s com.opa334.trollstorelite >/dev/null 2>&1; then
log " TrollStore Lite already installed"
else
@@ -193,6 +193,20 @@ fi
uicache -a 2>/dev/null || true
log " uicache refreshed"
+# ═══════════ 8/8 SHELL PROFILES FOR SSH ═══════════════════════
+log "[8/8] Setting up shell profiles for SSH..."
+# .bashrc — non-login interactive shells (dropbear default)
+# .bash_profile — login shells (some SSH configurations)
+# Both source /var/jb/etc/profile to get the full JB PATH.
+for profile in /var/root/.bashrc /var/root/.bash_profile; do
+ if [ ! -f "$profile" ]; then
+ printf '%s\n' '# Source JB environment' '[ -r /var/jb/etc/profile ] && . /var/jb/etc/profile' > "$profile"
+ log " $profile created"
+ else
+ log " $profile already exists, skipping"
+ fi
+done
+
# ═══════════ DONE ════════════════════════════════════════════
: > "$DONE_MARKER"
log "=== vphone_jb_setup.sh complete ==="