Merge pull request #4 from Unifi-Tools/fix-serial

Allow --serial without --vendor
This commit is contained in:
Gutemberg Ribeiro 2021-04-27 12:46:40 -03:00 committed by GitHub
commit 640627f637
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -118,10 +118,9 @@ rootCommand.Handler = CommandHandler
Console.WriteLine($"### Patching {imgName}...");
if ((string.IsNullOrWhiteSpace(vendor) && !string.IsNullOrWhiteSpace(serial)) ||
(!string.IsNullOrWhiteSpace(vendor) && string.IsNullOrWhiteSpace(serial)))
if (!string.IsNullOrWhiteSpace(vendor) && string.IsNullOrWhiteSpace(serial))
{
Console.Error.WriteLine($"To set the GPON Serial Number, you must pass both --vendor and --serial");
Console.Error.WriteLine($"To set the GPON Serial Number, you must pass both --vendor and --serial. You can skip the --vendor if you provide the full serial as HEX to the --serial.");
Environment.ExitCode = -1;
return;
}
@ -130,6 +129,10 @@ rootCommand.Handler = CommandHandler
ram.SetGponId(vendor);
ram.SetGponSerialNumber(serial);
}
else if (string.IsNullOrWhiteSpace(vendor) && !string.IsNullOrWhiteSpace(serial))
{
ram.SetGponSerialNumber(serial);
}
if (!string.IsNullOrWhiteSpace(mac))
{