AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 790122
Accepted
Dan Jacobson
Dan Jacobson
Asked: 2025-01-25 23:59:08 +0800 CST2025-01-25 23:59:08 +0800 CST 2025-01-25 23:59:08 +0800 CST

有任何 shell 脚本可以更新为 deb822 .sources 格式吗?

  • 772

是否有一些 shell 脚本可以帮我更新文件?

# apt update
Notice: Missing Signed-By in the sources.list(5) entry for 'https://storage.googleapis.com/cros-packages/133'
Notice: Missing Signed-By in the sources.list(5) entry for 'http://opensource.nchc.org.tw/debian'
Notice: Consider migrating all sources.list(5) entries to the deb822 .sources format
Notice: The deb822 .sources format supports both embedded as well as external OpenPGP keys
Notice: See apt-secure(7) for best practices in configuring repository signing.

我花了几个小时试图弄清楚这一点,但最终还是放弃了。

我的文件中只有“deb ...”行。

以下是

$ cd /usr/share/keyrings && ls
cros.gpg                                        debian-archive-bullseye-stable.gpg
debian-archive-bookworm-automatic.gpg           debian-archive-buster-automatic.gpg
debian-archive-bookworm-security-automatic.gpg  debian-archive-buster-security-automatic.gpg
debian-archive-bookworm-stable.gpg              debian-archive-buster-stable.gpg
debian-archive-bullseye-automatic.gpg           debian-archive-keyring.gpg
debian-archive-bullseye-security-automatic.gpg  debian-archive-removed-keys.gpg

另外,我提交了https://issues.chromium.org/issues/392237686,因为 /etc/apt/sources.list.d/cros.list 难道不应该是 chrome 团队的责任来更新,而不是我的责任?

debian
  • 2 2 个回答
  • 146 Views

2 个回答

  • Voted
  1. Dan Jacobson
    2025-01-26T17:37:14+08:002025-01-26T17:37:14+08:00

    我终于做到了!这是我的脚本。在 sources.list 文件上运行它:

    #!/usr/bin/perl
    use strict;
    use warnings q!all!;
    my $n = "narflowitz";    #example                                                                         
    while (<>) {
        chomp;
        if (/^deb/) {
            die "$0: Sorry, can't deal with [options] yet."
              . " P.S., don't hold your breath."
              if /\[/;
            my @m = split;
            printf "$/#Was: $_$/Types: %s$/URIs: %s$/Suites: %s"
              . "$/Components: %s$/Signed-By: %s$/$/",                                               
              @m[ 0 .. 2 ], qq(@m[3..$#m]),
              q(/usr/share/keyrings/debian-archive-keyring.gpg);
        }
    }
    print "Tweak and put the above into a new file:                                                           
    /etc/apt/sources.list.d/$n.sources .                                                                      
    /etc/apt/sources.list.d/$n.list                                                                           
    is the old file that should be removed.                                                                   
    ";
    

    输出如下:

    #Was: deb http://opensource.nchc.org.tw/debian/ unstable main contrib non-free non-free-firmware
    Types: deb
    URIs: http://opensource.nchc.org.tw/debian/
    Suites: unstable
    Components: main contrib non-free non-free-firmware
    Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
    
    Tweak and put the above into a new file. E.g.,:
    /etc/apt/sources.list.d/narflowitz.sources .
    /etc/apt/sources.list.d/narflowitz.list
    is the old file that should be removed.
    
    • 1
  2. Best Answer
    Dan Jacobson
    2025-02-01T16:36:23+08:002025-02-01T16:36:23+08:00

    为什么你只需要自己写脚本就可以了呢?

    # apt modernize-sources
    The following files need modernizing:
      - /etc/apt/sources.list.d/google-chrome-beta.list
      - /etc/apt/sources.list.d/google-earth-pro.list
      - /etc/apt/sources.list.d/jidanni.list
    
    Modernizing will replace .list files with the new .sources format,
    add Signed-By values where they can be determined automatically,
    and save the old files into .list.bak files.
    

    听起来很可怕。

    不要害怕。

    For a simulation, respond N in the following prompt.
    Rewrite 3 sources? [Y/n] N
    Simulating only...
    

    你为什么不早点告诉我们?你知道,那样会更有成效。

    他们刚刚添加了它。

    • 0

相关问题

  • GRUB 配置以识别同一 Linux 发行版的不同桌面环境(安装)

  • astyle 不会更改源文件格式

  • 接收有关全新 Debian 的电子邮件

  • Debian Stretch:libgs_plugin_systemd-updates.so 中的 gnome-software 段错误

  • 如何在拼音输入法中输入ü?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve