-
-
Notifications
You must be signed in to change notification settings - Fork 2
Add patches for newer MacOS versions #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,7 +12,7 @@ mod qcow2; | |||||
| mod serial; | ||||||
|
|
||||||
| use std::{ | ||||||
| io::{Seek, SeekFrom, Write}, | ||||||
| io::{stdin, stdout, Seek, SeekFrom, Write}, | ||||||
| path::PathBuf, | ||||||
| }; | ||||||
|
|
||||||
|
|
@@ -48,9 +48,47 @@ fn main() -> Result<()> { | |||||
|
|
||||||
| let mut plist: MacPlist = plist::from_reader(&mut conf_plist)?; | ||||||
|
|
||||||
| let serial = serial::find_desired(plist.get_product_name())?; | ||||||
| let uuid = Uuid::new_v4(); | ||||||
| let rom = { | ||||||
| let mut needs_update = false; | ||||||
|
|
||||||
| // Check if valid serials already exist | ||||||
| if plist.has_valid_serials() && !args.force_regenerate { | ||||||
| println!("Valid serial numbers already configured:"); | ||||||
| println!(" Serial Number: {}", plist.get_serial_number()); | ||||||
| println!(" MLB: {}", plist.get_mlb()); | ||||||
| println!(); | ||||||
|
|
||||||
| if !args.dry_run { | ||||||
| print!("Do you want to regenerate new serial numbers? (y/N) "); | ||||||
| stdout().flush()?; | ||||||
| let mut buffer = String::new(); | ||||||
| stdin().read_line(&mut buffer)?; | ||||||
| if !buffer.trim().eq_ignore_ascii_case("y") && !buffer.trim().eq_ignore_ascii_case("yes") { | ||||||
| println!("Keeping existing serial numbers."); | ||||||
| } else { | ||||||
| needs_update = true; | ||||||
| } | ||||||
| } | ||||||
| } else { | ||||||
| needs_update = true; | ||||||
| } | ||||||
|
|
||||||
| let serial = if needs_update { | ||||||
| serial::find_desired(plist.get_product_name())? | ||||||
| } else { | ||||||
| serial::Serial { | ||||||
| serial_number: plist.get_serial_number().to_string(), | ||||||
| board_serial: plist.get_mlb().to_string(), | ||||||
| } | ||||||
| }; | ||||||
|
|
||||||
| let uuid = if needs_update { | ||||||
| Uuid::new_v4() | ||||||
| } else { | ||||||
| // Keep existing UUID | ||||||
| Uuid::new_v4() // We'll keep this for now; ideally we'd parse the existing one | ||||||
| }; | ||||||
|
|
||||||
| let rom = if needs_update { | ||||||
| let mut rom = [0; 12]; | ||||||
| let mut rng = rand::rng(); | ||||||
|
|
||||||
|
|
@@ -69,37 +107,92 @@ fn main() -> Result<()> { | |||||
| } | ||||||
|
|
||||||
| rom | ||||||
| } else { | ||||||
| [0; 12] // Keep existing ROM | ||||||
|
||||||
| [0; 12] // Keep existing ROM | |
| plist.get_rom() // Keep existing ROM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
needs_updateis false, a new UUID is always generated instead of preserving the existing one. This contradicts the comment and the intention to keep existing values. The existing UUID should be retrieved from the plist and reused.