diff --git a/Autoupdate/SUBinaryDeltaCreate.m b/Autoupdate/SUBinaryDeltaCreate.m index 9b923181..5f47f32e 100644 --- a/Autoupdate/SUBinaryDeltaCreate.m +++ b/Autoupdate/SUBinaryDeltaCreate.m @@ -90,6 +90,15 @@ static NSDictionary *infoForFile(FTSENT *ent) INFO_SIZE_KEY: @(size) }; } +static bool isSymLink(const FTSENT *ent) +{ + if (ent->fts_info == FTS_SL) + { + return (true); + } + return false; +} + static bool aclExists(const FTSENT *ent) { // macOS does not currently support ACLs for symlinks @@ -254,7 +263,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF if (verbose) { fprintf(stderr, "Creating version %u.%u patch...\n", majorVersion, minorVersion); - fprintf(stderr, "Processing %s...", [source fileSystemRepresentation]); + fprintf(stderr, "Processing source, %s...", [source fileSystemRepresentation]); } FTSENT *ent = 0; @@ -320,7 +329,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF } if (verbose) { - fprintf(stderr, "\nProcessing %s...", [destination fileSystemRepresentation]); + fprintf(stderr, "\nProcessing destination, %s...", [destination fileSystemRepresentation]); } pathBuffer[0] = 0; @@ -370,8 +379,8 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF // We should also not allow files with code signed extended attributes since Apple doesn't recommend inserting these // inside an application, and since we don't preserve extended attribitutes anyway - mode_t permissions = [(NSNumber *)info[INFO_PERMISSIONS_KEY] unsignedShortValue]; - if (!IS_VALID_PERMISSIONS(permissions)) { + mode_t permissions = [info[INFO_PERMISSIONS_KEY] unsignedShortValue]; + if (!isSymLink(ent) && !IS_VALID_PERMISSIONS(permissions)) { if (verbose) { fprintf(stderr, "\n"); } @@ -439,6 +448,9 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF } NSString *temporaryFile = temporaryPatchFile(patchFile); + if (verbose) { + fprintf(stderr, "\nWriting to temporary file %s...", [temporaryFile fileSystemRepresentation]); + } xar_t x = xar_open([temporaryFile fileSystemRepresentation], WRITE); if (!x) { if (verbose) { @@ -574,13 +586,19 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF xar_close(x); - unlink([patchFile fileSystemRepresentation]); - link([temporaryFile fileSystemRepresentation], [patchFile fileSystemRepresentation]); - unlink([temporaryFile fileSystemRepresentation]); - + NSFileManager *filemgr; + filemgr = [NSFileManager defaultManager]; + + [filemgr removeItemAtPath: patchFile error: NULL]; + if ([filemgr moveItemAtPath: temporaryFile toPath: patchFile error: NULL] != YES) + { + if (verbose) { + fprintf(stderr, "Failed to move temporary file, %s, to %s!\n", [temporaryFile fileSystemRepresentation], [patchFile fileSystemRepresentation]); + } + return NO; + } if (verbose) { fprintf(stderr, "\nDone!\n"); } - return YES; } diff --git a/Autoupdate/SUCodeSigningVerifier.m b/Autoupdate/SUCodeSigningVerifier.m index b87851ba..5797e87c 100644 --- a/Autoupdate/SUCodeSigningVerifier.m +++ b/Autoupdate/SUCodeSigningVerifier.m @@ -121,7 +121,22 @@ static id valueOrNSNull(id value) { return value ? value : [NSNull null]; } -+ (void)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label { ++ (NSDictionary *)codeSignatureInfoAtBundleURL:(NSURL *)bundlePath { + NSDictionary *info = nil; + SecStaticCodeRef code = NULL; + OSStatus result = SecStaticCodeCreateWithPath((__bridge CFURLRef)bundlePath, kSecCSDefaultFlags, &code); + if (result != noErr) { + SULog(SULogLevelError, @"Failed to get static code %d", result); + goto finally; + } + info = [self codeSignatureInfoForCode:code]; + +finally: + if (code) CFRelease(code); + return info; +} + ++ (NSDictionary *)codeSignatureInfoForCode:(SecStaticCodeRef)code { CFDictionaryRef signingInfo = nil; const SecCSFlags flags = (SecCSFlags) (kSecCSSigningInformation | kSecCSRequirementInformation | kSecCSDynamicInformation | kSecCSContentInformation); if (SecCodeCopySigningInformation(code, flags, &signingInfo) == noErr) { @@ -133,8 +148,14 @@ static id valueOrNSNull(id value) { NSDictionary *infoPlist = [signingDict objectForKey:@"info-plist"]; [relevantInfo setObject:valueOrNSNull([infoPlist objectForKey:@"CFBundleShortVersionString"]) forKey:@"version"]; [relevantInfo setObject:valueOrNSNull([infoPlist objectForKey:(__bridge NSString *)kCFBundleVersionKey]) forKey:@"build"]; - SULog(SULogLevelDefault, @"%@: %@", label, relevantInfo); + return [relevantInfo copy]; } + return nil; +} + ++ (void)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label { + NSDictionary *relevantInfo = [self codeSignatureInfoForCode:code]; + SULog(SULogLevelDefault, @"%@: %@", label, relevantInfo); } + (BOOL)bundleAtURLIsCodeSigned:(NSURL *)bundleURL diff --git a/CHANGELOG b/CHANGELOG index c68454b4..165dbac4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,21 @@ +# 1.20.0 + + * `generate_appcast` option to read private key directly from the keychain (Tamás Lustyik) + * Add delegate callbacks for fininshed download and extraction related events (Csaba Horony) + * Don't check for updates if Do Not Disturb is on (Kornel) + * Expose `CodesigningVerifier`, add codesign info API (sunuslee) + * Threading fixes: + * Fix potential hang with `dispatch_sync` to main thread (Brian Bergstrand) + * Fix closeCheckingWindow called from background thread (Alexey Martemyanov) + * Improve 'read-only' error message (#1192) (Adrian Thomas) + * New Spanish localisation (Ken Arroyo Ohori) + * Updated Finnish language resources (Jason Pollack) + * Hungarian localization (Csaba Horony) + * Log more information about authentication requests (Kornel) + * Explicitly specify types to silence "Messaging unqualified id" warning that's new in Xcode 10. Removed __has_feature(objc_generics) check and use generisc to help silence the warnings. (Kent Sutherland) + * Fix binary delta creation on network drives (sagecook) + * Fix compilation issues on Xcode 10 with new build system (Leo Natan) + # 1.19.0 * Refactoring of downloader code to avoid deprecated methods (Deadpikle) diff --git a/Configurations/ConfigCommon.xcconfig b/Configurations/ConfigCommon.xcconfig index 2526835e..1c073baa 100644 --- a/Configurations/ConfigCommon.xcconfig +++ b/Configurations/ConfigCommon.xcconfig @@ -16,7 +16,7 @@ SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0 SPARKLE_ICON_NAME = AppIcon SPARKLE_VERSION_MAJOR = 1 -SPARKLE_VERSION_MINOR = 19 +SPARKLE_VERSION_MINOR = 20 SPARKLE_VERSION_PATCH = 0 SPARKLE_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH) diff --git a/Documentation/build-docs.sh b/Documentation/build-docs.sh index 44b43bf4..65d5a000 100755 --- a/Documentation/build-docs.sh +++ b/Documentation/build-docs.sh @@ -5,6 +5,7 @@ if [ "$ACTION" = "" ] ; then doxygen Documentation/Doxyfile else echo "warning: Doxygen not found in PATH" + echo "open Terminal and type this command `brew install doxygen` then click `enter/return` key. finally build this target again" fi elif [ "$ACTION" = "clean" ] ; then rm -rf "$SRCROOT/Documentation/html" diff --git a/Sparkle.podspec b/Sparkle.podspec index 2292d7e1..705c3c4a 100644 --- a/Sparkle.podspec +++ b/Sparkle.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Sparkle" - s.version = "1.19.0" + s.version = "1.20.0" s.summary = "A software update framework for macOS" s.description = "Sparkle is an easy-to-use software update framework for Cocoa developers." s.homepage = "http://sparkle-project.org" diff --git a/Sparkle/es.lproj/Sparkle.strings b/Sparkle/es.lproj/Sparkle.strings index 09293904..195d3959 100644 --- a/Sparkle/es.lproj/Sparkle.strings +++ b/Sparkle/es.lproj/Sparkle.strings @@ -1,43 +1,47 @@ -"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ se han descargado y están listos para utilizar. ¿Le gustaría instalar e iniciar %1$@ ahora?"; +"%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?" = "¡%1$@ %2$@ se ha descargado y está lista para usarse! Ésta es una actualización importante. ¿Te gustaría instalarla y volver a abrir %1$@ ahora?"; -"%1$@ can't be updated, because it was opened from a read-only or a temporary location. Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "%1$@ no se puede actualizar cuando se ejecuta desde un volumen de sólo lectura como imagen de disco o medio óptico. Mueva %1$@ a su carpeta de Aplicaciones y trate de iniciarlo desde allí."; +"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "¡%1$@ %2$@ se ha descargado y está lista para usarse! ¿Te gustaría instalarla y volver a abrir %1$@ ahora?"; -"%@ %@ is currently the newest version available." = "%1$@ %2$@ es la última versión disponible."; +"%1$@ can't be updated, because it was opened from a read-only or a temporary location. Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "%1$@ no se puede actualizar porque fue abierta desde una ubicación temporal o de solo lectura. Usa Finder para copiar %1$@ a la carpeta Aplicaciones, vuélvela a abrir desde ahí e inténtalo de nuevo."; + +"%@ %@ is currently the newest version available." = "%1$@ %2$@ es la versión más nueva disponible."; /* Description text for SUUpdateAlert when the update is downloadable. */ -"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ está disponible (usted tiene la %3$@). ¿Desea descargarla ahora?"; +"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ ya está disponible (tienes la %3$@). ¿Quisieras descargarla ahora?"; /* Description text for SUUpdateAlert when the update informational with no download. */ -"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ is now available--you have %3$@. Would you like to learn more about this update on the web?"; +"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ ya está disponible--tú tienes la %3$@. ¿Quisieras aprender más acerca de esta actualización en la red?"; "%@ downloaded" = "%@ descargado"; "%@ of %@" = "%1$@ de %2$@"; -"A new version of %@ is available!" = "¡Hay una nueva versión de %@ !"; +"A new version of %@ is available!" = "¡Una nueva versión de %@ está disponible!"; -"A new version of %@ is ready to install!" = "¡Una versión nueva de %@ está lista para instalar!"; +"A new version of %@ is ready to install!" = "¡Una nueva versión de %@ está lista para instalarse!"; -"An error occurred in retrieving update information. Please try again later." = "Ocurrió un error al recopilar información sobre la actualización. Por favor, inténtelo de nuevo más tarde."; +"An error occurred in retrieving update information. Please try again later." = "Ocurrió un error al recopilar información sobre la actualización. Por favor inténtalo de nuevo más tarde."; -"An error occurred while downloading the update. Please try again later." = "Ocurrió un error mientras se descargaba la actualización. Por favor intente de nuevo más tarde."; +"An error occurred while downloading the update. Please try again later." = "Ocurrió un error al descargar la actualización. Por favor inténtalo de nuevo más tarde."; -"An error occurred while extracting the archive. Please try again later." = "Ocurrió un error al extraer el archivo. Por favor, inténtelo de nuevo más tarde."; +"An error occurred while extracting the archive. Please try again later." = "Ocurrió un error al extraer el archivo. Por favor inténtalo de nuevo más tarde."; -"An error occurred while installing the update. Please try again later." = "Ocurrió un error mientras se instalaba la actualización. Por favor intente de nuevo más tarde."; +"An error occurred while installing the update. Please try again later." = "Ocurrió un error al instalar la actualización. Por favor inténtalo de nuevo más tarde."; -"An error occurred while parsing the update feed." = "Ocurrió un error mientras se analizaba la entrada de la actualización."; +"An error occurred while parsing the update feed." = "Ocurrió un error al analizar la información de la actualización."; -"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Ocurrió un error mientras se re-iniciaba %1$@, pero la nueva versión estará disponible la próxima vez que ejecute %1$@."; +"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Ocurrió un error al volver a abrir %1$@, pero la nueva versión estará disponible la próxima vez que abras %1$@."; + +"An important update to %@ is ready to install" = "Una actualización importante para %@ está lista para instalarse"; /* the unit for bytes */ -"B" = "O"; +"B" = "B"; "Cancel" = "Cancelar"; "Cancel Update" = "Cancelar actualización"; -"Checking for updates..." = "Buscando actualizaciones …"; +"Checking for updates..." = "Buscando actualizaciones…"; /* Take care not to overflow the status window. */ "Downloading update..." = "Descargando actualización…"; @@ -46,34 +50,40 @@ "Extracting update..." = "Extrayendo actualización…"; /* the unit for gigabytes */ -"GB" = "GO"; +"GB" = "GB"; -"Install and Relaunch" = "Instalar y volver a arrancar"; +"Install and Relaunch" = "Instalar y volver a abrir"; /* Take care not to overflow the status window. */ "Installing update..." = "Instalando actualización…"; /* the unit for kilobytes */ -"KB" = "KO"; +"KB" = "KB"; + +/* Alternative name for "Install" button if we have a paid update or other update + without a download but with a URL. */ +"Learn More..." = "Más información…"; /* the unit for megabytes */ "MB" = "MB"; -"OK" = "OK"; +/* OK button. */ +"OK" = "Aceptar"; -"Ready to Install" = "Preparado para instalar"; +/* Status message on progress window once download has finished. */ +"Ready to Install" = "Listo para instalarse"; -"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "¿Debería automáticamente %1$@ buscar las actualizaciones? Puede hacerlo también manualmente desde el menú %1$@."; +/* Message that is optionally shown at startup to allow users to turn on/off update checks. */ +"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "¿Debería %1$@ buscar actualizaciones automáticamente? Siempre puedes buscar actualizaciones manualmente desde el menú %1$@."; + +"The update is improperly signed." = "La actualización está firmada incorrectamente."; "Update Error!" = "¡Error de actualización!"; "Updating %@" = "Actualizando %@"; -"You already have the newest version of %@." = "Ya tiene la versión más reciente de %@."; +/* 'Error' message when the user checks for updates but is already current or the feed doesn't contain any updates. (not necessarily shown in UI) */ +"You already have the newest version of %@." = "Ya tienes la versión más nueva de %@."; -"You're up-to-date!" = "Ya tiene la versión más reciente"; - -/* Alternative name for "Install" button if we have a paid update or other update - without a download but with a URL. */ - -"Learn More..." = "Más información…"; +/* Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates. */ +"You're up-to-date!" = "¡Está actualizado!"; diff --git a/Sparkle/fi.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/fi.lproj/SUAutomaticUpdateAlert.xib new file mode 100644 index 00000000..34bb077b --- /dev/null +++ b/Sparkle/fi.lproj/SUAutomaticUpdateAlert.xib @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sparkle/fi.lproj/SUUpdateAlert.xib b/Sparkle/fi.lproj/SUUpdateAlert.xib new file mode 100644 index 00000000..22b544d1 --- /dev/null +++ b/Sparkle/fi.lproj/SUUpdateAlert.xib @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NSNegateBoolean + + + + + + + + + + + + + + + + + + NSNegateBoolean + + + + + + + + + + + + + + + + + + NSNegateBoolean + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sparkle/fi.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/fi.lproj/SUUpdatePermissionPrompt.xib new file mode 100644 index 00000000..c99d50b1 --- /dev/null +++ b/Sparkle/fi.lproj/SUUpdatePermissionPrompt.xib @@ -0,0 +1,227 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + visibleKey + visibleValue + displayValue + displayKey + + + + + + + + + + + + + + + Anonymous system profile information is used to help us plan future development work. Please contact us if you have any questions about this. + +This is the information that would be sent: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SUIncludeProfile + SUSendProfileInfo + + + + + + + diff --git a/Sparkle/fi.lproj/Sparkle.strings b/Sparkle/fi.lproj/Sparkle.strings index 8c412406..dcef7e66 100644 --- a/Sparkle/fi.lproj/Sparkle.strings +++ b/Sparkle/fi.lproj/Sparkle.strings @@ -28,8 +28,12 @@ "Cancel" = "Kumoa"; +"Cancel Update" = "Peruuta päivitykset"; + "Check for updates on startup?" = "Tarkista päivityksiä käynnistyksen yhteydessä?"; +"Checking for updates..." = "Tarkistetaan päivityksiä…"; + "Downloading update..." = "Haen päivitystä…"; "Extracting update..." = "Puran päivitystä…"; diff --git a/Sparkle/fr.lproj/Sparkle.strings b/Sparkle/fr.lproj/Sparkle.strings index ad4466a1..fc9cf464 100644 --- a/Sparkle/fr.lproj/Sparkle.strings +++ b/Sparkle/fr.lproj/Sparkle.strings @@ -1,3 +1,5 @@ +"%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ a été téléchargé. C'est une mise à jour importante; voulez-vous l’installer et relancer %1$@ maintenant ?"; + "%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ a été téléchargé. Voulez-vous l’installer et relancer %1$@ maintenant ?"; "%1$@ can't be updated, because it was opened from a read-only or a temporary location. Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "%1$@ ne peut pas être mis à jour quand il fonctionne à partir d’un volume en lecture seule, comme une image disque ou un lecteur optique. Déplacez %1$@ dans votre dossier Applications, relancez-le à partir de là et réessayez."; @@ -30,6 +32,8 @@ "An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Une erreur est survenue en relançant %1$@, mais la nouvelle version sera disponible à la prochaine ouverture de %1$@."; +"An important update to %@ is ready to install" = "Une mise à jour importante de %@ est prête à être installée"; + /* the unit for bytes */ "B" = "octets"; diff --git a/Sparkle/hu.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/hu.lproj/SUAutomaticUpdateAlert.xib new file mode 100644 index 00000000..fd910c4b --- /dev/null +++ b/Sparkle/hu.lproj/SUAutomaticUpdateAlert.xib @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sparkle/hu.lproj/SUUpdateAlert.xib b/Sparkle/hu.lproj/SUUpdateAlert.xib new file mode 100644 index 00000000..f5145923 --- /dev/null +++ b/Sparkle/hu.lproj/SUUpdateAlert.xib @@ -0,0 +1,245 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NSNegateBoolean + + + + + + + + + + + + + + + + + + NSNegateBoolean + + + + + + + + + + + + + + + NSNegateBoolean + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sparkle/hu.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/hu.lproj/SUUpdatePermissionPrompt.xib new file mode 100644 index 00000000..27ea5b6b --- /dev/null +++ b/Sparkle/hu.lproj/SUUpdatePermissionPrompt.xib @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + visibleKey + visibleValue + displayValue + displayKey + + + + + + + + + + + + + + + Anonymous system profile information is used to help us plan future development work. Please contact us if you have any questions about this. + +This is the information that would be sent: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SUIncludeProfile + SUSendProfileInfo + + + + + + + diff --git a/Sparkle/hu.lproj/Sparkle.strings b/Sparkle/hu.lproj/Sparkle.strings new file mode 100644 index 00000000..a756c336 --- /dev/null +++ b/Sparkle/hu.lproj/Sparkle.strings @@ -0,0 +1,89 @@ +"%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?" = "A %1$@ %2$@ verziója letöltődött és készen áll a telepítésre! Ez egy fontos frissítés; szeretné most telepíteni, majd újraindítani a %1$@ alkalmazást?"; + +"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "A %1$@ %2$@ verziója letöltődött és készen áll a telepítésre! Szeretné most telepíteni, majd újraindítani a %1$@ alkalmazást?"; + +"%1$@ can't be updated, because it was opened from a read-only or a temporary location. Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "A programot nem lehet frissíteni, amikor egy csak olvasható kötetből (pl. lemezképfájl vagy optikai meghajtó) futtatja. Mozgassa a %1$@ alkalmazást az Alkalmazások mappába, indítsa újra onnan, majd próbálja újra a frissítést."; + +"%@ %@ is currently the newest version available." = "A %1$@ %2$@ a jelenleg elérhető legfrissebb verzió."; + +/* Description text for SUUpdateAlert when the update is downloadable. */ +"%@ %@ is now available--you have %@. Would you like to download it now?" = "A %1$@ %2$@ verziója már elérhető — az Ön jelenlegi verziója a %3$@. Szeretné most letölteni?"; + +/* Description text for SUUpdateAlert when the update informational with no download. */ +"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "A %1$@ %2$@ verziója már elérhető — az Ön jelenlegi verziója a %3$@. Szeretne megtekinteni további információkat online?"; + +"%@ downloaded" = "%@ letöltve"; + +"%@ of %@" = "%1$@ / %2$@"; + +"A new version of %@ is available!" = "A %@ egy újabb verziója elérhető!"; + +"A new version of %@ is ready to install!" = "A %@ egy újabb verziója készen áll a telepítésre!"; + +"An error occurred in retrieving update information. Please try again later." = "Hiba történt a frissítések lekérdezésekor. Kérjük, próbálja újra később."; + +"An error occurred while downloading the update. Please try again later." = "Hiba történt a frissítés letöltése közben. Kérjük, próbálja újra később."; + +"An error occurred while extracting the archive. Please try again later." = "Hiba történt a frissítés kicsomagolása közben. Kérjük, próbálja újra később."; + +"An error occurred while installing the update. Please try again later." = "Hiba történt a frissítés telepítése közben. Kérjük, próbálja újra később."; + +"An error occurred while parsing the update feed." = "Hiba történt az elérhető frissítések beolvasásakor."; + +"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Hiba történt a %1$@ újraindítása közben, de az új verzió a %1$@ következő indításakor így is elérhető lesz."; + +"An important update to %@ is ready to install" = "A %@ egy fontos frissítése készen áll a telepítésre"; + +/* the unit for bytes */ +"B" = "B"; + +"Cancel" = "Mégsem"; + +"Cancel Update" = "Frissítés megszakítása"; + +"Checking for updates..." = "Frissítések keresése…"; + +/* Take care not to overflow the status window. */ +"Downloading update..." = "Frissítés letöltése…"; + +/* Take care not to overflow the status window. */ +"Extracting update..." = "Frissítés kicsomagolása…"; + +/* the unit for gigabytes */ +"GB" = "GB"; + +"Install and Relaunch" = "Telepítés és újraindítás"; + +/* Take care not to overflow the status window. */ +"Installing update..." = "Frissítés telepítése…"; + +/* the unit for kilobytes */ +"KB" = "KB"; + +/* Alternative name for "Install" button if we have a paid update or other update + without a download but with a URL. */ +"Learn More..." = "További információ…"; + +/* the unit for megabytes */ +"MB" = "MB"; + +/* OK button. */ +"OK" = "OK"; + +/* Status message on progress window once download has finished. */ +"Ready to Install" = "A telepítő készen áll"; + +/* Message that is optionally shown at startup to allow users to turn on/off update checks. 1=app name*/ +"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "Szeretné, hogy a %1$@ ellenőrizze az elérhető frissítéseket induláskor? Ha nem, a frissítések keresését kézzel is elindíthatja a %1$@ menüből."; + +"The update is improperly signed." = "A frissítés aláírása sérült."; + +"Update Error!" = "Frissítési hiba!"; + +"Updating %@" = "%@ frissítése"; + +/* 'Error' message when the user checks for updates but is already current or the feed doesn't contain any updates. (not necessarily shown in UI). 1=app name */ +"You already have the newest version of %@." = "Ez a %@ jelenleg elérhető legfrissebb verziója."; + +/* Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates. */ +"You're up-to-date!" = "Nincs újabb verzió!"; diff --git a/generate_appcast/DSASignature.swift b/generate_appcast/DSASignature.swift index eccd1e18..7040d54c 100644 --- a/generate_appcast/DSASignature.swift +++ b/generate_appcast/DSASignature.swift @@ -5,8 +5,8 @@ import Foundation -func loadPrivateKey(privateKeyPath: URL) throws -> SecKey { - let data = try Data(contentsOf: privateKeyPath); +func loadPrivateKey(at privateKeyURL: URL) throws -> SecKey { + let data = try Data(contentsOf: privateKeyURL); var cfitems: CFArray? = nil; var format = SecExternalFormat.formatOpenSSL; @@ -14,7 +14,7 @@ func loadPrivateKey(privateKeyPath: URL) throws -> SecKey { let status = SecItemImport(data as CFData, nil, &format, &type, SecItemImportExportFlags(rawValue: UInt32(0)), nil, nil, &cfitems); if (status != errSecSuccess || cfitems == nil) { - print("Private DSA key file", privateKeyPath, "exists, but it could not be read. SecItemImport error", status); + print("Private DSA key file", privateKeyURL.path, "exists, but it could not be read. SecItemImport error", status); throw NSError(domain: SUSparkleErrorDomain, code: Int(OSStatus(SUError.signatureError.rawValue)), userInfo: nil); } @@ -25,6 +25,30 @@ func loadPrivateKey(privateKeyPath: URL) throws -> SecKey { return (cfitems! as NSArray)[0] as! SecKey; } +func loadPrivateKey(named keyName: String, fromKeychainAt keychainURL: URL) throws -> SecKey { + var keychain: SecKeychain? = nil + + guard SecKeychainOpen(keychainURL.path, &keychain) == errSecSuccess, keychain != nil else { + throw NSError(domain: SUSparkleErrorDomain, code: Int(OSStatus(SUError.signatureError.rawValue)), userInfo: nil) + } + + let query: [CFString: CFTypeRef] = [ + kSecClass: kSecClassKey, + kSecAttrKeyClass: kSecAttrKeyClassPrivate, + kSecAttrLabel: keyName as CFString, + kSecMatchLimit: kSecMatchLimitOne, + kSecUseKeychain: keychain!, + kSecReturnRef: kCFBooleanTrue + ] + + var item: CFTypeRef? = nil + guard SecItemCopyMatching(query as CFDictionary, &item) == errSecSuccess, item != nil else { + throw NSError(domain: SUSparkleErrorDomain, code: Int(OSStatus(SUError.signatureError.rawValue)), userInfo: nil) + } + + return item! as! SecKey +} + func dsaSignature(path: URL, privateKey: SecKey) throws -> String { var error: Unmanaged?; diff --git a/generate_appcast/main.swift b/generate_appcast/main.swift index 58b12a96..57ae99f2 100644 --- a/generate_appcast/main.swift +++ b/generate_appcast/main.swift @@ -10,37 +10,89 @@ import Foundation var verbose = false; +func printUsage() { + let command = URL(fileURLWithPath: CommandLine.arguments.first!).lastPathComponent; + print("Generate appcast from a directory of Sparkle updates\n", + "Usage:\n", + " \(command) < -f private key path | -k keychain_path -n key_name > \n", + " e.g. \(command) -k ~/Library/Keychains/login.keychain -n 'My Private Key' archives/\n", + "\nOR (legacy)\n\n", + " \(command) \n", + " e.g. \(command) dsa_priv.pem archives/\n", + "\n", + " Appcast files and deltas will be written to the archives directory.\n", + " Note that pkg-based updates are not supported.\n" + ) +} + func main() { let args = CommandLine.arguments; if args.count < 3 { - let command = URL(fileURLWithPath: args[0]).lastPathComponent; - print("Generate appcast from a directory of Sparkle updates\nUsage: \(command) \n", - " e.g. \(command) dsa_priv.pem archives/\n", - " Appcast files and deltas will be written to the archives directory.\n", - " Note that pkg-based updates are not supported.\n" - ) - exit(1); + printUsage() + exit(1) } + + let privateKey: SecKey + + if args.count == 3 || (args.count == 4 && args[1] == "-f") { + // private key specified by filename + let privateKeyURL = URL(fileURLWithPath: args.count == 3 ? args[1] : args[2]) + + do { + privateKey = try loadPrivateKey(at: privateKeyURL) + } catch { + print("Unable to load DSA private key from", privateKeyURL.path, "\n", error) + exit(1) + } + } + else if args.count == 6 && (args[1] == "-n" || args[1] == "-k") { + // private key specified by keychain + key name + let keyName: String + let keychainURL: URL + + if args[1] == "-n" { + if args[3] != "-k" { + printUsage() + exit(1) + } + + keyName = args[2] + keychainURL = URL(fileURLWithPath: args[4]) + } + else { + if args[3] != "-n" { + printUsage() + exit(1) + } + + keyName = args[4] + keychainURL = URL(fileURLWithPath: args[2]) + } - let privateKeyPath = URL(fileURLWithPath: args[1]); - let archivesSourceDir = URL(fileURLWithPath: args[2], isDirectory:true); + do { + privateKey = try loadPrivateKey(named: keyName, fromKeychainAt: keychainURL) + } catch { + print("Unable to load DSA private key '\(keyName)' from keychain at", keychainURL.path, "\n", error) + exit(1) + } + } + else { + printUsage() + exit(1) + } + + let archivesSourceDir = URL(fileURLWithPath: args.last!, isDirectory: true) do { - let privateKey = try loadPrivateKey(privateKeyPath: privateKeyPath); - do { - let allUpdates = try makeAppcast(archivesSourceDir: archivesSourceDir, privateKey: privateKey, verbose:verbose); - - for (appcastFile, updates) in allUpdates { - let appcastDestPath = URL(fileURLWithPath: appcastFile, relativeTo: archivesSourceDir); - try writeAppcast(appcastDestPath:appcastDestPath, updates:updates); - print("Written", appcastDestPath.path, "based on", updates.count, "updates"); - } - } catch { - print("Error generating appcast from directory", archivesSourceDir.path, "\n", error); - exit(1); + let allUpdates = try makeAppcast(archivesSourceDir: archivesSourceDir, privateKey: privateKey, verbose:verbose); + + for (appcastFile, updates) in allUpdates { + let appcastDestPath = URL(fileURLWithPath: appcastFile, relativeTo: archivesSourceDir); + try writeAppcast(appcastDestPath:appcastDestPath, updates:updates); + print("Written", appcastDestPath.path, "based on", updates.count, "updates"); } } catch { - print("Unable to load DSA private key from", privateKeyPath.path, "\n", error); + print("Error generating appcast from directory", archivesSourceDir.path, "\n", error); exit(1); } }