如何启用 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";                              
}

相关内容