diff --git a/README.md b/README.md index 69c8df2..624c628 100644 --- a/README.md +++ b/README.md @@ -79,12 +79,19 @@ CloudMachine lives in the menu bar. Its window opens on a **Required Setup Steps** card listing what is left to do on this Mac, in order, each with a button — or, for the steps an app cannot do, a command to copy: -1. **Install rclone.** CloudMachine downloads its own copy; it signs in to - Google Drive and writes the configuration the machine gets a copy of. +1. **rclone** is downloaded automatically. At start and then every hour + CloudMachine checks its own copy; if rclone is missing or too old it + fetches it in the background (checked against the official SHA256 sums) + and the window shows the state. It signs in to Google Drive and writes + the configuration the machine gets a copy of. If the download fails (no + network, wrong checksum) the window shows the error and when the next + attempt is; there is no button and no retry faster than hourly. 2. **Connect Google Drive** — a command to run in Terminal. It opens Google's sign-in in the browser and waits for your approval. Enter your own OAuth credentials first (see [below](#your-own-google-oauth-credentials)). -3. **Install Lima** — `brew install lima`, to copy. +3. **Install Lima.** The cask installs it with Homebrew; if it is missing + (an app installed outside brew), the window says so and gives + `brew install lima` to copy — the app never runs Homebrew itself. 4. **Set up the machine** — creates and starts `cmsmb` (the first start downloads Ubuntu and installs packages, several minutes), copies rclone's configuration into it and sets its SMB password. diff --git a/mac-app/Sources/CloudMachineApp/Models/AppStatus.swift b/mac-app/Sources/CloudMachineApp/Models/AppStatus.swift index 8379c6e..f95e926 100644 --- a/mac-app/Sources/CloudMachineApp/Models/AppStatus.swift +++ b/mac-app/Sources/CloudMachineApp/Models/AppStatus.swift @@ -252,6 +252,8 @@ struct BackupProgressInfo: Equatable { @MainActor final class AppStatus: ObservableObject { @Published var dependencyState: DependencyState = .unknown + /// The automatic rclone install started when the app launches. + @Published var rcloneInstall: ToolInstallState = .idle @Published var remoteConfigured: Bool = false @Published var machine = MachineStatus() /// The answer to "when was a BACKUP last made" - the only measure @@ -298,7 +300,13 @@ final class AppStatus: ObservableObject { /// A one-sentence answer to the question "is my data safe". var headline: String { - if case .missing(let what, _) = dependencyState { + if case .missing(let what, let remedies) = dependencyState { + // Same rule as the setup card: anything but a failure is "installing". + if what == ["rclone"], !rcloneInstall.isFailure { return L10n.tr("Installing rclone") } + // Lima comes from Homebrew; the app never runs brew itself. + if what == ["Lima"], let remedy = remedies.first { + return L10n.tr("Lima is not installed - run in Terminal: %@", remedy) + } return L10n.tr("Missing: %@", what.joined(separator: ", ")) } if !remoteConfigured { return L10n.tr("Google Drive not connected") } diff --git a/mac-app/Sources/CloudMachineApp/Models/SetupPlan.swift b/mac-app/Sources/CloudMachineApp/Models/SetupPlan.swift index 52880e8..ad9b38d 100644 --- a/mac-app/Sources/CloudMachineApp/Models/SetupPlan.swift +++ b/mac-app/Sources/CloudMachineApp/Models/SetupPlan.swift @@ -17,7 +17,6 @@ import Foundation /// already exists is worse than showing the step a few seconds late. struct SetupStep: Equatable { enum Action: Equatable { - case installRclone case setUpMachine case startMachine case grantFullDiskAccess @@ -35,6 +34,8 @@ struct SetupStep: Equatable { /// What the card shows instead of `command`, when `command` holds a secret /// (the SMB password): the Copy button still copies `command`. var displayedCommand: String? + /// Something runs now: the card shows a spinner and no button. + var inProgress = false } enum SetupPlan { @@ -53,6 +54,8 @@ enum SetupPlan { /// `nil` while the machine has no address or no stored password. var setDestinationCommand: String? var maskedSetDestinationCommand: String? + /// The automatic rclone install the app starts on launch. + var rcloneInstall: ToolInstallState = .idle } /// `configure-remote`, with `--folder` only for a valid name - an invalid @@ -68,10 +71,19 @@ enum SetupPlan { static func steps(_ input: Inputs) -> [SetupStep] { var steps: [SetupStep] = [] if !input.hasRclone { - steps.append( - SetupStep( - title: L10n.tr("Install rclone (signs in to Google Drive for the machine)"), - command: nil, action: .installRclone)) + // No button: the app installs rclone itself, and retries hourly. + if case .failed(let message, let retryAt) = input.rcloneInstall { + steps.append( + SetupStep( + title: L10n.tr("rclone could not be installed: %@", message) + " " + + L10n.tr("Next attempt: %@", retryAt.formatted(date: .omitted, time: .shortened)), + command: nil, action: nil)) + } else { + steps.append( + SetupStep( + title: L10n.tr("Installing rclone - downloading and verifying it"), + command: nil, action: nil, inProgress: true)) + } } // The Drive folder of this Mac is chosen here, before the machine is // created: the machine takes its folder from it. diff --git a/mac-app/Sources/CloudMachineApp/Services/CloudMachineController.swift b/mac-app/Sources/CloudMachineApp/Services/CloudMachineController.swift index 25965c1..f152c19 100644 --- a/mac-app/Sources/CloudMachineApp/Services/CloudMachineController.swift +++ b/mac-app/Sources/CloudMachineApp/Services/CloudMachineController.swift @@ -30,6 +30,11 @@ final class CloudMachineController: ObservableObject { private var backupCycleCheckedAt: Date? /// `AgentRepair.afterLaunch`, started once per process. private var agentMaintenance: Task? + /// Installs rclone by itself when the app starts and it is missing or too + /// old; the state shows in the window instead of a bare "missing". + private let rcloneAuto = RcloneAutoInstaller.live() + private var rcloneObserverSet = false + private var rcloneError = RcloneErrorSlot() /// One failed read of the Time Machine preferences is not "no Full Disk Access". private var preferencesReads = BackupHealth.ReadConfirmation() @@ -46,12 +51,30 @@ final class CloudMachineController: ObservableObject { if agentMaintenance == nil { agentMaintenance = Task.detached { await AgentRepair.afterLaunch() } } + if !rcloneObserverSet { + rcloneAuto.onChange = { [weak self] state in + guard let self else { return } + self.status.rcloneInstall = state + self.rcloneError.apply(state, to: &self.status.errorMessage) + // Only what depends on rclone; the regular cycle does the rest. + if state == .installed || state == .idle { + Task { await self.refreshDependencies() } + } + } + rcloneObserverSet = true + } let maintenance = agentMaintenance refreshTask?.cancel() refreshTask = Task { [weak self] in var cycles = 0 while !Task.isCancelled { await self?.refreshAll() + // Cheap when not due: acts at start and then once an hour. + // Own task: a download must not stall the status refresh. + if let auto = self?.rcloneAuto { + if !CMTooling.hasManagedRclone { auto.checkNow() } + Task { await auto.tick() } + } // An agent can stop being startable later too, so check every few // minutes - never while the launch reload is still running (a failing // bootstrap can take tens of seconds; the panel does not wait for it). @@ -288,7 +311,8 @@ final class CloudMachineController: ObservableObject { let password = VMSetup.storedPassword() return SetupPlan.steps( SetupPlan.Inputs( - hasRclone: CMTooling.hasManagedRclone, remoteConfigured: status.remoteConfigured, + hasRclone: CMTooling.hasManagedRclone && !rcloneAuto.replacementNeeded, + remoteConfigured: status.remoteConfigured, hasLima: VMLayout.limactlPath != nil, machineExists: machineExists, machineRunning: status.machine.isRunning, hasFullDiskAccess: status.hasFullDiskAccess, agentsInstalled: status.agentsInstalled, @@ -298,16 +322,11 @@ final class CloudMachineController: ObservableObject { setDestinationCommand: address.flatMap { address in password.map { VMSetup.destinationCommand(password: $0, address: address) } }, - maskedSetDestinationCommand: address.map { VMSetup.maskedDestinationCommand(address: $0) }) + maskedSetDestinationCommand: address.map { VMSetup.maskedDestinationCommand(address: $0) }, + rcloneInstall: status.rcloneInstall) ) } - func installRclone() async { - await run(L10n.tr("Installing rclone"), log: "Installing rclone") { - await RcloneInstaller.install() - } - } - /// Connecting to Google Drive is done from the terminal, not from the GUI: OAuth opens /// the browser and waits for approval, and we read the keys from the Keychain. var connectDriveCommand: String { connectDriveCommand(folder: nil) } diff --git a/mac-app/Sources/CloudMachineApp/Views/DashboardView.swift b/mac-app/Sources/CloudMachineApp/Views/DashboardView.swift index 8967526..b7ce847 100644 --- a/mac-app/Sources/CloudMachineApp/Views/DashboardView.swift +++ b/mac-app/Sources/CloudMachineApp/Views/DashboardView.swift @@ -807,7 +807,6 @@ private struct DashboardContent: View { private func setupActionTitle(_ action: SetupStep.Action) -> String { switch action { - case .installRclone: return L10n.tr("Install rclone") case .setUpMachine: return L10n.tr("Set up the machine") case .startMachine: return L10n.tr("Start the machine") case .grantFullDiskAccess: return L10n.tr("Open System Settings") @@ -818,7 +817,6 @@ private struct DashboardContent: View { private func perform(_ action: SetupStep.Action) async { switch action { - case .installRclone: await controller.installRclone() case .setUpMachine: await controller.setUpMachine() case .startMachine: await controller.startMachine() case .grantFullDiskAccess: controller.openFullDiskAccessSettings() @@ -850,6 +848,10 @@ private struct DashboardContent: View { .foregroundStyle(RenaCodeTheme.textMain) } + if step.inProgress { + ProgressView().controlSize(.small) + } + if let action = step.action { setupActionButton(action) } diff --git a/mac-app/Sources/CloudMachineCore/L10nPolish+App.swift b/mac-app/Sources/CloudMachineCore/L10nPolish+App.swift index 4c3403a..a68a4ee 100644 --- a/mac-app/Sources/CloudMachineCore/L10nPolish+App.swift +++ b/mac-app/Sources/CloudMachineCore/L10nPolish+App.swift @@ -34,7 +34,6 @@ extension L10nPolish { "One folder per Mac. Set once - it cannot be changed after connecting.": "Jeden folder na Maca. Ustawiany raz - po połączeniu nie da się go zmienić.", "Use lowercase letters, digits and dashes.": "Użyj małych liter, cyfr i myślników.", - "Install rclone": "Zainstaluj rclone", "Open System Settings": "Otwórz Ustawienia systemowe", "Install agents": "Zainstaluj agentów", // AppStatus @@ -117,5 +116,13 @@ extension L10nPolish { "Time Machine starts the next one on its own schedule.": "Time Machine uruchomi kolejny według własnego harmonogramu.", "Backup cycle": "Cykl kopii", + "Installing rclone - downloading and verifying it": + "Instaluję rclone - pobieranie i weryfikacja", + "rclone could not be installed: %@": + "Nie udało się zainstalować rclone: %@", + "Next attempt: %@": + "Następna próba: %@", + "Lima is not installed - run in Terminal: %@": + "Lima nie jest zainstalowana - uruchom w Terminalu: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nPolish+Machine.swift b/mac-app/Sources/CloudMachineCore/L10nPolish+Machine.swift index c0af30c..ef2f941 100644 --- a/mac-app/Sources/CloudMachineCore/L10nPolish+Machine.swift +++ b/mac-app/Sources/CloudMachineCore/L10nPolish+Machine.swift @@ -46,8 +46,6 @@ extension L10nPolish { "Generuje i instaluje agentów launchd (aplikacja, czujka kopii, start maszyny, strażnik maszyny).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "Zainstaluj Limę, która uruchamia maszynę CloudMachine: wykonaj to w Terminalu", - "Install rclone (signs in to Google Drive for the machine)": - "Zainstaluj rclone (loguje maszynę do Google Drive)", "Install the background agents (machine start, buffer guard, backup watchdog)": "Zainstaluj agentów w tle (start maszyny, strażnik bufora, czujka kopii)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": diff --git a/mac-app/Sources/CloudMachineCore/L10nPolish+System.swift b/mac-app/Sources/CloudMachineCore/L10nPolish+System.swift index bd2167b..3579ee5 100644 --- a/mac-app/Sources/CloudMachineCore/L10nPolish+System.swift +++ b/mac-app/Sources/CloudMachineCore/L10nPolish+System.swift @@ -50,8 +50,6 @@ extension L10nPolish { "BRUDNE-DRZEWO", "Cannot create the working directory: %@": "Nie mogę utworzyć katalogu roboczego: %@", - "Could not read the rclone version number.": - "Nie udało się odczytać numeru wersji rclone.", "Could not download %@.": "Nie udało się pobrać %@.", "No entry for %@ in SHA256SUMS.": diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+ar.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+ar.swift index 8dd951f..0b5bc50 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+ar.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+ar.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "مجلد واحد لكل Mac. يُضبط مرة واحدة - لا يمكن تغييره بعد الاتصال.", "Use lowercase letters, digits and dashes.": "استخدم أحرفًا لاتينية صغيرة وأرقامًا وشرطات.", - "Install rclone": - "تثبيت rclone", "Open System Settings": "فتح إعدادات النظام", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "ينشئ وكلاء launchd ويثبّتهم (التطبيق، مراقب النسخ الاحتياطي، تشغيل الجهاز الافتراضي، حارس الجهاز الافتراضي).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "ثبّت Lima التي تشغّل الجهاز الافتراضي لـ CloudMachine: شغّل هذا في الطرفية", - "Install rclone (signs in to Google Drive for the machine)": - "ثبّت rclone (يسجّل الدخول إلى Google Drive للجهاز الافتراضي)", "Install the background agents (machine start, buffer guard, backup watchdog)": "ثبّت وكلاء الخلفية (تشغيل الجهاز الافتراضي، حارس المخزن المؤقت، مراقب النسخ الاحتياطي)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "DIRTY-TREE", "Cannot create the working directory: %@": "تعذّر إنشاء مجلد العمل: %@", - "Could not read the rclone version number.": - "تعذّرت قراءة رقم إصدار rclone.", "Could not download %@.": "تعذّر تنزيل %@.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba من الـ Mac: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "لم يجد هذا الـ Mac مسارًا إلى %@ (%@). إما أن المسار إلى الجهاز اختفى، أو أن خصوصية «الشبكة المحلية» في macOS لم تسمح لـ CloudMachine - عندها اسمح بذلك من إعدادات النظام > الخصوصية والأمن > الشبكة المحلية. تحقّق: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "جارٍ تثبيت rclone - تنزيله والتحقق منه", + "rclone could not be installed: %@": + "تعذّر تثبيت rclone: %@", + "Next attempt: %@": + "المحاولة التالية: %@", + "Lima is not installed - run in Terminal: %@": + "Lima غير مثبّتة - شغّل في Terminal: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+da.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+da.swift index cffe848..9e88eaf 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+da.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+da.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "Én mappe pr. Mac. Angives én gang - kan ikke ændres efter tilslutning.", "Use lowercase letters, digits and dashes.": "Brug små bogstaver, cifre og bindestreger.", - "Install rclone": - "Installer rclone", "Open System Settings": "Åbn Systemindstillinger", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "Opretter og installerer launchd-agenterne (appen, backup-vagthunden, maskinstart, maskinens vagt).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "Installer Lima, som kører CloudMachine-maskinen: kør dette i Terminal", - "Install rclone (signs in to Google Drive for the machine)": - "Installer rclone (logger maskinen ind på Google Drive)", "Install the background agents (machine start, buffer guard, backup watchdog)": "Installer baggrundsagenterne (maskinstart, buffervagt, backup-vagthund)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "SNAVSET-TRÆ", "Cannot create the working directory: %@": "Kan ikke oprette arbejdsmappen: %@", - "Could not read the rclone version number.": - "Kunne ikke læse rclones versionsnummer.", "Could not download %@.": "Kunne ikke hente %@.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba fra Mac: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "Denne Mac fandt ingen rute til %@ (%@). Enten er ruten til maskinen væk, eller macOS' anonymitet for \"Lokalt netværk\" har ikke tilladt CloudMachine - tillad det så i Systemindstillinger > Anonymitet & sikkerhed > Lokalt netværk. Tjek: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "Installerer rclone - henter og kontrollerer det", + "rclone could not be installed: %@": + "rclone kunne ikke installeres: %@", + "Next attempt: %@": + "Næste forsøg: %@", + "Lima is not installed - run in Terminal: %@": + "Lima er ikke installeret - kør i Terminal: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+de.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+de.swift index 01ec0a4..b0b2b74 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+de.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+de.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "Ein Ordner pro Mac. Wird einmal festgelegt und lässt sich nach dem Verbinden nicht mehr ändern.", "Use lowercase letters, digits and dashes.": "Nur Kleinbuchstaben, Ziffern und Bindestriche verwenden.", - "Install rclone": - "rclone installieren", "Open System Settings": "Systemeinstellungen öffnen", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "Erzeugt und installiert die launchd-Agents (App, Backup-Wächter, Maschinenstart, Maschinenwächter).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "Lima installieren, das die CloudMachine-Maschine ausführt: im Terminal ausführen", - "Install rclone (signs in to Google Drive for the machine)": - "rclone installieren (meldet die Maschine bei Google Drive an)", "Install the background agents (machine start, buffer guard, backup watchdog)": "Die Hintergrund-Agents installieren (Maschinenstart, Pufferwächter, Backup-Wächter)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "UNSAUBERER-BAUM", "Cannot create the working directory: %@": "Das Arbeitsverzeichnis kann nicht angelegt werden: %@", - "Could not read the rclone version number.": - "Die Versionsnummer von rclone konnte nicht gelesen werden.", "Could not download %@.": "%@ konnte nicht geladen werden.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba vom Mac: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "Dieser Mac hat keine Route zu %@ gefunden (%@). Entweder ist die Route zur Maschine weg, oder der macOS-Datenschutz „Lokales Netzwerk“ hat CloudMachine nicht erlaubt – dann unter Systemeinstellungen > Datenschutz & Sicherheit > Lokales Netzwerk erlauben. Prüfen: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "rclone wird installiert – Download und Prüfung laufen", + "rclone could not be installed: %@": + "rclone konnte nicht installiert werden: %@", + "Next attempt: %@": + "Nächster Versuch: %@", + "Lima is not installed - run in Terminal: %@": + "Lima ist nicht installiert – im Terminal ausführen: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+es.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+es.swift index 02dc636..fcf1d9b 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+es.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+es.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "Una carpeta por Mac. Se define una sola vez: no se puede cambiar después de conectar.", "Use lowercase letters, digits and dashes.": "Usa letras minúsculas, dígitos y guiones.", - "Install rclone": - "Instalar rclone", "Open System Settings": "Abrir Ajustes del Sistema", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "Genera e instala los agentes de launchd (app, supervisor de copias, arranque de la máquina, guardián de la máquina).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "Instala Lima, que ejecuta la máquina de CloudMachine: ejecuta esto en Terminal", - "Install rclone (signs in to Google Drive for the machine)": - "Instalar rclone (inicia sesión en Google Drive para la máquina)", "Install the background agents (machine start, buffer guard, backup watchdog)": "Instalar los agentes en segundo plano (arranque de la máquina, guardián del búfer, supervisor de copias)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "ÁRBOL-SUCIO", "Cannot create the working directory: %@": "No se puede crear el directorio de trabajo: %@", - "Could not read the rclone version number.": - "No se pudo leer el número de versión de rclone.", "Could not download %@.": "No se pudo descargar %@.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba desde Mac: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "Este Mac no encontró ninguna ruta a %@ (%@). O la ruta a la máquina ha desaparecido, o la privacidad de «Red local» de macOS no ha permitido CloudMachine; en ese caso, permítelo en Ajustes del Sistema > Privacidad y seguridad > Red local. Comprueba: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "Instalando rclone: descargándolo y verificándolo", + "rclone could not be installed: %@": + "No se pudo instalar rclone: %@", + "Next attempt: %@": + "Próximo intento: %@", + "Lima is not installed - run in Terminal: %@": + "Lima no está instalado. Ejecuta en Terminal: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+fi.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+fi.swift index 6ddafd3..c17abdd 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+fi.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+fi.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "Yksi kansio per Mac. Asetetaan kerran - sitä ei voi muuttaa yhdistämisen jälkeen.", "Use lowercase letters, digits and dashes.": "Käytä pieniä kirjaimia, numeroita ja tavuviivoja.", - "Install rclone": - "Asenna rclone", "Open System Settings": "Avaa Järjestelmäasetukset", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "Luo ja asentaa launchd-agentit (appi, varmuuskopioinnin valvoja, virtuaalikoneen käynnistys, virtuaalikoneen vartija).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "Asenna Lima, joka ajaa CloudMachine-virtuaalikonetta: suorita tämä Päätteessä", - "Install rclone (signs in to Google Drive for the machine)": - "Asenna rclone (kirjaa virtuaalikoneen Google Driveen)", "Install the background agents (machine start, buffer guard, backup watchdog)": "Asenna taustaagentit (virtuaalikoneen käynnistys, puskurin vartija, varmuuskopioinnin valvoja)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "LIKAINEN-PUU", "Cannot create the working directory: %@": "Työhakemistoa ei voi luoda: %@", - "Could not read the rclone version number.": - "rclonen versionumeroa ei voitu lukea.", "Could not download %@.": "Kohdetta %@ ei voitu ladata.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba Macista: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "Tämä Mac ei löytänyt reittiä kohteeseen %@ (%@). Joko reitti koneeseen on poissa, tai macOS:n Paikallisverkko-tietosuoja ei ole sallinut CloudMachinea - salli se silloin kohdassa Järjestelmäasetukset > Tietosuoja ja turvallisuus > Paikallisverkko. Tarkista: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "Asennetaan rclonea - ladataan ja tarkistetaan se", + "rclone could not be installed: %@": + "rclonea ei voitu asentaa: %@", + "Next attempt: %@": + "Seuraava yritys: %@", + "Lima is not installed - run in Terminal: %@": + "Lima ei ole asennettu - suorita Terminalissa: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+fr.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+fr.swift index e09b443..2b0f28d 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+fr.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+fr.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "Un dossier par Mac. Défini une seule fois - impossible à modifier après la connexion.", "Use lowercase letters, digits and dashes.": "Utilisez des lettres minuscules, des chiffres et des tirets.", - "Install rclone": - "Installer rclone", "Open System Settings": "Ouvrir Réglages Système", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "Génère et installe les agents launchd (app, surveillance des sauvegardes, démarrage de la machine, gardien de la machine).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "Installez Lima, qui exécute la machine CloudMachine : exécutez ceci dans Terminal", - "Install rclone (signs in to Google Drive for the machine)": - "Installez rclone (connecte la machine à Google Drive)", "Install the background agents (machine start, buffer guard, backup watchdog)": "Installez les agents en arrière-plan (démarrage de la machine, gardien du tampon, surveillance des sauvegardes)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "ARBORESCENCE-MODIFIÉE", "Cannot create the working directory: %@": "Impossible de créer le dossier de travail : %@", - "Could not read the rclone version number.": - "Impossible de lire le numéro de version de rclone.", "Could not download %@.": "Impossible de télécharger %@.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba (Mac) : %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "Ce Mac n'a trouvé aucune route vers %@ (%@). Soit la route vers la machine a disparu, soit la confidentialité « Réseau local » de macOS n'a pas autorisé CloudMachine - autorisez-le alors dans Réglages Système > Confidentialité et sécurité > Réseau local. Vérifier : cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "Installation de rclone : téléchargement et vérification", + "rclone could not be installed: %@": + "Impossible d’installer rclone : %@", + "Next attempt: %@": + "Prochaine tentative : %@", + "Lima is not installed - run in Terminal: %@": + "Lima n’est pas installé. Exécutez dans le Terminal : %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+he.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+he.swift index daf8a3a..cb7f9ff 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+he.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+he.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "תיקייה אחת לכל Mac. נקבעת פעם אחת - אי אפשר לשנות אחרי החיבור.", "Use lowercase letters, digits and dashes.": "השתמש באותיות לטיניות קטנות, ספרות ומקפים.", - "Install rclone": - "התקן את rclone", "Open System Settings": "פתח את הגדרות המערכת", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "יוצר ומתקין את סוכני launchd (אפליקציה, משגיח גיבוי, הפעלת המכונה, שומר המכונה).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "התקן את Lima, שמריצה את המכונה של CloudMachine: הרץ זאת במסוף", - "Install rclone (signs in to Google Drive for the machine)": - "התקן את rclone (מתחבר ל-Google Drive עבור המכונה)", "Install the background agents (machine start, buffer guard, backup watchdog)": "התקן את סוכני הרקע (הפעלת המכונה, שומר מאגר הביניים, משגיח הגיבוי)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "DIRTY-TREE", "Cannot create the working directory: %@": "לא ניתן ליצור את תיקיית העבודה: %@", - "Could not read the rclone version number.": - "לא ניתן היה לקרוא את מספר הגרסה של rclone.", "Could not download %@.": "לא ניתן היה להוריד את %@.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba מה-Mac: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "ה-Mac הזה לא מצא נתיב אל %@ (%@). או שהנתיב למכונה נעלם, או שפרטיות \"רשת מקומית\" של macOS לא התירה ל-CloudMachine - במקרה כזה התירו זאת בהגדרות המערכת > פרטיות ואבטחה > רשת מקומית. בדיקה: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "מתקין את rclone - מוריד ומאמת אותו", + "rclone could not be installed: %@": + "לא ניתן היה להתקין את rclone: %@", + "Next attempt: %@": + "הניסיון הבא: %@", + "Lima is not installed - run in Terminal: %@": + "Lima לא מותקן - הרץ ב-Terminal: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+it.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+it.swift index 128d9bb..fca2740 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+it.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+it.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "Una cartella per Mac. Si imposta una sola volta - non si può cambiare dopo il collegamento.", "Use lowercase letters, digits and dashes.": "Usa lettere minuscole, cifre e trattini.", - "Install rclone": - "Installa rclone", "Open System Settings": "Apri Impostazioni di Sistema", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "Genera e installa gli agenti launchd (app, controllo dei backup, avvio della macchina, guardia della macchina).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "Installa Lima, che esegue la macchina CloudMachine: esegui questo in Terminale", - "Install rclone (signs in to Google Drive for the machine)": - "Installa rclone (collega la macchina a Google Drive)", "Install the background agents (machine start, buffer guard, backup watchdog)": "Installa gli agenti in background (avvio della macchina, guardia del buffer, controllo dei backup)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "ALBERO-MODIFICATO", "Cannot create the working directory: %@": "Impossibile creare la cartella di lavoro: %@", - "Could not read the rclone version number.": - "Impossibile leggere il numero di versione di rclone.", "Could not download %@.": "Impossibile scaricare %@.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba dal Mac: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "Questo Mac non ha trovato alcun percorso verso %@ (%@). O il percorso verso la macchina non c'è più, oppure la privacy «Rete locale» di macOS non ha consentito CloudMachine: in tal caso consentilo in Impostazioni di Sistema > Privacy e sicurezza > Rete locale. Controlla: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "Installazione di rclone: download e verifica in corso", + "rclone could not be installed: %@": + "Impossibile installare rclone: %@", + "Next attempt: %@": + "Prossimo tentativo: %@", + "Lima is not installed - run in Terminal: %@": + "Lima non è installato: esegui nel Terminale: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+ja.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+ja.swift index 12fe232..de5c2d4 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+ja.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+ja.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "Macごとに1つのフォルダを使用します。一度だけ設定でき、接続後は変更できません。", "Use lowercase letters, digits and dashes.": "小文字、数字、ハイフンを使用してください。", - "Install rclone": - "rcloneをインストール", "Open System Settings": "システム設定を開く", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "launchdエージェント(App、バックアップ監視、マシンの起動、マシンのガード)を生成してインストールします。", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "CloudMachineマシンを動かすLimaをインストール: ターミナルで次を実行してください", - "Install rclone (signs in to Google Drive for the machine)": - "rcloneをインストール(マシン用にGoogle Driveへサインインします)", "Install the background agents (machine start, buffer guard, backup watchdog)": "バックグラウンドエージェントをインストール(マシンの起動、バッファのガード、バックアップ監視)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "未コミットの変更あり", "Cannot create the working directory: %@": "作業ディレクトリを作成できません: %@", - "Could not read the rclone version number.": - "rcloneのバージョン番号を読み取れませんでした。", "Could not download %@.": "%@ をダウンロードできませんでした。", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Mac からの Samba: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "この Mac は %@ への経路を見つけられませんでした(%@)。マシンへの経路がなくなったか、macOS の「ローカルネットワーク」プライバシーが CloudMachine を許可していません - その場合は システム設定 > プライバシーとセキュリティ > ローカルネットワーク で許可してください。確認: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "rclone をインストール中 - ダウンロードして検証しています", + "rclone could not be installed: %@": + "rclone をインストールできませんでした: %@", + "Next attempt: %@": + "次の試行: %@", + "Lima is not installed - run in Terminal: %@": + "Lima がインストールされていません。ターミナルで実行してください: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+ko.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+ko.swift index 44e79fb..c17702b 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+ko.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+ko.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "Mac마다 폴더 하나를 사용합니다. 한 번만 설정할 수 있으며 연결 후에는 변경할 수 없습니다.", "Use lowercase letters, digits and dashes.": "소문자, 숫자, 하이픈을 사용하세요.", - "Install rclone": - "rclone 설치", "Open System Settings": "시스템 설정 열기", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "launchd 에이전트(앱, 백업 감시, 머신 시작, 머신 가드)를 생성하고 설치합니다.", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "CloudMachine 머신을 실행하는 Lima 설치: 터미널에서 다음을 실행하세요", - "Install rclone (signs in to Google Drive for the machine)": - "rclone 설치(머신을 위해 Google Drive에 로그인합니다)", "Install the background agents (machine start, buffer guard, backup watchdog)": "백그라운드 에이전트 설치(머신 시작, 버퍼 가드, 백업 감시)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "커밋되지 않은 변경", "Cannot create the working directory: %@": "작업 디렉터리를 만들 수 없습니다: %@", - "Could not read the rclone version number.": - "rclone 버전 번호를 읽을 수 없습니다.", "Could not download %@.": "%@을(를) 다운로드할 수 없습니다.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Mac에서 Samba: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "이 Mac이 %@(으)로 가는 경로를 찾지 못했습니다(%@). 머신으로 가는 경로가 사라졌거나 macOS의 '로컬 네트워크' 개인정보 보호가 CloudMachine을 허용하지 않았습니다 - 그렇다면 시스템 설정 > 개인정보 보호 및 보안 > 로컬 네트워크에서 허용하세요. 확인: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "rclone 설치 중 - 다운로드하고 검증하는 중입니다", + "rclone could not be installed: %@": + "rclone을 설치할 수 없습니다: %@", + "Next attempt: %@": + "다음 시도: %@", + "Lima is not installed - run in Terminal: %@": + "Lima가 설치되어 있지 않습니다. 터미널에서 실행하세요: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+ms.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+ms.swift index 567a0ae..0aa9125 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+ms.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+ms.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "Satu folder bagi setiap Mac. Ditetapkan sekali - tidak boleh diubah selepas disambungkan.", "Use lowercase letters, digits and dashes.": "Gunakan huruf kecil, digit dan tanda sempang.", - "Install rclone": - "Pasang rclone", "Open System Settings": "Buka Tetapan Sistem", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "Menjana dan memasang ejen launchd (app, pengawas sandaran, permulaan mesin, pengawal mesin).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "Pasang Lima, yang menjalankan mesin CloudMachine: jalankan ini dalam Terminal", - "Install rclone (signs in to Google Drive for the machine)": - "Pasang rclone (log masuk ke Google Drive untuk mesin)", "Install the background agents (machine start, buffer guard, backup watchdog)": "Pasang ejen latar belakang (permulaan mesin, pengawal penimbal, pengawas sandaran)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "POKOK-KOTOR", "Cannot create the working directory: %@": "Tidak dapat mencipta direktori kerja: %@", - "Could not read the rclone version number.": - "Tidak dapat membaca nombor versi rclone.", "Could not download %@.": "Tidak dapat memuat turun %@.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba dari Mac: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "Mac ini tidak menemui laluan ke %@ (%@). Sama ada laluan ke mesin sudah hilang, atau privasi Rangkaian Setempat macOS belum membenarkan CloudMachine - jika begitu, benarkannya dalam Seting Sistem > Privasi & Keselamatan > Rangkaian Setempat. Semak: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "Memasang rclone - memuat turun dan mengesahkannya", + "rclone could not be installed: %@": + "rclone tidak dapat dipasang: %@", + "Next attempt: %@": + "Percubaan seterusnya: %@", + "Lima is not installed - run in Terminal: %@": + "Lima belum dipasang - jalankan dalam Terminal: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+nb.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+nb.swift index 9a369e0..e0963b4 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+nb.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+nb.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "Én mappe per Mac. Angis én gang - kan ikke endres etter tilkobling.", "Use lowercase letters, digits and dashes.": "Bruk små bokstaver, sifre og bindestreker.", - "Install rclone": - "Installer rclone", "Open System Settings": "Åpne Systeminnstillinger", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "Genererer og installerer launchd-agentene (appen, vakthund for sikkerhetskopi, maskinstart, maskinens vakt).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "Installer Lima, som kjører CloudMachine-maskinen: kjør dette i Terminal", - "Install rclone (signs in to Google Drive for the machine)": - "Installer rclone (logger maskinen på Google Drive)", "Install the background agents (machine start, buffer guard, backup watchdog)": "Installer bakgrunnsagentene (maskinstart, buffervakt, vakthund for sikkerhetskopi)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "SKITTENT-TRE", "Cannot create the working directory: %@": "Kan ikke opprette arbeidsmappen: %@", - "Could not read the rclone version number.": - "Kunne ikke lese versjonsnummeret til rclone.", "Could not download %@.": "Kunne ikke laste ned %@.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba fra Mac: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "Denne Macen fant ingen rute til %@ (%@). Enten er ruten til maskinen borte, eller personvernet for «Lokalt nettverk» i macOS har ikke tillatt CloudMachine - tillat det da i Systeminnstillinger > Personvern og sikkerhet > Lokalt nettverk. Sjekk: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "Installerer rclone – laster ned og kontrollerer den", + "rclone could not be installed: %@": + "Kunne ikke installere rclone: %@", + "Next attempt: %@": + "Neste forsøk: %@", + "Lima is not installed - run in Terminal: %@": + "Lima er ikke installert – kjør i Terminal: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+nl.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+nl.swift index 772919d..a5dd0d3 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+nl.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+nl.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "Eén map per Mac. Eenmalig in te stellen - na het verbinden niet meer te wijzigen.", "Use lowercase letters, digits and dashes.": "Gebruik kleine letters, cijfers en streepjes.", - "Install rclone": - "rclone installeren", "Open System Settings": "Systeeminstellingen openen", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "Genereert en installeert de launchd-agents (app, back-upwaakhond, machinestart, machinebewaker).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "Installeer Lima, waarmee de CloudMachine-machine draait: voer dit uit in Terminal", - "Install rclone (signs in to Google Drive for the machine)": - "Installeer rclone (meldt de machine aan bij Google Drive)", "Install the background agents (machine start, buffer guard, backup watchdog)": "Installeer de achtergrondagents (machinestart, bufferbewaker, back-upwaakhond)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "VUILE-BOOM", "Cannot create the working directory: %@": "Kan de werkmap niet aanmaken: %@", - "Could not read the rclone version number.": - "Kon het versienummer van rclone niet lezen.", "Could not download %@.": "Kon %@ niet downloaden.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba vanaf Mac: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "Deze Mac vond geen route naar %@ (%@). Of de route naar de machine is weg, of de macOS-privacy 'Lokaal netwerk' heeft CloudMachine niet toegestaan - sta het dan toe in Systeeminstellingen > Privacy en beveiliging > Lokaal netwerk. Controleer: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "rclone wordt geïnstalleerd - downloaden en controleren", + "rclone could not be installed: %@": + "rclone kon niet worden geïnstalleerd: %@", + "Next attempt: %@": + "Volgende poging: %@", + "Lima is not installed - run in Terminal: %@": + "Lima is niet geïnstalleerd - voer uit in Terminal: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+pt-BR.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+pt-BR.swift index ebc9dc3..887fd54 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+pt-BR.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+pt-BR.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "Uma pasta por Mac. Definida uma só vez - não pode ser alterada após a conexão.", "Use lowercase letters, digits and dashes.": "Use letras minúsculas, dígitos e hifens.", - "Install rclone": - "Instalar rclone", "Open System Settings": "Abrir Ajustes do Sistema", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "Gera e instala os agentes do launchd (app, supervisor de backup, inicialização da máquina, guardião da máquina).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "Instale o Lima, que executa a máquina do CloudMachine: execute isto no Terminal", - "Install rclone (signs in to Google Drive for the machine)": - "Instalar rclone (faz login no Google Drive para a máquina)", "Install the background agents (machine start, buffer guard, backup watchdog)": "Instalar os agentes em segundo plano (inicialização da máquina, guardião do buffer, supervisor de backup)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "ÁRVORE-SUJA", "Cannot create the working directory: %@": "Não foi possível criar o diretório de trabalho: %@", - "Could not read the rclone version number.": - "Não foi possível ler o número de versão do rclone.", "Could not download %@.": "Não foi possível baixar %@.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba do Mac: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "Este Mac não encontrou rota para %@ (%@). Ou a rota até a máquina sumiu, ou a privacidade de \"Rede Local\" do macOS não permitiu o CloudMachine - nesse caso, permita em Ajustes do Sistema > Privacidade e Segurança > Rede Local. Verifique: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "Instalando o rclone - baixando e verificando", + "rclone could not be installed: %@": + "Não foi possível instalar o rclone: %@", + "Next attempt: %@": + "Próxima tentativa: %@", + "Lima is not installed - run in Terminal: %@": + "O Lima não está instalado - execute no Terminal: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+ru.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+ru.swift index fb972df..70ebce2 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+ru.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+ru.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "Одна папка на каждый Mac. Задаётся один раз - после подключения изменить нельзя.", "Use lowercase letters, digits and dashes.": "Используйте строчные латинские буквы, цифры и дефисы.", - "Install rclone": - "Установить rclone", "Open System Settings": "Открыть Системные настройки", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "Создаёт и устанавливает агентов launchd (приложение, наблюдатель копий, запуск машины, страж машины).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "Установите Lima, которая запускает машину CloudMachine: выполните это в Терминале", - "Install rclone (signs in to Google Drive for the machine)": - "Установите rclone (выполняет вход машины в Google Drive)", "Install the background agents (machine start, buffer guard, backup watchdog)": "Установите фоновых агентов (запуск машины, страж буфера, наблюдатель копий)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "ГРЯЗНОЕ-ДЕРЕВО", "Cannot create the working directory: %@": "Не удаётся создать рабочий каталог: %@", - "Could not read the rclone version number.": - "Не удалось прочитать номер версии rclone.", "Could not download %@.": "Не удалось скачать %@.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba с Mac: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "Этот Mac не нашёл маршрута к %@ (%@). Либо маршрут к машине пропал, либо конфиденциальность «Локальная сеть» в macOS не разрешила CloudMachine - тогда разрешите это в Системных настройках > Конфиденциальность и безопасность > Локальная сеть. Проверьте: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "Установка rclone: загрузка и проверка", + "rclone could not be installed: %@": + "Не удалось установить rclone: %@", + "Next attempt: %@": + "Следующая попытка: %@", + "Lima is not installed - run in Terminal: %@": + "Lima не установлена - выполните в Терминале: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+sv.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+sv.swift index 395227b..c0fc796 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+sv.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+sv.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "En mapp per Mac. Anges en gång - kan inte ändras efter anslutning.", "Use lowercase letters, digits and dashes.": "Använd små bokstäver, siffror och bindestreck.", - "Install rclone": - "Installera rclone", "Open System Settings": "Öppna Systeminställningar", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "Genererar och installerar launchd-agenterna (appen, säkerhetskopieringsbevakaren, maskinstart, maskinvakten).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "Installera Lima, som kör CloudMachine-maskinen: kör det här i Terminal", - "Install rclone (signs in to Google Drive for the machine)": - "Installera rclone (loggar in maskinen på Google Drive)", "Install the background agents (machine start, buffer guard, backup watchdog)": "Installera bakgrundsagenterna (maskinstart, buffertvakt, säkerhetskopieringsbevakare)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "OSTÄDAT-TRÄD", "Cannot create the working directory: %@": "Kan inte skapa arbetskatalogen: %@", - "Could not read the rclone version number.": - "Kunde inte läsa versionsnumret för rclone.", "Could not download %@.": "Kunde inte hämta %@.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba från Mac: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "Den här Macen hittade ingen väg till %@ (%@). Antingen är vägen till maskinen borta, eller så har integritetsskyddet för ”Lokalt nätverk” i macOS inte tillåtit CloudMachine – tillåt det då i Systeminställningar > Integritet och säkerhet > Lokalt nätverk. Kontrollera: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "Installerar rclone - hämtar och kontrollerar den", + "rclone could not be installed: %@": + "rclone kunde inte installeras: %@", + "Next attempt: %@": + "Nästa försök: %@", + "Lima is not installed - run in Terminal: %@": + "Lima är inte installerat - kör i Terminal: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+th.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+th.swift index b4a4d10..0443919 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+th.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+th.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "หนึ่งโฟลเดอร์ต่อ Mac หนึ่งเครื่อง ตั้งครั้งเดียว - เปลี่ยนไม่ได้หลังจากเชื่อมต่อแล้ว", "Use lowercase letters, digits and dashes.": "ใช้ตัวพิมพ์เล็ก ตัวเลข และขีดกลาง", - "Install rclone": - "ติดตั้ง rclone", "Open System Settings": "เปิดการตั้งค่าระบบ", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "สร้างและติดตั้งเอเจนต์ launchd (แอป ตัวเฝ้าระวังการสำรองข้อมูล การเริ่มเครื่องเสมือน ตัวป้องกันเครื่องเสมือน)", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "ติดตั้ง Lima ซึ่งเรียกใช้เครื่องเสมือน CloudMachine: เรียกใช้คำสั่งนี้ในเทอร์มินัล", - "Install rclone (signs in to Google Drive for the machine)": - "ติดตั้ง rclone (ลงชื่อเข้าใช้ Google Drive ให้เครื่องเสมือน)", "Install the background agents (machine start, buffer guard, backup watchdog)": "ติดตั้งเอเจนต์เบื้องหลัง (การเริ่มเครื่องเสมือน ตัวป้องกันบัฟเฟอร์ ตัวเฝ้าระวังการสำรองข้อมูล)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "ต้นไม้สกปรก", "Cannot create the working directory: %@": "สร้างไดเรกทอรีทำงานไม่ได้: %@", - "Could not read the rclone version number.": - "อ่านหมายเลขเวอร์ชันของ rclone ไม่ได้", "Could not download %@.": "ดาวน์โหลด %@ ไม่ได้", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Samba จาก Mac: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "Mac เครื่องนี้หาเส้นทางไปยัง %@ ไม่พบ (%@) อาจเป็นเพราะเส้นทางไปยังเครื่องหายไป หรือความเป็นส่วนตัว \"เครือข่ายเฉพาะที่\" ของ macOS ยังไม่อนุญาต CloudMachine - หากเป็นเช่นนั้นให้อนุญาตใน การตั้งค่าระบบ > ความเป็นส่วนตัวและความปลอดภัย > เครือข่ายเฉพาะที่ ตรวจสอบ: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "กำลังติดตั้ง rclone - กำลังดาวน์โหลดและตรวจสอบ", + "rclone could not be installed: %@": + "ติดตั้ง rclone ไม่สำเร็จ: %@", + "Next attempt: %@": + "ความพยายามครั้งถัดไป: %@", + "Lima is not installed - run in Terminal: %@": + "ยังไม่ได้ติดตั้ง Lima - รันใน Terminal: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+tr.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+tr.swift index 8dbcff5..b6bf94c 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+tr.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+tr.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "Her Mac için bir klasör. Bir kez ayarlanır - bağlandıktan sonra değiştirilemez.", "Use lowercase letters, digits and dashes.": "Küçük harf, rakam ve tire kullanın.", - "Install rclone": - "rclone'u yükle", "Open System Settings": "Sistem Ayarları'nı aç", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "launchd aracılarını oluşturur ve kurar (uygulama, yedek gözcüsü, makine başlatma, makine bekçisi).", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "CloudMachine makinesini çalıştıran Lima'yı kurun: bunu Terminal'de çalıştırın", - "Install rclone (signs in to Google Drive for the machine)": - "rclone'u kurun (makine için Google Drive'da oturum açar)", "Install the background agents (machine start, buffer guard, backup watchdog)": "Arka plan aracılarını kurun (makine başlatma, arabellek bekçisi, yedek gözcüsü)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "KİRLİ-AĞAÇ", "Cannot create the working directory: %@": "Çalışma klasörü oluşturulamıyor: %@", - "Could not read the rclone version number.": - "rclone sürüm numarası okunamadı.", "Could not download %@.": "%@ indirilemedi.", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "Mac'ten Samba: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "Bu Mac %@ için yol bulamadı (%@). Ya makineye giden yol yok oldu ya da macOS'in Yerel Ağ gizliliği CloudMachine'e izin vermedi - bu durumda Sistem Ayarları > Gizlilik ve Güvenlik > Yerel Ağ bölümünden izin verin. Kontrol edin: cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "rclone kuruluyor - indiriliyor ve doğrulanıyor", + "rclone could not be installed: %@": + "rclone kurulamadı: %@", + "Next attempt: %@": + "Sonraki deneme: %@", + "Lima is not installed - run in Terminal: %@": + "Lima kurulu değil - Terminal'de çalıştırın: %@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+zh-Hans.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+zh-Hans.swift index 37fc713..4d13d57 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+zh-Hans.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+zh-Hans.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "每台 Mac 一个文件夹。只能设置一次,连接后无法更改。", "Use lowercase letters, digits and dashes.": "请使用小写字母、数字和连字符。", - "Install rclone": - "安装 rclone", "Open System Settings": "打开系统设置", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "生成并安装 launchd 代理(App、备份监测、虚拟机启动、虚拟机守护)。", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "安装运行 CloudMachine 虚拟机的 Lima:在终端中运行以下命令", - "Install rclone (signs in to Google Drive for the machine)": - "安装 rclone(为虚拟机登录 Google Drive)", "Install the background agents (machine start, buffer guard, backup watchdog)": "安装后台代理(虚拟机启动、缓冲区守护、备份监测)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "未提交更改", "Cannot create the working directory: %@": "无法创建工作目录:%@", - "Could not read the rclone version number.": - "无法读取 rclone 的版本号。", "Could not download %@.": "无法下载 %@。", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "从 Mac 到 Samba: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "此 Mac 找不到到 %@ 的路由(%@)。要么到机器的路由已消失,要么 macOS 的“本地网络”隐私设置未允许 CloudMachine——此时请在 系统设置 > 隐私与安全性 > 本地网络 中允许。检查:cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "正在安装 rclone - 下载并验证中", + "rclone could not be installed: %@": + "无法安装 rclone:%@", + "Next attempt: %@": + "下次尝试:%@", + "Lima is not installed - run in Terminal: %@": + "未安装 Lima - 请在“终端”中运行:%@", ] } diff --git a/mac-app/Sources/CloudMachineCore/L10nTranslations+zh-Hant.swift b/mac-app/Sources/CloudMachineCore/L10nTranslations+zh-Hant.swift index c6a106c..14f2157 100644 --- a/mac-app/Sources/CloudMachineCore/L10nTranslations+zh-Hant.swift +++ b/mac-app/Sources/CloudMachineCore/L10nTranslations+zh-Hant.swift @@ -181,8 +181,6 @@ extension L10nTranslations { "每台 Mac 一個資料夾。只能設定一次,連接後無法更改。", "Use lowercase letters, digits and dashes.": "請使用小寫字母、數字與連字號。", - "Install rclone": - "安裝 rclone", "Open System Settings": "打開系統設定", "Install agents": @@ -367,8 +365,6 @@ extension L10nTranslations { "產生並安裝 launchd 代理程式(App、備份監測、虛擬機器啟動、虛擬機器守護)。", "Install Lima, which runs the CloudMachine machine: run this in Terminal": "安裝執行 CloudMachine 虛擬機器的 Lima:在終端機中執行以下指令", - "Install rclone (signs in to Google Drive for the machine)": - "安裝 rclone(為虛擬機器登入 Google Drive)", "Install the background agents (machine start, buffer guard, backup watchdog)": "安裝背景代理程式(虛擬機器啟動、緩衝區守護、備份監測)", "Installs rclone through Homebrew - CloudMachine itself uses the one from install-rclone.": @@ -607,8 +603,6 @@ extension L10nTranslations { "未提交變更", "Cannot create the working directory: %@": "無法建立工作目錄:%@", - "Could not read the rclone version number.": - "無法讀取 rclone 的版本號碼。", "Could not download %@.": "無法下載 %@。", "No entry for %@ in SHA256SUMS.": @@ -977,5 +971,13 @@ extension L10nTranslations { "從 Mac 到 Samba: %@", "This Mac found no route to %@ (%@). Either the route to the machine is gone, or macOS Local Network privacy has not allowed CloudMachine - then allow it in System Settings > Privacy & Security > Local Network. Check: cloudmachine-agent vm-status": "此 Mac 找不到通往 %@ 的路由(%@)。可能是通往機器的路由已消失,或 macOS 的「區域網路」隱私權未允許 CloudMachine——此時請在 系統設定 > 隱私權與安全性 > 區域網路 中允許。檢查:cloudmachine-agent vm-status", + "Installing rclone - downloading and verifying it": + "正在安裝 rclone - 下載並驗證中", + "rclone could not be installed: %@": + "無法安裝 rclone:%@", + "Next attempt: %@": + "下次嘗試:%@", + "Lima is not installed - run in Terminal: %@": + "未安裝 Lima - 請在「終端機」中執行:%@", ] } diff --git a/mac-app/Sources/CloudMachineCore/RcloneAutoInstaller.swift b/mac-app/Sources/CloudMachineCore/RcloneAutoInstaller.swift new file mode 100644 index 0000000..dbf7275 --- /dev/null +++ b/mac-app/Sources/CloudMachineCore/RcloneAutoInstaller.swift @@ -0,0 +1,160 @@ +import Foundation + +/// What `rclone version` says, as numbers. +public enum RcloneVersion { + /// The oldest rclone CloudMachine is used with. Older builds lack + /// options the machine's mount and the usage measurement rely on. + public static let minimum = [1, 65, 0] + + /// `[1, 75, 1]` from `rclone v1.75.1` (the first line of the output; + /// suffixes such as `-beta.1` are ignored). `nil` when there is no number. + public static func parse(_ output: String) -> [Int]? { + guard let line = output.split(separator: "\n").first else { return nil } + let words = line.split(separator: " ") + guard words.count >= 2, words[0] == "rclone", words[1].hasPrefix("v") else { return nil } + let numbers = words[1].dropFirst().split(separator: "-").first ?? "" + let parts = numbers.split(separator: ".").compactMap { Int($0) } + guard parts.count == numbers.split(separator: ".").count, parts.count >= 3 else { return nil } + return Array(parts.prefix(3)) + } + + /// An unreadable answer is not acceptable: a binary that cannot say what + /// it is (wrong architecture, damaged) is replaced. + public static func isAcceptable(output: String) -> Bool { + guard let version = parse(output) else { return false } + return version.lexicographicallyPrecedes(minimum) == false + } +} + +public enum ToolInstallState: Equatable { + /// Nothing to report: rclone is fine, or the first check has not run. + case idle + case installing + /// The last install worked. + case installed + /// The last install failed; the next attempt is at `retryAt`. + case failed(String, retryAt: Date) +} + +/// Keeps rclone present and recent without anyone clicking: checked at app +/// start and then every hour, installed with the same SHA256-verified +/// `RcloneInstaller.install()` that `install-rclone` uses. +/// +/// There is no retry button. A failure (no network, wrong checksum) waits for +/// the next hourly check, so a problem someone has to fix never turns into a +/// loop hammering the download server. The window only shows the state. +@MainActor +public final class RcloneAutoInstaller: ObservableObject { + public static let checkInterval: TimeInterval = 3600 + + @Published public private(set) var state: ToolInstallState = .idle { + didSet { if state != oldValue { onChange?(state) } } + } + /// The binary on disk is missing, too old or unreadable and not yet + /// replaced - it must not count as "rclone is there". + public private(set) var replacementNeeded = false + /// Called on every change of `state`. + public var onChange: ((ToolInstallState) -> Void)? + + private let needsInstall: () async -> Bool + private let install: () async -> CMActionResult + private let now: () -> Date + private var nextCheck: Date? + private var checking = false + + public init( + needsInstall: @escaping () async -> Bool, install: @escaping () async -> CMActionResult, + now: @escaping () -> Date = Date.init + ) { + self.needsInstall = needsInstall + self.install = install + self.now = now + } + + /// The real checks: the managed binary, and the version it reports. + public static func live() -> RcloneAutoInstaller { + RcloneAutoInstaller( + needsInstall: { + let exists = CMTooling.hasManagedRclone + var output: String? + if exists { + // A single slow or failed probe (machine under load) must not + // replace a working binary: ask twice. + for _ in 0..<2 where output == nil { + output = (try? await CMTooling.runRclone(["version"], timeout: 30)) + .flatMap { $0.succeeded ? $0.stdout : nil } + } + } + return needsInstall(binaryExists: exists, versionOutput: output) + }, + install: { await RcloneInstaller.install() }) + } + + public nonisolated static func needsInstall(binaryExists: Bool, versionOutput: String?) -> Bool { + guard binaryExists, let output = versionOutput else { return true } + return !RcloneVersion.isAcceptable(output: output) + } + + /// The binary vanished between checks: make the next `tick` check at once. + /// Not after a failure - that wait stays an hour, so nothing loops. + public func checkNow() { + if case .failed = state { return } + nextCheck = nil + } + + /// Call as often as you like (the refresh loop does): it acts only when + /// the hourly check is due, and never while an install runs. + public func tick() async { + guard state != .installing, !checking else { return } + let start = now() + if let nextCheck, start < nextCheck { return } + nextCheck = start.addingTimeInterval(Self.checkInterval) + checking = true + let needed = await needsInstall() + checking = false + guard needed else { + replacementNeeded = false + if case .failed = state { state = .idle } + return + } + replacementNeeded = true + state = .installing + let result = await install() + CMLogger.log("[auto] rclone install: \(result.succeeded ? "ok" : "failed") - \(result.message)") + if result.succeeded { + replacementNeeded = false + state = .installed + } else { + // The wait counts from the end of the attempt, not its start. + let end = now() + nextCheck = end.addingTimeInterval(Self.checkInterval) + state = .failed(result.message, retryAt: end.addingTimeInterval(Self.checkInterval)) + } + } +} + +extension ToolInstallState { + public var isFailure: Bool { + if case .failed = self { return true } + return false + } +} + +/// Remembers which error text on the window came from the rclone install, so +/// that the install's own progress clears only that - never an unrelated error +/// such as a failed machine setup. +public struct RcloneErrorSlot { + private var owned: String? + public init() {} + + public mutating func apply(_ state: ToolInstallState, to message: inout String?) { + switch state { + case .failed(let text, _): + message = text + owned = text + case .installing, .installed, .idle: + if let owned, message == owned { message = nil } + owned = nil + } + } +} diff --git a/mac-app/Sources/CloudMachineCore/RcloneInstaller.swift b/mac-app/Sources/CloudMachineCore/RcloneInstaller.swift index ea80cf5..fb70b29 100644 --- a/mac-app/Sources/CloudMachineCore/RcloneInstaller.swift +++ b/mac-app/Sources/CloudMachineCore/RcloneInstaller.swift @@ -8,7 +8,23 @@ import Foundation /// The machine has its own rclone (`vm/cmsmb.yaml`). public enum RcloneInstaller { - private static let versionURL = "https://downloads.rclone.org/version.txt" + /// The version the machine runs too (`RCLONE_VERSION` in `vm/cmsmb.yaml`; + /// a test keeps the two equal). Pinned instead of "latest": an unattended + /// install must not move to a build nobody has looked at. + /// + /// Only an install that is NEEDED (missing, too old, unreadable) uses it - + /// a working rclone at or above `RcloneVersion.minimum` is never replaced, + /// so a Mac that already has a newer one is not downgraded. + public static let pinnedVersion = "v1.75.1" + + /// SHA256 of the release zips, from + /// https://downloads.rclone.org/v1.75.1/SHA256SUMS. In the code, not + /// downloaded: a checksum fetched from the same server as the archive proves + /// nothing about a compromised server. + public static let pinnedChecksums: [String: String] = [ + "osx-arm64": "c61d7a371c62bcbbe882c3423aa4b8bf63485c248dd0f692997b8f0c3f6d0c6f", + "osx-amd64": "29253d0288b8fbbac46baad6e5f6add6cb01d462c79f10805bbd4631c4cdf82c", + ] public static func install() async -> CMActionResult { let workDir = URL(fileURLWithPath: NSTemporaryDirectory()) @@ -23,25 +39,19 @@ public enum RcloneInstaller { message: L10n.tr("Cannot create the working directory: %@", error.localizedDescription)) } - guard let version = await latestVersion() else { - return CMActionResult( - succeeded: false, message: L10n.tr("Could not read the rclone version number.")) - } - + let version = pinnedVersion let arch = currentArch() let zipName = "rclone-\(version)-\(arch).zip" let zipURL = "https://downloads.rclone.org/\(version)/\(zipName)" - let sumsURL = "https://downloads.rclone.org/\(version)/SHA256SUMS" let zipPath = workDir.appendingPathComponent(zipName) - let sumsPath = workDir.appendingPathComponent("SHA256SUMS") - guard await download(zipURL, to: zipPath), await download(sumsURL, to: sumsPath) else { + guard await download(zipURL, to: zipPath) else { return CMActionResult(succeeded: false, message: L10n.tr("Could not download %@.", zipName)) } // Verifying the checksum is not decoration: we are downloading an // executable binary that will have access to the whole Google Drive. - guard let expected = expectedChecksum(sumsFile: sumsPath, zipName: zipName) else { + guard let expected = pinnedChecksums[arch] else { return CMActionResult( succeeded: false, message: L10n.tr("No entry for %@ in SHA256SUMS.", zipName)) } @@ -69,11 +79,8 @@ public enum RcloneInstaller { .appendingPathComponent("rclone-\(version)-\(arch)") .appendingPathComponent("rclone") let destination = CMTooling.managedRclonePath - try? FileManager.default.removeItem(at: destination) do { - try FileManager.default.copyItem(at: extracted, to: destination) - try FileManager.default.setAttributes( - [.posixPermissions: 0o755], ofItemAtPath: destination.path) + try swapIn(source: extracted, destination: destination) } catch { return CMActionResult( succeeded: false, @@ -114,15 +121,33 @@ public enum RcloneInstaller { return expectedChecksum(sumsContent: content, zipName: zipName) } - private static func latestVersion() async -> String? { - guard - let result = try? await ProcessRunner.run( - "/usr/bin/curl", ["-fsSL", versionURL], timeout: 60), - result.succeeded - else { return nil } - // Format: "rclone v1.75.1" - return result.stdout.split(separator: " ").last.map { - String($0).trimmingCharacters(in: .whitespacesAndNewlines) + /// Copies `source` beside `destination` and swaps it in atomically: a failed + /// copy leaves the old binary untouched, and two installs finishing together + /// (the app and `install-rclone`) cannot fail with "file exists" - the loser + /// of the race simply replaces the winner's file. + static func swapIn(source: URL, destination: URL) throws { + let fm = FileManager.default + let staged = destination.deletingLastPathComponent() + .appendingPathComponent(".rclone-new-\(UUID().uuidString)") + do { + try fm.copyItem(at: source, to: staged) + try fm.setAttributes([.posixPermissions: 0o755], ofItemAtPath: staged.path) + if fm.fileExists(atPath: destination.path) { + _ = try fm.replaceItemAt(destination, withItemAt: staged) + } else { + do { + try fm.moveItem(at: staged, to: destination) + } catch { + // Someone created it between the check and the move. + guard fm.fileExists(atPath: destination.path) else { throw error } + _ = try fm.replaceItemAt(destination, withItemAt: staged) + } + } + // `replaceItemAt` can keep the old file's mode; the binary must run. + try fm.setAttributes([.posixPermissions: 0o755], ofItemAtPath: destination.path) + } catch { + try? fm.removeItem(at: staged) + throw error } } diff --git a/mac-app/Tests/CloudMachineAppTests/RcloneAutoInstallTests.swift b/mac-app/Tests/CloudMachineAppTests/RcloneAutoInstallTests.swift new file mode 100644 index 0000000..ae6ad5b --- /dev/null +++ b/mac-app/Tests/CloudMachineAppTests/RcloneAutoInstallTests.swift @@ -0,0 +1,290 @@ +import XCTest + +@testable import CloudMachineApp +@testable import CloudMachineCore + +/// A fresh Mac used to show "missing rclone" until someone pressed a button. +/// The app now checks rclone at start and then every hour, installs it by +/// itself when it is missing or too old, and after a failure tries again at +/// the next hourly check - never more often. No button; the window shows the +/// state. The clock is injected, so nothing here sleeps. +@MainActor +final class RcloneAutoInstallTests: XCTestCase { + + // MARK: - Version check + + func testParsesRcloneVersionOutput() { + XCTAssertEqual( + RcloneVersion.parse( + "rclone v1.75.1\n- os/version: darwin 26.1 (64 bit)\n- go/version: go1.25"), + [1, 75, 1]) + XCTAssertEqual(RcloneVersion.parse("rclone v1.68.0-beta.123.abc"), [1, 68, 0]) + } + + func testGarbageHasNoVersion() { + XCTAssertNil(RcloneVersion.parse("")) + XCTAssertNil(RcloneVersion.parse("zsh: bad CPU type in executable")) + } + + func testOldOrUnreadableVersionNeedsInstall() { + XCTAssertTrue(RcloneVersion.isAcceptable(output: "rclone v1.75.1")) + XCTAssertTrue(RcloneVersion.isAcceptable(output: "rclone v2.0.0")) + XCTAssertFalse(RcloneVersion.isAcceptable(output: "rclone v1.50.2")) + XCTAssertFalse(RcloneVersion.isAcceptable(output: "rclone v1.2")) + XCTAssertFalse(RcloneVersion.isAcceptable(output: "no idea")) + } + + // MARK: - The coordinator + + private final class Fakes: @unchecked Sendable { + var needs = true + var result = CMActionResult(succeeded: true, message: "ok") + var installs = 0 + var checks = 0 + var now = Date(timeIntervalSince1970: 1_000_000) + func advance(_ seconds: TimeInterval) { now = now.addingTimeInterval(seconds) } + } + + private func installer(_ fakes: Fakes) -> RcloneAutoInstaller { + RcloneAutoInstaller( + needsInstall: { + fakes.checks += 1 + return fakes.needs + }, + install: { + fakes.installs += 1 + if fakes.result.succeeded { fakes.needs = false } + return fakes.result + }, + now: { fakes.now }) + } + + func testInstallsAtStartWhenRcloneIsMissing() async { + let fakes = Fakes() + let auto = installer(fakes) + await auto.tick() + XCTAssertEqual(fakes.installs, 1) + XCTAssertEqual(auto.state, .installed) + XCTAssertFalse(auto.replacementNeeded) + } + + func testDoesNothingWhenRcloneIsFine() async { + let fakes = Fakes() + fakes.needs = false + let auto = installer(fakes) + await auto.tick() + XCTAssertEqual(fakes.installs, 0) + XCTAssertEqual(auto.state, .idle) + } + + func testChecksAgainOnlyAfterAnHour() async { + let fakes = Fakes() + fakes.needs = false + let auto = installer(fakes) + await auto.tick() + fakes.advance(3599) + await auto.tick() + XCTAssertEqual(fakes.checks, 1) + fakes.advance(1) + await auto.tick() + XCTAssertEqual(fakes.checks, 2) + } + + func testRcloneRemovedLaterIsInstalledAtTheNextHourlyCheck() async { + let fakes = Fakes() + fakes.needs = false + let auto = installer(fakes) + await auto.tick() + fakes.needs = true + fakes.advance(3600) + await auto.tick() + XCTAssertEqual(fakes.installs, 1) + } + + func testFailureShowsMessageAndWhenTheNextAttemptIs() async { + let fakes = Fakes() + fakes.result = CMActionResult(succeeded: false, message: "no network") + let auto = installer(fakes) + await auto.tick() + XCTAssertEqual( + auto.state, .failed("no network", retryAt: fakes.now.addingTimeInterval(3600))) + XCTAssertTrue(auto.replacementNeeded) + } + + func testFailureIsNotRetriedBeforeTheNextCheck() async { + let fakes = Fakes() + fakes.result = CMActionResult(succeeded: false, message: "no network") + let auto = installer(fakes) + await auto.tick() + for _ in 0..<10 { + fakes.advance(300) // 50 minutes in all + await auto.tick() + } + XCTAssertEqual(fakes.installs, 1, "no loop faster than hourly") + } + + func testRetriesAtTheNextHourlyCheckAndRecovers() async { + let fakes = Fakes() + fakes.result = CMActionResult(succeeded: false, message: "bad checksum") + let auto = installer(fakes) + await auto.tick() + fakes.result = CMActionResult(succeeded: true, message: "ok") + fakes.advance(3600) + await auto.tick() + XCTAssertEqual(fakes.installs, 2) + XCTAssertEqual(auto.state, .installed) + } + + func testAnotherFailureSchedulesAnotherHour() async { + let fakes = Fakes() + fakes.result = CMActionResult(succeeded: false, message: "offline") + let auto = installer(fakes) + await auto.tick() + fakes.advance(3600) + await auto.tick() + XCTAssertEqual(fakes.installs, 2) + XCTAssertEqual(auto.state, .failed("offline", retryAt: fakes.now.addingTimeInterval(3600))) + } + + func testRcloneFixedByHandClearsTheError() async { + let fakes = Fakes() + fakes.result = CMActionResult(succeeded: false, message: "offline") + let auto = installer(fakes) + await auto.tick() + fakes.needs = false // someone ran install-rclone + fakes.advance(3600) + await auto.tick() + XCTAssertEqual(auto.state, .idle) + XCTAssertFalse(auto.replacementNeeded) + XCTAssertEqual(fakes.installs, 1) + } + + func testCheckNowBringsTheCheckForwardWhenTheBinaryVanished() async { + let fakes = Fakes() + fakes.needs = false + let auto = installer(fakes) + await auto.tick() + fakes.needs = true + fakes.advance(600) + await auto.tick() + XCTAssertEqual(fakes.installs, 0, "not due yet") + auto.checkNow() + await auto.tick() + XCTAssertEqual(fakes.installs, 1) + } + + func testCheckNowDoesNotSkipTheWaitAfterAFailure() async { + let fakes = Fakes() + fakes.result = CMActionResult(succeeded: false, message: "offline") + let auto = installer(fakes) + await auto.tick() + fakes.advance(600) + auto.checkNow() + await auto.tick() + XCTAssertEqual(fakes.installs, 1, "after a failure the next try is still an hour away") + } + + func testNeverRunsTwoAtOnce() async { + let fakes = Fakes() + var seen: [ToolInstallState] = [] + let gate = AsyncGate() + let auto = RcloneAutoInstaller( + needsInstall: { true }, + install: { + fakes.installs += 1 + await gate.wait() + return CMActionResult(succeeded: true, message: "ok") + }, + now: { fakes.now }) + auto.onChange = { seen.append($0) } + let first = Task { await auto.tick() } + while auto.state != .installing { await Task.yield() } + fakes.advance(7200) + // Second tick in its own task: if the guard were missing it would start a + // second install and park on the gate - the test must FAIL, not hang. + let second = Task { await auto.tick() } + for _ in 0..<50 { await Task.yield() } + XCTAssertEqual(fakes.installs, 1, "a second install must not start while one runs") + await gate.open() + await second.value + await first.value + XCTAssertEqual(seen, [.installing, .installed]) + } + + func testNeedsInstallPredicateCoversMissingBinaryAndOldVersion() { + XCTAssertTrue(RcloneAutoInstaller.needsInstall(binaryExists: false, versionOutput: nil)) + XCTAssertTrue( + RcloneAutoInstaller.needsInstall(binaryExists: true, versionOutput: "rclone v1.40.0")) + XCTAssertTrue(RcloneAutoInstaller.needsInstall(binaryExists: true, versionOutput: nil)) + XCTAssertFalse( + RcloneAutoInstaller.needsInstall(binaryExists: true, versionOutput: "rclone v1.75.1")) + } + + // MARK: - The setup card and the messages + + private func inputs(hasRclone: Bool, install: ToolInstallState) -> SetupPlan.Inputs { + SetupPlan.Inputs( + hasRclone: hasRclone, remoteConfigured: false, hasLima: true, machineExists: true, + machineRunning: true, hasFullDiskAccess: true, agentsInstalled: true, + timeMachineNotPointingHere: false, bundleNeedsPreparing: false, + connectCommand: "connect", setDestinationCommand: nil, + maskedSetDestinationCommand: nil, rcloneInstall: install) + } + + func testCardShowsProgressWithoutAButtonWhileInstalling() { + let step = SetupPlan.steps(inputs(hasRclone: false, install: .installing)).first + XCTAssertEqual(step?.inProgress, true) + XCTAssertNil(step?.action) + XCTAssertEqual(step?.title, "Installing rclone - downloading and verifying it") + } + + func testCardShowsTheErrorAndTheNextAttemptButNoButton() { + let at = Date(timeIntervalSince1970: 2_000_000) + let step = SetupPlan.steps( + inputs(hasRclone: false, install: .failed("no network", retryAt: at)) + ) + .first + XCTAssertNil(step?.action) + XCTAssertNil(step?.command) + XCTAssertEqual(step?.inProgress, false) + XCTAssertTrue(step?.title.hasPrefix("rclone could not be installed: no network") == true) + XCTAssertTrue(step?.title.contains("Next attempt: ") == true) + } + + func testMissingRcloneBeforeTheFirstCheckHasNoButtonEither() { + let step = SetupPlan.steps(inputs(hasRclone: false, install: .idle)).first + XCTAssertNil(step?.action) + XCTAssertEqual(step?.inProgress, true) + } + + func testNoRcloneStepWhenRcloneIsThere() { + let steps = SetupPlan.steps(inputs(hasRclone: true, install: .idle)) + XCTAssertTrue(steps.allSatisfy { $0.title.contains("rclone") == false }) + } + + func testHeadlineSaysInstallingInsteadOfMissing() { + let status = AppStatus() + status.dependencyState = .missing(["rclone"], ["cloudmachine-agent install-rclone"]) + status.rcloneInstall = .installing + XCTAssertEqual(status.headline, "Installing rclone") + } + + func testHeadlineTellsWhereLimaComesFrom() { + let status = AppStatus() + status.dependencyState = .missing(["Lima"], ["brew install lima"]) + XCTAssertEqual(status.headline, "Lima is not installed - run in Terminal: brew install lima") + } + + func testHeadlineKeepsMissingForOtherCombinations() { + let status = AppStatus() + status.dependencyState = .missing(["rclone", "Lima"], ["a", "brew install lima"]) + XCTAssertEqual(status.headline, "Missing: rclone, Lima") + } +} + +/// Lets a test hold a fake install open. +private actor AsyncGate { + private var isOpen = false + func wait() async { while !isOpen { await Task.yield() } } + func open() { isOpen = true } +} diff --git a/mac-app/Tests/CloudMachineAppTests/RcloneReviewFixesTests.swift b/mac-app/Tests/CloudMachineAppTests/RcloneReviewFixesTests.swift new file mode 100644 index 0000000..438ecc0 --- /dev/null +++ b/mac-app/Tests/CloudMachineAppTests/RcloneReviewFixesTests.swift @@ -0,0 +1,167 @@ +import XCTest + +@testable import CloudMachineApp +@testable import CloudMachineCore + +/// Second review of the automatic rclone install. +@MainActor +final class RcloneReviewFixesTests: XCTestCase { + + // MARK: - Version boundary + + func testMinimumVersionIsAcceptedAndOneBelowIsNot() { + XCTAssertTrue(RcloneVersion.isAcceptable(output: "rclone v1.65.0")) + XCTAssertFalse(RcloneVersion.isAcceptable(output: "rclone v1.64.2")) + XCTAssertTrue(RcloneVersion.isAcceptable(output: "rclone v1.65.1")) + } + + // MARK: - Swapping the binary in + + private func tempDir() throws -> URL { + let dir = URL(fileURLWithPath: NSTemporaryDirectory()) + .appendingPathComponent("rclone-swap-\(UUID().uuidString)") + try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true) + addTeardownBlock { try? FileManager.default.removeItem(at: dir) } + return dir + } + + func testSwapInReplacesAnExistingBinaryAndLeavesNoTemporaryFile() throws { + let dir = try tempDir() + let source = dir.appendingPathComponent("new") + let destination = dir.appendingPathComponent("rclone") + try "new".write(to: source, atomically: true, encoding: .utf8) + try "old".write(to: destination, atomically: true, encoding: .utf8) + try RcloneInstaller.swapIn(source: source, destination: destination) + XCTAssertEqual(try String(contentsOf: destination, encoding: .utf8), "new") + let attrs = try FileManager.default.attributesOfItem(atPath: destination.path) + XCTAssertEqual(attrs[.posixPermissions] as? Int, 0o755) + let left = try FileManager.default.contentsOfDirectory(atPath: dir.path).sorted() + XCTAssertEqual(left, ["new", "rclone"]) + } + + func testSwapInCreatesTheBinaryWhenThereIsNone() throws { + let dir = try tempDir() + let source = dir.appendingPathComponent("new") + let destination = dir.appendingPathComponent("rclone") + try "new".write(to: source, atomically: true, encoding: .utf8) + try RcloneInstaller.swapIn(source: source, destination: destination) + XCTAssertEqual(try String(contentsOf: destination, encoding: .utf8), "new") + } + + func testSwapInFailureKeepsTheOldBinary() throws { + let dir = try tempDir() + let destination = dir.appendingPathComponent("rclone") + try "old".write(to: destination, atomically: true, encoding: .utf8) + XCTAssertThrowsError( + try RcloneInstaller.swapIn( + source: dir.appendingPathComponent("missing"), destination: destination)) + XCTAssertEqual(try String(contentsOf: destination, encoding: .utf8), "old") + XCTAssertEqual(try FileManager.default.contentsOfDirectory(atPath: dir.path), ["rclone"]) + } + + func testConcurrentSwapsIntoAMissingBinaryBothSucceed() async throws { + // The app and `cloudmachine-agent install-rclone` can finish together on a + // fresh Mac: neither may fail with "file exists". + for _ in 0..<20 { + let dir = try tempDir() + let destination = dir.appendingPathComponent("rclone") + let a = dir.appendingPathComponent("a") + let b = dir.appendingPathComponent("b") + try "a".write(to: a, atomically: true, encoding: .utf8) + try "b".write(to: b, atomically: true, encoding: .utf8) + async let r1: Bool = Task.detached { + (try? RcloneInstaller.swapIn(source: a, destination: destination)) != nil + }.value + async let r2: Bool = Task.detached { + (try? RcloneInstaller.swapIn(source: b, destination: destination)) != nil + }.value + let results = await [r1, r2] + XCTAssertEqual(results, [true, true]) + XCTAssertTrue(FileManager.default.fileExists(atPath: destination.path)) + } + } + + // MARK: - Error banner ownership + + func testRcloneSuccessDoesNotClearAnotherError() { + var slot = RcloneErrorSlot() + var message: String? = "Set up the machine first" + slot.apply(.installed, to: &message) + XCTAssertEqual(message, "Set up the machine first") + slot.apply(.installing, to: &message) + XCTAssertEqual(message, "Set up the machine first") + } + + func testRcloneErrorIsShownAndThenCleared() { + var slot = RcloneErrorSlot() + var message: String? = nil + slot.apply(.failed("offline", retryAt: Date()), to: &message) + XCTAssertEqual(message, "offline") + slot.apply(.installing, to: &message) + XCTAssertNil(message) + } + + func testRcloneErrorIsNotClearedAfterSomethingElseReplacedIt() { + var slot = RcloneErrorSlot() + var message: String? = nil + slot.apply(.failed("offline", retryAt: Date()), to: &message) + message = "Set up the machine failed" + slot.apply(.installed, to: &message) + XCTAssertEqual(message, "Set up the machine failed") + } + + // MARK: - Headline versus the card + + func testHeadlineSaysInstallingWhileIdleToo() { + let status = AppStatus() + status.dependencyState = .missing(["rclone"], ["cloudmachine-agent install-rclone"]) + status.rcloneInstall = .idle + XCTAssertEqual(status.headline, "Installing rclone") + } + + func testHeadlineDoesNotSayInstallingAfterAFailure() { + let status = AppStatus() + status.dependencyState = .missing(["rclone"], ["cloudmachine-agent install-rclone"]) + status.rcloneInstall = .failed("offline", retryAt: Date()) + XCTAssertEqual(status.headline, "Missing: rclone") + } + + // MARK: - Pinned version + + func testPinnedVersionMatchesTheMachine() throws { + let yaml = URL(fileURLWithPath: #filePath) + .deletingLastPathComponent().deletingLastPathComponent() + .deletingLastPathComponent().deletingLastPathComponent() + .appendingPathComponent("vm/cmsmb.yaml") + let text = try String(contentsOf: yaml, encoding: .utf8) + func value(_ key: String) -> String? { + text.components(separatedBy: .newlines) + .first { $0.trimmingCharacters(in: .whitespaces).hasPrefix(key + "=") }? + .split(separator: "=", maxSplits: 1).last.map { String($0) } + } + XCTAssertEqual(value("RCLONE_VERSION"), RcloneInstaller.pinnedVersion) + } + + func testEveryMacArchitectureHasAPinnedChecksum() { + XCTAssertEqual(RcloneInstaller.pinnedVersion, "v1.75.1") + for arch in ["osx-arm64", "osx-amd64"] { + let sum = RcloneInstaller.pinnedChecksums[arch] + XCTAssertEqual(sum?.count, 64, arch) + XCTAssertTrue(sum?.allSatisfy { $0.isHexDigit } ?? false, arch) + } + } + + func testPinnedChecksumMatchesThePublishedSumsFile() { + // Real lines of https://downloads.rclone.org/v1.75.1/SHA256SUMS. + let sums = """ + 29253d0288b8fbbac46baad6e5f6add6cb01d462c79f10805bbd4631c4cdf82c rclone-v1.75.1-osx-amd64.zip + c61d7a371c62bcbbe882c3423aa4b8bf63485c248dd0f692997b8f0c3f6d0c6f rclone-v1.75.1-osx-arm64.zip + """ + for arch in ["osx-arm64", "osx-amd64"] { + XCTAssertEqual( + RcloneInstaller.expectedChecksum( + sumsContent: sums, zipName: "rclone-\(RcloneInstaller.pinnedVersion)-\(arch).zip"), + RcloneInstaller.pinnedChecksums[arch]) + } + } +} diff --git a/mac-app/Tests/CloudMachineAppTests/SetupPlanTests.swift b/mac-app/Tests/CloudMachineAppTests/SetupPlanTests.swift index 58ea0f8..3161814 100644 --- a/mac-app/Tests/CloudMachineAppTests/SetupPlanTests.swift +++ b/mac-app/Tests/CloudMachineAppTests/SetupPlanTests.swift @@ -36,7 +36,8 @@ final class SetupPlanTests: XCTestCase { input.hasFullDiskAccess = false input.agentsInstalled = false let steps = SetupPlan.steps(input) - XCTAssertEqual(steps.map(\.action), [.installRclone, nil]) + XCTAssertEqual(steps.map(\.action), [nil, nil]) + XCTAssertEqual(steps.first?.inProgress, true) XCTAssertEqual(steps.last?.command, "connect") }