diff --git a/build.ps1 b/build.ps1 index f3d79fc..6576d81 100644 --- a/build.ps1 +++ b/build.ps1 @@ -39,7 +39,7 @@ Remove-Item "$pwd\src\bitBetter\cert.cert" -Force # gather all running instances $oldinstances = docker container ps --all -f Name=bitwarden --format '{{.ID}}' -# stop all running instances +# stop and remove all running instances foreach ($instance in $oldinstances) { docker stop $instance docker rm $instance @@ -58,10 +58,10 @@ else } } -# stop and remove previous existing patch(ed) container -docker stop bitwarden-patch -docker rm bitwarden-patch -docker image rm bitwarden-patch +# remove previous existing patch(ed) image +if (docker image ls -q bitwarden-patch) { + docker image rm bitwarden-patch +} # start a new bitwarden instance so we can patch it $patchinstance = docker run -d --name bitwarden-patch ghcr.io/bitwarden/self-host:beta diff --git a/build.sh b/build.sh index 468e22c..f0417b1 100755 --- a/build.sh +++ b/build.sh @@ -40,7 +40,7 @@ rm -f "$PWD/src/bitBetter/cert.cert" # gather all running instances OLDINSTANCES=$(docker container ps --all -f Name=bitwarden --format '{{.ID}}') -# stop all running instances +# stop and remove all running instances for INSTANCE in ${OLDINSTANCES[@]}; do docker stop $INSTANCE docker rm $INSTANCE @@ -58,10 +58,10 @@ else fi fi -# stop and remove previous existing patch(ed) container -docker stop bitwarden-patch -docker rm bitwarden-patch -docker image rm bitwarden-patch +# remove previous existing patch(ed) image +if [ "$(docker image ls -q bitwarden-patch)" ]; then + docker image rm bitwarden-patch +fi # start a new bitwarden instance so we can patch it PATCHINSTANCE=$(docker run -d --name bitwarden-patch ghcr.io/bitwarden/self-host:beta) diff --git a/src/bitBetter/Program.cs b/src/bitBetter/Program.cs index 2d1ed78..c6c067e 100644 --- a/src/bitBetter/Program.cs +++ b/src/bitBetter/Program.cs @@ -41,7 +41,7 @@ internal class Program Console.WriteLine($"New Cert Thumbprint: {certificate.Thumbprint}"); - IEnumerable services = moduleDefMd.Types.Where(t => t.Namespace == "Bit.Core.Services"); + IEnumerable services = moduleDefMd.Types.Where(t => t.Namespace == "Bit.Core.Billing.Services"); TypeDef type = services.First(t => t.Name == "LicensingService"); MethodDef constructor = type.FindConstructors().First(); diff --git a/src/licenseGen/Dockerfile b/src/licenseGen/Dockerfile index b5aa0fb..2b5d261 100644 --- a/src/licenseGen/Dockerfile +++ b/src/licenseGen/Dockerfile @@ -12,4 +12,4 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0 WORKDIR /app COPY --from=build /app . -ENTRYPOINT [ "dotnet", "/app/licenseGen.dll", "--core", "/app/Core.dll", "--executable", "/app/Api", "--cert", "/app/cert.pfx" ] \ No newline at end of file +ENTRYPOINT [ "dotnet", "/app/licenseGen.dll", "--core", "/app/Core.dll", "--cert", "/app/cert.pfx" ] \ No newline at end of file diff --git a/src/licenseGen/Program.cs b/src/licenseGen/Program.cs index 7efb41b..c8b9ea0 100644 --- a/src/licenseGen/Program.cs +++ b/src/licenseGen/Program.cs @@ -53,7 +53,7 @@ internal class Program } Console.WriteLine("Interactive license mode..."); - + while (licenseType == "") { Console.WriteLine("What would you like to generate, a [u]ser license or an [o]rg license: "); @@ -238,7 +238,7 @@ internal class Program CommandArgument storage = config.Argument("Storage", "extra storage space in GB. Maximum is " + Int16.MaxValue + " (optional, default = max)"); CommandArgument businessName = config.Argument("BusinessName", "name for the organization (optional)"); CommandArgument key = config.Argument("Key", "your key id (optional)"); - + config.OnExecute(() => { if (!VerifyTopOptions()) @@ -360,7 +360,7 @@ internal class Program { Assembly core = AssemblyLoadContext.Default.LoadFromAssemblyPath(corePath); - Type type = core.GetType("Bit.Core.Models.Business.UserLicense"); + Type type = core.GetType("Bit.Core.Billing.Models.Business.UserLicense"); Type licenseTypeEnum = core.GetType("Bit.Core.Enums.LicenseType"); Object license = Activator.CreateInstance(type); @@ -393,7 +393,7 @@ internal class Program { Assembly core = AssemblyLoadContext.Default.LoadFromAssemblyPath(corePath); - Type type = core.GetType("Bit.Core.Models.Business.OrganizationLicense"); + Type type = core.GetType("Bit.Core.Billing.Models.Business.OrganizationLicense"); Type licenseTypeEnum = core.GetType("Bit.Core.Enums.LicenseType"); Type planTypeEnum = core.GetType("Bit.Core.Billing.Enums.PlanType");