patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob 30beca30e578b5c869eaedf2fd7e8913bf616a0c 1936 bytes (raw)
name: vm/app/updates.nix 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2023 Alyssa Ross <hi@alyssa.is>

import ../../lib/call-package.nix (
{ callSpectrumPackage, lib, pkgsMusl, pkgsStatic, src, writeScript, systemd }:

pkgsMusl.callPackage (
{ stdenvNoCC, curl }:

pkgsStatic.callPackage (
{ execline, runCommand }:

let
  raw_update_url = builtins.readFile ../../update-url;
  update-url =
    if builtins.match "^https?://([[:alnum:]:./?=~-]|%[[:xdigit:]]{2})+/\n$" raw_update_url == null then
      builtins.abort "Bad update URL"
    else
      builtins.substring 0 (builtins.stringLength raw_update_url - 1) raw_update_url;
  sysupdate-d = stdenvNoCC.mkDerivation {
    name = "spectrum-systemd-transfer-files";
    src = ./.;
    installPhase =
      ''
      mkdir -- "$out"
      (
        cd -- "$src" &&
        for i in sysupdate.d/*.transfer; do
          s=''${i#sysupdate.d/} &&
          sed 's,@UPDATE_URL@,${update-url},g' < "$i" > "$out/$s" || exit
        done
        printf %s\\n '${update-url}' > "$out/update-url"
      ) || exit
      '';
  };
  l = lib.escapeShellArgs;
  mountpoint = "/run/virtiofs/virtiofs0/user";
  sysupdate-path = "${systemd}/lib/systemd/systemd-sysupdate";
  runner = writeScript "update-run-script" (
    "#!/bin/sh --\n" +
    builtins.concatStringsSep " && \\\n" [
      (l ["mount" "-toverlay" "-olowerdir=${mountpoint}/etc:/etc" "--" "overlay" "/etc"])
      (l [sysupdate-path "--definitions=${sysupdate-d}" "update"])
      (l ["${curl}/bin/curl" "-L" "--proto" "=http,https"
          "-o" "${mountpoint}/update-destination/SHA256SUMS.gpg"
          "--" "${update-url}SHA256SUMS.gpg"])
      (l ["${curl}/bin/curl" "-L" "--proto" "=http,https"
          "-o" "${mountpoint}/update-destination/SHA256SUMS"
          "--" "${update-url}/SHA256SUMS"])
    ]);
in

callSpectrumPackage ../make-vm.nix {} {
  providers.net = [ "sys.netvm" ];
  type = "nix";
  run = "${runner}";
}) {}) {}) (_: {})

debug log:

solving 30beca30e578b5c869eaedf2fd7e8913bf616a0c ...
found 30beca30e578b5c869eaedf2fd7e8913bf616a0c in https://inbox.spectrum-os.org/spectrum-devel/20251029-updates-v1-7-401c1be2a11b@gmail.com/

applying [1/1] https://inbox.spectrum-os.org/spectrum-devel/20251029-updates-v1-7-401c1be2a11b@gmail.com/
diff --git a/vm/app/updates.nix b/vm/app/updates.nix
new file mode 100644
index 0000000000000000000000000000000000000000..30beca30e578b5c869eaedf2fd7e8913bf616a0c

Checking patch vm/app/updates.nix...
Applied patch vm/app/updates.nix cleanly.

index at:
100644 30beca30e578b5c869eaedf2fd7e8913bf616a0c	vm/app/updates.nix

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).