如何為 Google Chrome 啟用靜默自動更新?

如何為 Google Chrome 啟用靜默自動更新?

安裝 Google Chrome 會導致新增第三方軟體來源,可以從中擷取 Google Chrome 升級:

$ cat /etc/apt/sources.list.d/google-chrome.list
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb http://dl.google.com/linux/chrome/deb/ stable main

$ head -n 9 /var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_Release
Origin: Google, Inc.
Label: Google
Suite: stable
Codename: stable
Version: 1.0
Date: Tue, 04 Oct 2011 00:57:43 +0000
Architectures: i386 amd64
Components: main
Description: Google chrome-linux repository.

$ grep '^Package: ' /var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_main_binary-amd64_Packages 
Package: google-chrome-beta
Package: google-chrome-stable
Package: google-chrome-unstable

如何從此儲存庫啟用無人值守升級?

答案1

  1. 安裝無人升級:

    sudo apt-get install unattended-upgrades
    
  2. 透過編輯無人值守升級清單並在其中新增 Google Chrome 儲存庫,在 Google Chrome 儲存庫上啟用無人值守更新:

    sudo gedit /etc/apt/apt.conf.d/50unattended-upgrades
    

    添加"Google LLC:stable";到允許的來源:

    Unattended-Upgrade::Allowed-Origins {
        "${distro_id} ${distro_codename}-security";
    //  "${distro_id} ${distro_codename}-updates";
    //  "${distro_id} ${distro_codename}-proposed";
    //  "${distro_id} ${distro_codename}-backports";
     "Google LLC:stable";
    };
    
  3. 測試

    用於sudo unattended-upgrade --dry-run測試,如果一切順利,您應該在沒有任何干預的情況下安裝 Google Chrome 的更新。

要在空運行後檢查日誌是否正常運作:

cat /var/log/unattended-upgrades/unattended-upgrades.log

你應該在日誌中看到類似這樣的內容:

2011-10-11 18:03:23,292 INFO 允許的來源是: ['o=Ubuntu,a=oneiric-security', 'o=Google, Inc.,a=stable']

您可以透過編輯檔案來變更無人值守更新的配置/etc/apt/apt.conf.d/10periodic,而配置選項位於/etc/cron.daily/apt腳本標題中。閱讀它們以配置無人值守更新的頻率。

答案2

編輯/etc/apt/apt.conf.d/50unattended-upgrades並在其中添加一行Origins-Pattern

Unattended-Upgrade::Origins-Pattern {
        // Keep existing content here, just add:
        "origin=Google LLC,codename=stable";                              
}

相關內容