ios_system icon indicating copy to clipboard operation
ios_system copied to clipboard

Request for kubectl

Open yisiqi opened this issue 6 years ago • 7 comments

Support for kubectl will make Kubernetes cluster operations easier. O&M engineers need this feature very much.

yisiqi avatar Jul 09 '19 07:07 yisiqi

Hi, I'll see what I can do. After a quick research, I was unable to find the source code for this command, only precompiled binaries.

holzschu avatar Jul 09 '19 07:07 holzschu

For my own future reference: https://github.com/kubernetes/kubectl

holzschu avatar Jul 09 '19 07:07 holzschu

yes, that is the official source repo. And it's a golang program.

For my own future reference: https://github.com/kubernetes/kubectl

yisiqi avatar Jul 09 '19 07:07 yisiqi

I tried compiling a simple hello world with go build. Everything goes well. But when I download the executable file into the blink shell, It's not working, caused by command not found.

Here is the screenshot: image

yisiqi avatar Oct 28 '19 06:10 yisiqi

Hi, I have many questions here.

  • which flags did you use to convince golang to cross-compile for arm64 / iOS instead of the host machine (probably x86 / OSX)?
  • did you link the binary with ios_system.framework? otherwise the output will go to the console, which is not useful.
  • binary commands have to be signed before they can be executed on iOS. The only way to do that is at install time, so you would have to sideload blinkshell and add go-test to the list of embedded binaries, and to the list of commands in Resources/commandDictionary.plist.

holzschu avatar Oct 28 '19 08:10 holzschu

I used the following command to compile my test program.

CC=/usr/local/go/misc/ios/clangwrap.sh GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build

Then use ldid to sign the binary. I'm not sure if that works.

Your question has brought me some tips. But I don't know how to link the binary with ios_system.framework.

yisiqi avatar Oct 28 '19 12:10 yisiqi

ldid works for signing, but for iOS to accept a binary it has be both signed and placed in the right location. The only way to access this location is at install time, so you will have to compile your own version of Blink (It's free as long as you accept recompiling every 7 days).

To have your command recognized by iOS, you need to add the binary to the list of embedded binaries in the XCode project, and to commandDictionary.plist. Once you've done that, you should be able to start your command. The output might be on the XCode console.

The big difficulty is making sure your command runs multiple times: often, memory de-allocation is not treated as the command exits (because when a command exits, it releases all of its memory). This is not true with iOS, and so you need to reset all variables and release all memory on exit.

holzschu avatar Oct 28 '19 12:10 holzschu