| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "strconv" |
| 6 | ) |
| 7 | |
| 8 | func installerCommandLine(installer, dir string) string { |
| 9 | // Keep this in sync with cmd/update-helper/args.go. The desktop uses it for |
| 10 | // its Windows command invariant tests; the copied helper extracts to a |
| 11 | // transaction-owned staging directory after the desktop exits. |
| 12 | line := fmt.Sprintf(`"%s" /REASONIXUPDATE=1 /REASONIXSTAGE=1`, installer) |
| 13 | if dir != "" { |
| 14 | line += " /D=" + dir |
| 15 | } |
| 16 | return line |
| 17 | } |
| 18 | |
| 19 | func windowsUpdateHandoffArgs(parentPID int, installer, installerSHA256, installDir, relaunch, toVersion, createdAt, transactionID string) []string { |
| 20 | args := []string{ |
| 21 | "--parent-pid", strconv.Itoa(parentPID), |
| 22 | "--installer", installer, |
| 23 | "--installer-sha256", installerSHA256, |
| 24 | "--to-version", toVersion, |
| 25 | "--created-at", createdAt, |
| 26 | "--transaction-id", transactionID, |
| 27 | } |
| 28 | if installDir != "" { |
| 29 | args = append(args, "--install-dir", installDir) |
| 30 | } |
| 31 | if relaunch != "" { |
| 32 | args = append(args, "--relaunch", relaunch) |
| 33 | } |
| 34 | return args |
| 35 | } |
| 36 | |
| 37 | func windowsVersionedUpdateHandoffArgs(parentPID int, installer, installerSHA256, installDir, relaunch, toVersion string) []string { |
| 38 | args := []string{ |
| 39 | "--parent-pid", strconv.Itoa(parentPID), |
| 40 | "--installer", installer, |
| 41 | "--installer-sha256", installerSHA256, |
| 42 | "--to-version", toVersion, |
| 43 | "--install-layout", "versioned-v1", |
| 44 | } |
| 45 | if installDir != "" { |
| 46 | args = append(args, "--install-dir", installDir) |
| 47 | } |
| 48 | if relaunch != "" { |
| 49 | args = append(args, "--relaunch", relaunch) |
| 50 | } |
| 51 | return args |
| 52 | } |
| 53 |