
setEnvironmentVar("HOME", OpenModelica.Scripting.cd());
setEnvironmentVar("APPDATA", OpenModelica.Scripting.cd());
getEnvironmentVar("HOME");
getErrorString();
setModelicaPath(OpenModelica.Scripting.cd() + "/.openmodelica/libraries/");
getModelicaPath();
echo(false);
OpenModelica.Scripting.mkdir(".openmodelica");
if not OpenModelica.Scripting.mkdir(".openmodelica/libraries/") then
  print("\nmkdir failed\n");
  print(getErrorString());
  exit(1);
end if;
vers:=OpenModelica.Scripting.getAvailablePackageVersions(Modelica, "3.2.3");
if size(vers,1) <> 1 then
  print("getAvailablePackageVersions(Modelica, \"3.2.3\") returned " + String(size(vers,1)) + " results\n");
  print(getErrorString());
  exit(1);
end if;
if vers[1] <> "3.2.3+maint.om" then
  print("getAvailablePackageVersions(Modelica, \"3.2.3\") returned " + vers[1] + "\n");
  print(getErrorString());
  exit(1);
end if;
if not installPackage(Complex, "4.1.0+maint.om", exactMatch=true) then
  print("Complex 4.1.0+maint.om failed.\n");
  print(getErrorString());
  exit(1);
else
  print("Installed: Complex 4.1.0+maint.om\n");
end if;
if not installPackage(Complex, "4.0.0+maint.om", exactMatch=true) then
  print("Complex 4.0.0+maint.om failed.\n");
  print(getErrorString());
  exit(1);
else
  print("Installed: Complex 4.0.0+maint.om\n");
end if;
if not installPackage(Modelica, "3.2.3+maint.om", exactMatch=true) then
  print("Modelica 3.2.3+maint.om failed.\n");
  print(getErrorString());
  exit(1);
else
  print("Installed: Modelica 3.2.3+maint.om\n");
end if;
if not installPackage(Modelica, "4.1.0+maint.om", exactMatch=true) then
  print("Modelica 4.1.0+maint.om failed.\n");
  print(getErrorString());
  exit(1);
else
  print("Installed: Modelica 4.1.0+maint.om\n");
end if;
if not installPackage(Modelica, "4.0.0+maint.om", exactMatch=true) then
  print("Modelica 4.0.0+maint.om failed.\n");
  print(getErrorString());
  exit(1);
else
  print("Installed: Modelica 4.0.0+maint.om\n");
end if;
if not installPackage(ModelicaServices, "4.1.0+maint.om", exactMatch=true) then
  print("ModelicaServices 4.1.0+maint.om failed.\n");
  print(getErrorString());
  exit(1);
else
  print("Installed: ModelicaServices 4.1.0+maint.om\n");
end if;
if not installPackage(ModelicaServices, "4.0.0+maint.om", exactMatch=true) then
  print("ModelicaServices 4.0.0+maint.om failed.\n");
  print(getErrorString());
  exit(1);
else
  print("Installed: ModelicaServices 4.0.0+maint.om\n");
end if;
if not installPackage(ObsoleteModelica4, "4.1.0+maint.om", exactMatch=true) then
  print("ObsoleteModelica4 4.1.0+maint.om failed.\n");
  print(getErrorString());
  exit(1);
else
  print("Installed: ObsoleteModelica4 4.1.0+maint.om\n");
end if;
if not installPackage(ObsoleteModelica4, "4.0.0+maint.om", exactMatch=true) then
  print("ObsoleteModelica4 4.0.0+maint.om failed.\n");
  print(getErrorString());
  exit(1);
else
  print("Installed: ObsoleteModelica4 4.0.0+maint.om\n");
end if;
if not installPackage(ModelicaReference, "4.1.0+maint.om", exactMatch=true) then
  print("ModelicaReference 4.1.0+maint.om failed.\n");
  print(getErrorString());
  exit(1);
else
  print("Installed: ModelicaReference 4.1.0+maint.om\n");
end if;
if not installPackage(ModelicaReference, "4.0.0+maint.om", exactMatch=true) then
  print("ModelicaReference 4.0.0+maint.om failed.\n");
  print(getErrorString());
  exit(1);
else
  print("Installed: ModelicaReference 4.0.0+maint.om\n");
end if;
system("touch .openmodelica/20250613010610.stamp")