Skip to content

Commit 2e3845d

Browse files
committed
fix: ipsw ssh debugserver cmd being darwin only #658
1 parent 5392065 commit 2e3845d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cmd/ipsw/cmd/ssh/ssh_debugserver.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build darwin
2-
31
/*
42
Copyright © 2018-2025 blacktop
53
@@ -26,6 +24,7 @@ package ssh
2624
import (
2725
"fmt"
2826
"path/filepath"
27+
"runtime"
2928
"time"
3029

3130
"github.com/AlecAivazis/survey/v2"
@@ -100,15 +99,18 @@ var sshDebugserverCmd = &cobra.Command{
10099
return fmt.Errorf("failed to copy debugserver to device: %w", err)
101100
}
102101

103-
utils.Indent(log.Info, 2)("Running 'chmod 0755 /usr/libexec/debugserve' on device")
102+
utils.Indent(log.Info, 2)("Running 'chmod 0755 /usr/libexec/debugserver' on device")
104103
if err := cli.RunCommand("chmod 0755 /usr/libexec/debugserver"); err != nil {
105104
return fmt.Errorf("failed to chmod /usr/libexec/debugserver on device: %w", err)
106105
}
107106
} else if cli.FileExists("/usr/bin/debugserver") || viper.GetBool("ssh.debugserver.force") { // OLD location from DDI mount
107+
if runtime.GOOS != "darwin" {
108+
return fmt.Errorf("attempting to extract debugserver from DeveloperDiskImage in XCode.app on non-darwin system (not currently supported)")
109+
}
108110
// Find all the DeveloperDiskImages
109111
images, err := filepath.Glob("/Applications/Xcode*.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/*/DeveloperDiskImage.dmg")
110112
if err != nil {
111-
return fmt.Errorf("failed to glob for DeveloperDiskImage.dmg: %w", err)
113+
return fmt.Errorf("failed to glob for DeveloperDiskImage.dmg (in XCode.app): %w", err)
112114
}
113115

114116
imagePath := viper.GetString("ssh.debugserver.image")
@@ -154,7 +156,7 @@ var sshDebugserverCmd = &cobra.Command{
154156
if err := cli.CopyToDevice("/tmp/debugserver", "/usr/bin/debugserver"); err != nil {
155157
return fmt.Errorf("failed to copy debugserver to device: %w", err)
156158
}
157-
utils.Indent(log.Info, 2)("Running 'chmod 0755 /usr/libexec/debugserve' on device")
159+
utils.Indent(log.Info, 2)("Running 'chmod 0755 /usr/libexec/debugserver' on device")
158160
if err := cli.RunCommand("chmod 0755 /usr/bin/debugserver"); err != nil {
159161
return fmt.Errorf("failed to chmod /usr/bin/debugserver on device: %w", err)
160162
}

0 commit comments

Comments
 (0)