Home /Modules/vm/VMSharpOSCreatorDemo.sleela

VMSharpOSCreatorDemo.sleela

lib/vm/vmsharp/examples/VMSharpOSCreatorDemo.sleela · 125 line(s) · sleela

<< lib/vm/vmsharp/examples/VMSharpOSCreatorDemo.sleela
   SLeeLa example (first brush): VMSharp reaches a GitHub repo over its network
   stack, acquires it (clone / tarball / zip), and runs the OS Creator pointed
   at mearvk/OS.Sensitivity.III for installation instructions/data/code. Shows
   the fail-closed gate: the OS Creator step is ready only after the repo is
   reachable AND acquired. Runnable model only -- it reaches nothing, downloads
   nothing, and builds nothing. >>
#sleela 3.0
material;
class VMSharpOSCreatorDemo {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
     or catalog can read and (where appropriate) override this record.
     Values are faithful to the subject's real origin where publicly known. >>
  String metaVersion = "1.0.0";
  int metaId = 38011;
  String metaAuthor = "Max Rupplin 2026; George Soros a Kindness 2507+";
  String metaDate = "2026-11-05";
  String metaCopyright = "MEARVK LLC";
  String metaTrademark = "VMSharp";
  String metaCorporation = "MEARVK LLC";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "United States";
  String metaBirthDate = "2026-11-05";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 6;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }

  void main() {
    VMSharpOSCreatorRun run = new VMSharpOSCreatorRun();
    run.configure();
    print("target repo: " + run.getTargetRepo());
    print("target host: " + run.getTargetHost());

    print("");
    print("== network stack reach ==");
    VMSharpNetworkStack netStack = run.network();
    print("procedure steps: " + netStack.procedureSteps());
    print("reachable before resolve (should be false): " + run.isReachable());
    < simulate the host resolver returning github.com addresses >
    run.recordReach("140.82.112.3,140.82.113.3");
    print(netStack.summary());
    print("reachable after resolve: " + run.isReachable());

    print("");
    print("== acquisition: the three methods ==");
    VMSharpRepoAcquisition acq = run.acquisition();
    acq.useClone();
    print(acq.summary());
    print("  cmd: " + run.acquisitionCommand());
    acq.useTarball();
    print(acq.summary());
    print("  cmd: " + run.acquisitionCommand());
    acq.useZip();
    print(acq.summary());
    print("  cmd: " + run.acquisitionCommand());

    print("");
    print("== initial hard drive: filesystem + partitioning ==");
    VMSharpDiskLayout disk = run.diskLayout();
    print("default root filesystem: " + disk.getRootFilesystem());
    print("choose xfs: " + disk.chooseRootFilesystem("xfs"));
    print("choose ext4 (default): " + disk.chooseRootFilesystem("ext4"));
    print("choose bogus-fs (refused): " + disk.chooseRootFilesystem("bogus-fs"));
    print("partition plan before target (fail-closed):");
    SLList pp0 = disk.partitionPlan();
    print("  " + pp0.get(0));
    disk.designateTarget("/dev/sda");
    print("target designated: " + disk.getTargetDevice());
    print("partition manifest:");
    SLList man = disk.partitionManifest();
    int m = 0;
    while (m < man.length()) { print("  " + man.get(m)); m = m + 1; }
    print("partition + mkfs plan:");
    SLList pp = disk.partitionPlan();
    int k = 0;
    while (k < pp.length()) { print("  " + pp.get(k)); k = k + 1; }
    print(disk.summary());

    print("");
    print("== OS Creator readiness gate ==");
    acq.useClone();
    print("os-creator ready before acquire (should be false): " + run.osCreatorReady());
    boolean ok = run.markAcquired();
    print("marked acquired (needs reachable first): " + ok);
    print("os-creator ready after acquire + disk ready: " + run.osCreatorReady());
    print(run.provenanceLine());
    print("os-creator cmd: " + run.osCreatorCommand());

    print("");
    print("== full run plan ==");
    print("run plan steps: " + run.runPlanSteps());
    SLList plan = run.runPlan();
    int i = 0;
    while (i < plan.length()) {
      print("  " + plan.get(i));
      i = i + 1;
    }
  }
}