Skip to content

Commit

Permalink
fixed documentation for example for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Code-Hex committed Aug 26, 2022
1 parent c2192ea commit 6d4ae57
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 26 deletions.
13 changes: 7 additions & 6 deletions example/macOS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ You can get knowledge build and codesign process in Makefile.
make all
```

## Setup Hints
## Run

- I used `ubuntu-20.04.1-live-server-arm64.iso` in this example
- [The Unarchiver](https://apps.apple.com/us/app/the-unarchiver/id425424353?mt=12) can extracts some important files from iso.
- `vmlinuz` and `initrd` in `/casper`
- Need to rename vmlinuz to vmlinuz.gz and unarchive it.
- https://forums.macrumors.com/threads/ubuntu-linux-virtualized-on-m1-success.2270365/
- `./virtualization -install` install macOS to your VM.
- `./virtualization` run macOS VM.

## Resources

Some resources will be created in `VM.bundle` directory on your home directory.
29 changes: 9 additions & 20 deletions example/macOS/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,33 @@ package main

import (
"context"
"flag"
"fmt"
"log"
"os"
"os/signal"
"runtime"
"syscall"
"time"

"github.com/Code-Hex/vz/v2"
)

func main() {
// progressReader, err := vz.FetchLatestSupportedMacOSRestoreImage(context.Background(), "RestoreImage.ipsw")
// if err != nil {
// log.Fatal(err)
// }

// ticker := time.NewTicker(time.Millisecond * 500)
// defer ticker.Stop()
// for {
// select {
// case <-ticker.C:
// log.Printf("progress: %f", progressReader.FractionCompleted()*100)
// case <-progressReader.Finished():
// log.Println("finished", progressReader.Err())
// return
// }
// }
var install bool

func init() {
flag.BoolVar(&install, "install", false, "run command as install mode")
}

func main() {
flag.Parse()
if err := run(context.Background()); err != nil {
fmt.Fprintf(os.Stderr, "failed to run: %v", err)
os.Exit(1)
}
}

func run(ctx context.Context) error {
if false {
defer time.Sleep(time.Second)
if install {
return installMacOS(ctx)
}
return runVM(ctx)
Expand Down

0 comments on commit 6d4ae57

Please sign in to comment.