_1password-gui: update.sh improvements (#427655)

authored by Austin Horstman and committed by GitHub d9a77dd4 693750ae

+16 -5
+16 -5
pkgs/by-name/_1/_1password-gui/update.sh
··· 37 37 38 38 read_remote_versions() { 39 39 local channel="$1" 40 + local darwin_beta_maybe 40 41 41 42 if [[ ${channel} == "stable" ]]; then 42 43 remote_versions["stable/linux"]=$( ··· 56 57 | "${JQ[@]}" '.[] | select(.repo == "aur" and .srcname == "1password-beta") | .version | sub("_"; "-")' 57 58 ) 58 59 59 - remote_versions["beta/darwin"]=$( 60 + # Handle macOS Beta app-update feed quirk. 61 + # If there is a newer release in the stable channel, queries for beta 62 + # channel will return the stable channel version; masking the current beta. 63 + darwin_beta_maybe=$( 60 64 "${CURL[@]}" "${APP_UPDATES_URI_BASE}/Y" \ 61 65 | "${JQ[@]}" 'select(.available == "1") | .version' 62 66 ) 67 + # Only consider versions that end with '.BETA' 68 + if [[ ${darwin_beta_maybe} =~ \.BETA$ ]]; then 69 + remote_versions["beta/darwin"]=${darwin_beta_maybe} 70 + fi 63 71 fi 64 72 } 65 73 ··· 98 106 fi 99 107 done 100 108 101 - if [[ ${#new_version_available[@]} -eq 0 ]]; then 102 - # up to date 103 - exit 109 + num_updates=${#new_version_available[@]} 110 + if (( num_updates == 0 )); then 111 + exit # up to date 112 + elif (( num_updates == 1 )); then 113 + os=$(cut -d / -f 2 <<<"${new_version_available[@]}") 114 + os_specific_update=" (${os} only)" 104 115 fi 105 116 106 117 ./update-sources.py "${new_version_available[@]}" ··· 109 120 { 110 121 "attrPath": "${attr_path}", 111 122 "oldVersion": "${old_version}", 112 - "newVersion": "${new_version}", 123 + "newVersion": "${new_version}${os_specific_update-}", 113 124 "files": [ 114 125 "$PWD/sources.json" 115 126 ]